lib/ig_markets/position.rb
def price_delta
      case direction
      when :buy
        close_level - level
      when :sell
        level - close_level
      end
    end
# Returns the favorable difference in the price between {#level} and the current market price as stored in
# {#market}. If {#direction} is `:buy` and the market has since risen then this method will return a positive value,
# but if {#direction} is `:sell` and the market has since risen then this method will return a negative value.
#
# @return [Float]
Returns the favorable difference in the price between {#level} and the current market price as stored in
{#market}. If {#direction} is `:buy` and the market has since risen then this method will return a positive value,
but if {#direction} is `:sell` and the market has since risen then this method will return a negative value.
Returns the favorable difference in the price between { #level } and the current market price as stored in { #market } . If { #direction } is ` : buy ` and the market has since risen then this method will return a positive value but if { #direction } is ` : sell ` and the market has since risen then this method will return a negative value .
def price_delta
      case direction
      when :buy
        close_level - level
      when :sell
        level - close_level
      end
    end
def price_delta case direction when :buy close_level - level when :sell level - close_level end end
Returns the favorable difference in the price between {#level} and the current market price as stored in
{#market}.
Returns the favorable difference in the price between { #level } and the current market price as stored in { #market } .
None
Float