Class: IB::MarginCondition

Inherits:
OrderCondition show all
Defined in:
lib/models/ib/condition.rb

Constant Summary

Constants inherited from OrderCondition

OrderCondition::Subclasses

Class Method Summary collapse

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(operator, percent) ⇒ Object



154
155
156
157
158
# File 'lib/models/ib/condition.rb', line 154

def self.fabricate operator,  percent
	error "Condition Operator has to be \">=\" or \"<=\" " unless ["<=", ">="].include? operator 
	self.new operator: operator, 
					percent: percent
end

.make(buffer) ⇒ Object



144
145
146
147
148
149
# File 'lib/models/ib/condition.rb', line 144

def self.make  buffer
	self.new  conjunction_connection:  buffer.read_string,
						operator: buffer.read_int,
						percent: buffer.read_int

end

Instance Method Details

#condition_typeObject



140
141
142
# File 'lib/models/ib/condition.rb', line 140

def condition_type 
	4
end

#serializeObject



151
152
153
# File 'lib/models/ib/condition.rb', line 151

def serialize
super << self[:operator] << percent 
end