Class: IB::Stock

Inherits:
Contract show all
Defined in:
lib/models/ib/stock.rb

Constant Summary

Constants inherited from Contract

Contract::Subclasses

Instance Attribute Summary

Attributes inherited from Contract

#description

Instance Method Summary collapse

Methods inherited from Contract

#==, #bag?, #bond?, build, #essential, #expiry, #index?, #merge, #option?, #order_requirements, #serialize, #serialize_ib_ruby, #serialize_legs, #serialize_long, #serialize_short, #serialize_supershort, #serialize_under_comp, #stock?, #table_header, #table_row, #to_s, #to_short, #verify

Methods included from BaseProperties

#==, #as_table, #content_attributes, #invariant_attributes, #set_attribute_defaults, #table_header, #table_row, #update_missing

Instance Method Details

#default_attributesObject



8
9
10
# File 'lib/models/ib/stock.rb', line 8

def default_attributes
	super.merge :sec_type => :stock, currency:'USD', exchange:'SMART'
end

#to_humanObject



12
13
14
15
16
17
18
19
# File 'lib/models/ib/stock.rb', line 12

def to_human 
	att =  [ symbol, 
				  currency, ( exchange == 'SMART' ? nil: exchange ), 
					(primary_exchange.present? && !primary_exchange.empty? ? primary_exchange : nil),
					@description.present? ? " (#{@description}) " : nil,
	       ].compact
				"<Stock: " + att.join(" ") + ">"
end