Class: IB::ContractDetail

Inherits:
Model show all
Includes:
BaseProperties
Defined in:
lib/models/ib/contract_detail.rb

Overview

Additional Contract properties (volatile, therefore extracted)

Instance Method Summary collapse

Methods included from BaseProperties

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

Instance Method Details

#default_attributesObject



85
86
87
88
89
90
91
92
93
94
95
# File 'lib/models/ib/contract_detail.rb', line 85

def default_attributes
  super.merge :coupon => 0.0,
    :under_con_id => 0,
    :min_tick => 0,
    :ev_multipler => 0,
    :sec_id_list => Hash.new,
    :callable => false,
    :puttable => false,
    :convertible => false,
    :next_option_partial => false
end

#to_humanObject



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/models/ib/contract_detail.rb', line 97

def to_human
	ret = "<ContractDetails  #{long_name}, "
	ret << "--> #{market_name}, " if market_name.present?
	ret << "/C/ #{category}, /I/ #{industry} /SC/ #{subcategory}, " if category.present?
	ret << "Underlying:#{under_symbol}[#{under_sec_type}](#{under_con_id}), " unless under_con_id.zero?
    ret << "ev_multiplier:#{ev_multiplier}, " if ev_multiplier.present?
	ret << "convertible:#{convertible}, " if convertible
	ret << "coupon:#{coupon}, " if coupon.present?  && coupon > 0 
	ret << "md_size_multiplier:#{md_size_multiplier}, min_tick:#{min_tick}, "
	ret << "next_option_partial:#{next_option_partial}, " if next_option_partial.present?
	ret << "price_magnifier:#{price_magnifier}, " 
	ret << "puttable:#{puttable}, " if puttable.present? 
	ret << "sec_id-list:#{sec_id_list}, " unless sec_id_list.empty?
	ret <<"valid exchanges: #{ valid_exchanges}; order types: #{order_types} >"
end