Sha256: c9961a283b64ab4c8af4cbbf980fe62c3586d23557d5da7dcc1fc702069e3474

Contents?: true

Size: 816 Bytes

Versions: 9

Compression:

Stored size: 816 Bytes

Contents

module IB

  # 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 # module IB

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
my-ib-api-0.0.4 lib/models/ib/underlying.rb
my-ib-api-0.0.3 lib/models/ib/underlying.rb
my-ib-api-0.0.2 lib/models/ib/underlying.rb
my-ib-api-0.0.1 lib/models/ib/underlying.rb
ib-api-972.0 lib/models/ib/underlying.rb
ib-ruby-0.9.2 lib/models/ib/underlying.rb
ib-ruby-0.9.1 lib/models/ib/underlying.rb
ib-ruby-0.9.0 lib/models/ib/underlying.rb
ib-ruby-0.8.5 lib/models/ib/underlying.rb