Class IB::Datatypes::Contract
In: datatypes.rb
Parent: Object

Methods

Attributes

bond_type  [RW]  Bond values
callable  [RW]  Bond values
combo_legs  [RW] 
convertible  [RW]  Bond values
coupon  [RW]  Bond values
coupon_type  [RW]  Bond values
currency  [RW] 
cusip  [RW]  Bond values
desc_append  [RW]  Bond values
exchange  [RW] 
expiry  [RW] 
issue_date  [RW]  Bond values
local_symbol  [RW] 
maturity  [RW]  Bond values
multiplier  [RW] 
primary_exchange  [RW] 
puttable  [RW]  Bond values
ratings  [RW]  Bond values
right  [RW] 
sec_type  [RW] 
strike  [RW] 
symbol  [RW] 

Public Class methods

[Source]

     # File datatypes.rb, line 124
124:       def initialize
125:         @combo_legs = Array.new
126:         @strike = 0
127:       end

Public Instance methods

Some messages send open_close too, some don’t. WTF.

[Source]

     # File datatypes.rb, line 169
169:       def serialize_combo_legs(include_open_close = false)
170:         if self.combo_legs.nil?
171:           [0]
172:         else
173:           [ self.combo_legs.size ].concat(self.combo_legs.serialize(include_open_close)
174:         end     
175:       end

This returns an Array of data from the given contract, in standard format. Note that it does not include the combo legs.

[Source]

     # File datatypes.rb, line 150
150:       def serialize_long(version)
151:         queue = [
152:                   self.symbol,
153:                   self.sec_type,
154:                   self.expiry,
155:                   self.strike,
156:                   self.right,
157:                 ]
158: 
159:         queue.push(self.multiplier) if version >= 15
160:         queue.push(self.exchange)
161:         queue.push(self.primary_exchange) if version >= 14
162:         queue.push(self.currency)
163:         queue.push(self.local_symbol) if version >= 2
164:         
165:         queue
166:       end

Different messages serialize contracts differently. Go figure.

[Source]

     # File datatypes.rb, line 131
131:       def serialize_short(version)
132:         q = [ self.symbol,
133:               self.sec_type,
134:               self.expiry,
135:               self.strike,
136:               self.right ]
137: 
138:         q.push(self.multiplier) if version >= 15
139:         q.concat([
140:                   self.exchange,
141:                   self.currency,
142:                   self.local_symbol
143:                  ])
144: 
145:         q
146:       end

[Validate]