Sha256: 5ac1105e536d6be65f473e0cf3229db65a62a3b2f3e41a6a8a1229cc0b91e534

Contents?: true

Size: 907 Bytes

Versions: 8

Compression:

Stored size: 907 Bytes

Contents

module IB
  if defined?(Underlying) 
		puts "Underlying already a #{defined?(Underlying)}"
	else

  # Calculated characteristics of underlying Contract (volatile)
  class Underlying < IB::Model
    include BaseProperties

    has_one :contract

    prop :con_id, # Id of the Underlying Contract
      :delta, # double: The underlying stock or future delta.
      :price #  double: The price of the underlying.

      validates_numericality_of :con_id, :delta, :price #, :allow_nil => true

    def default_attributes
      super.merge :con_id => 0
    end

    # Serialize under_comp parameters
    def serialize
      [true, con_id, delta, price]
    end

    # Comparison
    def == other
      super(other) ||
        other.is_a?(self.class) &&
        con_id == other.con_id && delta == other.delta && price == other.price
    end

  end # class Underlying
  UnderComp = Underlying
	end
end # module IB

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ib-api-972.5.2 lib/models/ib/underlying.rb
ib-api-972.5.1 lib/models/ib/underlying.rb
ib-api-972.5 lib/models/ib/underlying.rb
ib-api-972.4 lib/models/ib/underlying.rb
ib-api-972.3.1 lib/models/ib/underlying.rb
ib-api-972.3 lib/models/ib/underlying.rb
ib-api-972.2 lib/models/ib/underlying.rb
ib-api-972.1 lib/models/ib/underlying.rb