Class: IB::VolumeCondition
- Inherits:
-
OrderCondition
- Object
- OrderCondition
- IB::VolumeCondition
- Defined in:
- lib/models/ib/condition.rb
Constant Summary
Constants inherited from OrderCondition
Class Method Summary collapse
-
.fabricate(contract, operator, volume) ⇒ Object
dsl: VolumeCondition.fabricate some_contract, “>=”, 50000.
- .make(buffer) ⇒ Object
Instance Method Summary collapse
Methods inherited from OrderCondition
#default_attributes, make_from, #serialize_contract_by_con_id, verify_contract_if_necessary
Methods included from BaseProperties
#==, #as_table, #content_attributes, #default_attributes, #invariant_attributes, #set_attribute_defaults, #table_header, #table_row, #to_human, #update_missing
Class Method Details
.fabricate(contract, operator, volume) ⇒ Object
dsl: VolumeCondition.fabricate some_contract, “>=”, 50000
187 188 189 190 191 192 |
# File 'lib/models/ib/condition.rb', line 187 def self.fabricate contract, operator, volume error "Condition Operator has to be \">=\" or \"<=\" " unless ["<=", ">="].include? operator self.new operator: operator, volume: volume, contract: verify_contract_if_necessary( contract ) end |
.make(buffer) ⇒ Object
171 172 173 174 175 176 177 178 179 |
# File 'lib/models/ib/condition.rb', line 171 def self.make buffer m = self.new conjunction_connection: buffer.read_string, operator: buffer.read_int, volumne: buffer.read_int the_contract = IB::Contract.new con_id: buffer.read_int, exchange: buffer.read_string m.contract = the_contract m end |