Skip to content

Commit

Permalink
Corrected ContractDetails#ev_multiplies accessory misspelled by IB
Browse files Browse the repository at this point in the history
  • Loading branch information
arvicco committed Oct 31, 2012
1 parent 691c81e commit ea6e2d8
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 19 deletions.
20 changes: 10 additions & 10 deletions db/migrate/161_add_ib_contract_details.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,21 @@ def change
t.string :valid_next_option_type # Bonds only
t.string :valid_next_option_partial # Bonds only
t.string :ev_rule # Australian non-currency products only
t.float :ev_multipler # Australian non-currency products only
t.float :ev_multiplier # Australian non-currency products only
t.text :sec_id_list
t.timestamps
end
end
end

__END__
rails generate scaffold contract_detail contract_id:integer market_name:string
trading_class:string min_tick:float price_magnifier:integer order_types:string
valid_exchanges:string under_con_id:integer long_name:string contract_month:string
industry:string category:string subcategory:string time_zone:string trading_hours:string
liquid_hours:string cusip:string ratings:string desc_append:string bond_type:string
coupon_type:string coupon:float maturity:string issue_date:string next_option_date:string
next_option_type:string notes:string callable:boolean puttable:boolean convertible:boolean
next_option_partial:boolean valid_next_option_date:string valid_next_option_type:string
valid_next_option_partial:string ev_rule:string ev_multipler:float sec_id_list:text
rails generate scaffold contract_detail contract_id:integer market_name:string
trading_class:string min_tick:float price_magnifier:integer order_types:string
valid_exchanges:string under_con_id:integer long_name:string contract_month:string
industry:string category:string subcategory:string time_zone:string trading_hours:string
liquid_hours:string cusip:string ratings:string desc_append:string bond_type:string
coupon_type:string coupon:float maturity:string issue_date:string next_option_date:string
next_option_type:string notes:string callable:boolean puttable:boolean convertible:boolean
next_option_partial:boolean valid_next_option_date:string valid_next_option_type:string
valid_next_option_partial:string ev_rule:string ev_multiplier:float sec_id_list:text

2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
t.string "valid_next_option_type"
t.string "valid_next_option_partial"
t.string "ev_rule"
t.float "ev_multipler"
t.float "ev_multiplier"
t.text "sec_id_list"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
Expand Down
10 changes: 5 additions & 5 deletions lib/models/ib/contract_detail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class ContractDetail < IB::Model
prop :market_name, # The market name for this contract.
:trading_class, # The trading class name for this contract.
:min_tick, # double: The minimum price tick.
:price_magnifier, # int: Allows execution and strike prices to be reported
:price_magnifier, # int: Allows execution and strike prices to be reported
# consistently with market data, historical data and the
# order price: Z on LIFFE is reported in index points, not GBP.

Expand Down Expand Up @@ -38,10 +38,10 @@ class ContractDetail < IB::Model
:ev_rule, # evRule - String contains the Economic Value Rule name and optional argument,
# separated by a colon. Examle: aussieBond:YearsToExpiration=3.
# When the optional argument not present, the value will be followed by a colon.
:ev_multipler, # evMultipler - double, tells you approximately how much the market
# value of a contract would change if the price were to change by 1.
# It cannot be used to get market value by multiplying the price by
# the approximate multiplier.
[:ev_multiplier, :ev_multipler], # evMultiplier - double, tells you approximately
# how much the market value of a contract would change if the price were
# to change by 1. It cannot be used to get market value by multiplying
# the price by the approximate multiplier.

:sec_id_list, # Hash with multiple Security ids

Expand Down
4 changes: 3 additions & 1 deletion spec/models/ib/contract_detail_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
:time_zone => 'EST',
:trading_hours => '20120422:0930-1600;20120423:0930-1600',
:liquid_hours => '20120422:0930-1600;20120423:0930-1600',
:ev_rule => 'aussieBond:YearsToExpiration=3',
:ev_multiplier => 0.5,
},

:human =>/ContractDetail: callable: false category: Computers contract_month: 201301 convertible: false coupon: 0.0 created_at: .* industry: Technology liquid_hours: 20120422:0930-1600;20120423:0930-1600 long_name: APPLE INC market_name: AAPL min_tick: 0.01 next_option_partial: false order_types: ACTIVETIM,ADJUST,ALERT,ALGO,ALLOC,AON,AVGCOST,BASKET,COND,CONDORDER,DAY,DEACT,DEACTDIS,DEACTEOD,FOK,GAT,GTC,GTD,GTT,HID,ICE,IOC,LIT,LMT,MIT,MKT,MTL,NONALGO,OCA,PAON,POSTONLY,RELSTK,SCALE,SCALERST,SMARTSTG,STP,STPLMT,TRAIL,TRAILLIT,TRAILLMT,TRAILMIT,VOLAT,WHATIF, price_magnifier: 1 puttable: false .*subcategory: Computers time_zone: EST trading_class: AAPL trading_hours: 20120422:0930-1600;20120423:0930-1600 under_con_id: 265598 updated_at: .* valid_exchanges: SMART,AMEX,BATS,BOX,CBOE,CBOE2,IBSX,ISE,MIBSX,NASDAQOM,PHLX,PSE>/,
Expand All @@ -33,7 +35,7 @@

:aliases =>
{[:contract, :summary] => {IB::Contract.new => IB::Contract.new}
} do
} do

it_behaves_like 'Model with invalid defaults'
it_behaves_like 'Self-equal Model'
Expand Down
9 changes: 7 additions & 2 deletions spec/models/ib/execution_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
:cumulative_quantity => 20000,
:side => :buy,
:time => "20120312 15:41:09",
:order_ref => 'Myref',
:ev_rule => 'aussieBond:YearsToExpiration=3',
:ev_multiplier => 0.5,
},

:human => "<Execution: 20120312 15:41:09 buy 20000 at 1.31075 on IDEALPRO, cumulative 20000 at 1.31075, ids 373/1695693619/0001f4e8.4f5d48f1.01.01>",
Expand Down Expand Up @@ -86,12 +89,14 @@
"id"=>nil,
"liquidation"=>true,
"local_id"=>373,
"order_ref"=>nil,
"order_ref"=>'Myref',
"ev_rule" => 'aussieBond:YearsToExpiration=3',
"ev_multiplier" => 0.5,
"perm_id"=>1695693619,
"price"=>1.31075,
"quantity"=>20000,
"time"=>"20120312 15:41:09",
"side"=>:buy, }.each do |key, value|
"side"=>:buy, }.each do |key, value|

subject.serializable_hash[key].should == value

Expand Down

0 comments on commit ea6e2d8

Please sign in to comment.