Module: IB::Messages::Incoming
- Extended by:
- IB::Messages
- Defined in:
- lib/ib/messages/incoming.rb,
lib/ib/messages/incoming/alert.rb,
lib/ib/messages/incoming/ticks.rb,
lib/ib/messages/incoming/open_order.rb,
lib/ib/messages/incoming/order_status.rb,
lib/ib/messages/incoming/scanner_data.rb,
lib/ib/messages/incoming/account_value.rb,
lib/ib/messages/incoming/contract_data.rb,
lib/ib/messages/incoming/market_depths.rb,
lib/ib/messages/incoming/next_valid_id.rb,
lib/ib/messages/incoming/real_time_bar.rb,
lib/ib/messages/incoming/execution_data.rb,
lib/ib/messages/incoming/historical_data.rb,
lib/ib/messages/incoming/portfolio_value.rb,
lib/ib/messages/incoming/abstract_message.rb,
lib/ib/messages/incoming/delta_neutral_validation.rb
Overview
Incoming IB messages (received from TWS/Gateway)
Defined Under Namespace
Modules: ContractAccessors Classes: AbstractMessage, AbstractTick, AccountMessage, Alert, ContractData, ContractMessage, DeltaNeutralValidation, ExecutionData, HistogramData, HistoricalData, HistoricalDataUpdate, ManagedAccounts, MarketDepth, NextValidId, OpenOrder, OptionChainDefinition, OrderStatus, PortfolioValue, RealTimeBar, ReceiveFA, ScannerData, ScannerParameters, TickByTick, TickOption, TickPrice
Constant Summary collapse
- NewsBulletins =
14, [:request_id, :int], # unique incrementing bulletin ID. [:type, :int], # Type of bulletin. Valid values include: # 1 = Regular news bulletin # 2 = Exchange no longer available for trading # 3 = Exchange is available for trading [:text, :string], # The bulletin's message text. [:exchange, :string]
- CurrentTime =
Receives the current system time on the server side.
49, [:time, :int]
- HeadTimeStamp =
( [88, 0], [:request_id, :int], [:date, :int_date] ) do # def to_human "<#{self.}:" + "Request #{request_id}, First Historical Datapoint @ #{date.to_s}«" end
- FundamentalData =
Receive Reuters global fundamental market data. There must be a subscription to Reuters Fundamental set up in Account Management before you can receive this data.
51, [:request_id, :int], [:xml, :xml]
- ContractDataEnd =
52, [:request_id, :int]
- OpenOrderEnd =
53
- AccountDownloadEnd =
54, [:account_name, :string]
- ExecutionDataEnd =
55, [:request_id, :int]
- MarketDataType =
58, [:request_id, :int], [:market_data_type, :int] do "<#{self.}:" + " switched to »#{MARKET_DATA_TYPES[market_data_type]}«" # to_human end
- CommissionReport =
59, [:exec_id, :string], [:commission, :decimal], # Commission amount. [:currency, :string], # Commission currency [:realized_pnl, :decimal_max], [:yield, :decimal_max], [:yield_redemption_date, :int]
- SecurityDefinitionOptionParameter =
OptionChainDefinition = [75,0] , [:request_id, :int], [:exchange, :string], [:con_id, :int], # underlying_con_id [:trading_class, :string], [:multiplier, :int]
- OptionChainDefinitionEnd =
SecurityDefinitionOptionParameterEnd = [76,0 ], [ :request_id, :int ]
- MarketDepthExchanges =
<- 1-9-789–USD-CASH—–IDEALPRO–CAD—— -> —81-123-5.0E-5–0-
[80,0], [ :request_id, :int ]
- TickRequestParameters =
[81, 0], [ :ticker_id, :int ], [ :min_tick, :decimal], [ :exchange, :string ], [ :snapshot_permissions, :int ]
- TickSize =
[2, 6], AbstractTick, [:ticker_id, :int], [:tick_type, :int], [:size, :int]
- TickGeneric =
[45, 6], AbstractTick, [:ticker_id, :int], [:tick_type, :int], [:value, :float]
- TickString =
[46, 6], AbstractTick, [:ticker_id, :int], [:tick_type, :int], [:value, :string]
- TickEFP =
[47, 6], AbstractTick, [:ticker_id, :int], [:tick_type, :int], [:basis_points, :decimal], [:formatted_basis_points, :string], [:implied_futures_price, :decimal], [:hold_days, :int], [:dividend_impact, :decimal], [:dividends_to_expiry, :decimal]
- TickOptionComputation =
This message is received when the market in an option or its underlier moves. TWS option model volatilities, prices, and deltas, along with the present value of dividends expected on that options underlier are received. TickOption message contains following @data:
:ticker_id - Id that was specified previously in the call to reqMktData() :tick_type - Specifies the type of option computation (see TICK_TYPES). :implied_volatility - The implied volatility calculated by the TWS option modeler, using the specified :tick_type value. :delta - The option delta value. :option_price - The option price. :pv_dividend - The present value of dividends expected on the options underlier :gamma - The option gamma value. :vega - The option vega value. :theta - The option theta value. :under_price - The price of the underlying.
TickOption = ([21, 6], AbstractTick, [:ticker_id, :int], [:tick_type, :int], # What is the "not yet computed" indicator: [:implied_volatility, :decimal_limit_1], # -1 and below [:delta, :decimal_limit_2], # -2 and below [:option_price, :decimal_limit_1], # -1 -"- [:pv_dividend, :decimal_limit_1], # -1 -"- [:gamma, :decimal_limit_2], # -2 -"- [:vega, :decimal_limit_2], # -2 -"- [:theta, :decimal_limit_2], # -2 -"- [:under_price, :decimal_limit_1]) do "<TickOption #{type} " + "option @ #{"%8.3f" % (option_price || -1)}, IV: #{"%4.3f" % (implied_volatility || -1)}, " + "delta: #{"%5.3f" % (delta || -1)}, " + "gamma: #{"%6.4f" % (gamma || -1)}, vega: #{ "%6.5f" % (vega || -1)}, " + "theta: #{"%7.6f" % (theta || -1)}, pv_dividend: #{"%5.3f" % (pv_dividend || -1)}, " + "underlying @ #{"% 8.3f" % (under_price || -1)} >" end
- TickSnapshotEnd =
57, [:ticker_id, :int]
- AccountUpdateTime =
8, [:time_stamp, :string]
- AccountSummary =
(63, AccountMessage, [:request_id, :int], [ :account, :string ], [:account_value, :key, :symbol], [:account_value, :value, :string], [:account_value, :currency, :string] )
- AccountSummaryEnd =
(64)
- AccountValue =
([6, 2], AccountMessage, [:account_value, :key, :symbol], [:account_value, :value, :string], [:account_value, :currency, :string], [:account, :string])
- AccountUpdatesMulti =
( 73, [ :request_id, :int ], [ :account , :string ], [ :model, :string ], [ :key , :string ], [ :value , :decimal], [ :currency, :string ])
- AccountUpdatesMultiEnd =
74
- ContractDetails =
ContractData = ([10, [6, 8]], [:request_id, :int], ## request id [:contract, :symbol, :string], ## next the major contract-fields [:contract, :sec_type, :string], ## are transmitted [:contract, :last_trading_day, :date], ## difference to the array.get_contract [:contract, :strike, :decimal], ## method: con_id is transmitted [:contract, :right, :string], ## AFTER the main fields [:contract, :exchange, :string], ## [:contract, :currency, :string], ## thus we have to read the fields separately [:contract, :local_symbol, :string], [:contract_detail, :market_name, :string], ## extended [:contract, :trading_class, :string], ## new Version 8 [:contract, :con_id, :int], [:contract_detail, :min_tick, :decimal], [:contract_detail, :md_size_multiplier, :int], [:contract, :multiplier, :int], [:contract_detail, :order_types, :string], [:contract_detail, :valid_exchanges, :string], [:contract_detail, :price_magnifier, :int], [:contract_detail, :under_con_id, :int], [:contract_detail, :long_name, :string], [:contract, :primary_exchange, :string], [:contract_detail, :contract_month, :string], [:contract_detail, :industry, :string], [:contract_detail, :category, :string], [:contract_detail, :subcategory, :string], [:contract_detail, :time_zone, :string], [:contract_detail, :trading_hours, :string], [:contract_detail, :liquid_hours, :string], [:contract_detail, :ev_rule, :decimal], [:contract_detail, :ev_multipler, :string], [:contract_detail, :sec_id_list,:hash], [:contract_detail, :agg_group, :int ], [:contract_detail, :under_symbol, :string ], [:contract_detail, :under_sec_type, :string ], [:contract_detail, :market_rule_ids, :string ], [:contract_detail, :real_expiration_date, :date ] )
- BondContractData =
ContractData
[18, [4, 6]], ContractData, [:request_id, :int], [:contract, :symbol, :string], [:contract, :sec_type, :string], [:contract_detail, :cusip, :string], [:contract_detail, :coupon, :decimal], [:contract_detail, :maturity, :string], [:contract_detail, :issue_date, :string], [:contract_detail, :ratings, :string], [:contract_detail, :bond_type, :string], [:contract_detail, :coupon_type, :string], [:contract_detail, :convertible, :boolean], [:contract_detail, :callable, :boolean], [:contract_detail, :puttable, :boolean], [:contract_detail, :desc_append, :string], [:contract, :exchange, :string], [:contract, :currency, :string], [:contract_detail, :market_name, :string], # extended [:contract_detail, :trading_class, :string], [:contract, :con_id, :int], [:contract_detail, :min_tick, :decimal], [:contract_detail, :order_types, :string], [:contract_detail, :valid_exchanges, :string], [:contract_detail, :valid_next_option_date, :string], [:contract_detail, :valid_next_option_type, :string], [:contract_detail, :valid_next_option_partial, :string], [:contract_detail, :notes, :string], [:contract_detail, :long_name, :string], [:contract_detail, :ev_rule, :decimal], [:contract_detail, :ev_multipler, :string], [:sec_id_list_count, :int]
- MarketDepthL2 =
13, MarketDepth, # Fields descriptions - see above [:request_id, :int], [:position, :int], [:market_maker, :string], # The exchange hosting this order. [:operation, :int], [:side, :int], [:price, :decimal], [:size, :int]
- NextValidID =
This message is always sent by TWS automatically at connect. The IB::Connection class subscribes to it automatically and stores the order id in its @next_local_id attribute.
NextValidId = (9, [:local_id, :int])
- PositionData =
( [61,3] , ContractMessage, [:account, :string], [:contract, :contract], # read standard-contract # [ con_id, symbol,. sec_type, expiry, strike, right, multiplier, # primary_exchange, currency, local_symbol, trading_class ] [:position, :decimal], # changed from int after Server Vers. MIN_SERVER_VER_FRACTIONAL_POSITIONS [:price, :decimal] ) do # def to_human "<PositionValue: #{account} -> #{contract.to_human} ( Amount #{position}) : Market-Price #{price} >" end
- PositionDataEnd =
( 62 )
- PositionsMulti =
( 71, ContractMessage, [ :request_id, :int ], [ :account, :string ], [:contract, :contract], # read standard-contract [ :position, :decimal], # changed from int after Server Vers. MIN_SERVER_VER_FRACTIONAL_POSITIONS [ :average_cost, :decimal], [ :model_code, :string ])
- PositionsMultiEnd =
72
- Classes =
Container for specific message classes, keyed by their message_ids
{}
Constants included from IB::Messages
CLIENT_VERSION, SERVER_VERSION