Module: IB

Defined in:
lib/ib-ruby/symbols/forex.rb,
lib/ib-ruby.rb,
lib/ib-ruby/errors.rb,
lib/ib-ruby/models.rb,
lib/ib-ruby/socket.rb,
lib/ib-ruby/symbols.rb,
lib/ib-ruby/version.rb,
lib/ib-ruby/messages.rb,
lib/ib-ruby/constants.rb,
lib/ib-ruby/connection.rb,
lib/ib-ruby/models/bar.rb,
lib/ib-ruby/models/model.rb,
lib/ib-ruby/symbols/stocks.rb,
lib/ib-ruby/models/contract.rb,
lib/ib-ruby/symbols/futures.rb,
lib/ib-ruby/symbols/options.rb,
lib/ib-ruby/models/combo_leg.rb,
lib/ib-ruby/models/execution.rb,
lib/ib-ruby/models/contract/option.rb,
lib/ib-ruby/models/model_properties.rb,
lib/ib-ruby/messages/abstract_message.rb,
lib/ib-ruby/messages/incoming/open_order.rb

Overview

OpenOrder is the longest message with complex processing logics, it is isolated here

Defined Under Namespace

Modules: Messages, Models, Symbols Classes: ArgumentError, Connection, Error, IBSocket, LoadError

Constant Summary collapse

Datatypes =

Legacy alias

Models
VERSION_FILE =

:nodoc:

Pathname.new(__FILE__).dirname + '../../VERSION'
VERSION =
VERSION_FILE.exist? ? VERSION_FILE.read.strip : nil
IncomingMessages =

Legacy alias

Messages::Incoming
OutgoingMessages =

Legacy alias

Messages::Outgoing
EOL =

Widely used TWS constants:

"\0"
BAR_SIZES =

Enumeration of bar size types for convenience. Bar sizes less than 30 seconds do not work for some securities.

{:sec1 => '1 sec',
:sec5 => '5 secs',
:sec15 => '15 secs',
:sec30 => '30 secs',
:min1 => '1 min',
:min2 => '2 mins',
:min3 => '3 mins',
:min5 => '5 mins',
:min15 => '15 mins',
:min30 => '30 mins',
:hour1 => '1 hour',
:day1 => '1 day'}
DATA_TYPES =

Enumeration of data types. Determines the nature of data being extracted. Valid values:

{:trades => 'TRADES',
              :midpoint => 'MIDPOINT',
              :bid => 'BID',
              :ask => 'ASK',
              :bid_ask => 'BID_ASK',
              :historical_volatility => 'HISTORICAL_VOLATILITY',
              :option_implied_volatility => 'OPTION_IMPLIED_VOLATILITY',
              :option_volume => 'OPTION_VOLUME',
              :option_open_interest => 'OPTION_OPEN_INTEREST',
}
SECURITY_TYPES =

Valid security types (sec_type attribute of IB::Contract)

{:stock => "STK",
:option => "OPT",
:future => "FUT",
:index => "IND",
:futures_option => "FOP",
:forex => "CASH",
:bond => "BOND",
:bag => "BAG"}
TICK_TYPES =

Tick types as received in TickPrice and TickSize messages (enumeration)

{
    # int id => :Description #  Corresponding API Event/Function/Method
    0 => :bid_size, #               tickSize()
    1 => :bid_price, #              tickPrice()
    2 => :ask_price, #              tickPrice()
    3 => :ask_size, #               tickSize()
    4 => :last_price, #             tickPrice()
    5 => :last_size, #              tickSize()
    6 => :high, #                   tickPrice()
    7 => :low, #                    tickPrice()
    8 => :volume, #                 tickSize()
    9 => :close_price, #            tickPrice()
    10 => :bid_option, #            tickOptionComputation() See Note 1 below
    11 => :ask_option, #            tickOptionComputation() See => :Note 1 below
    12 => :last_option, #           tickOptionComputation()  See Note 1 below
    13 => :model_option, #          tickOptionComputation() See Note 1 below
    14 => :open_tick, #             tickPrice()
    15 => :low_13_week, #           tickPrice()
    16 => :high_13_week, #          tickPrice()
    17 => :low_26_week, #           tickPrice()
    18 => :high_26_week, #          tickPrice()
    19 => :low_52_week, #           tickPrice()
    20 => :high_52_week, #          tickPrice()
    21 => :avg_volume, #            tickSize()
    22 => :open_interest, #         tickSize()
    23 => :option_historical_vol, # tickGeneric()
    24 => :option_implied_vol, #    tickGeneric()
    25 => :option_bid_exch, #   not USED
    26 => :option_ask_exch, #   not USED
    27 => :option_call_open_interest, # tickSize()
    28 => :option_put_open_interest, #  tickSize()
    29 => :option_call_volume, #        tickSize()
    30 => :option_put_volume, #         tickSize()
    31 => :index_future_premium, #      tickGeneric()
    32 => :bid_exch, #                  tickString()
    33 => :ask_exch, #                  tickString()
    34 => :auction_volume, #    not USED
    35 => :auction_price, #     not USED
    36 => :auction_imbalance, # not USED
    37 => :mark_price, #              tickPrice()
    38 => :bid_efp_computation, #     tickEFP()
    39 => :ask_efp_computation, #     tickEFP()
    40 => :last_efp_computation, #    tickEFP()
    41 => :open_efp_computation, #    tickEFP()
    42 => :high_efp_computation, #    tickEFP()
    43 => :low_efp_computation, #     tickEFP()
    44 => :close_efp_computation, #   tickEFP()
    45 => :last_timestamp, #          tickString()
    46 => :shortable, #               tickGeneric()
    47 => :fundamental_ratios, #      tickString()
    48 => :rt_volume, #               tickGeneric()
    49 => :halted, #           see Note 2 below.
    50 => :bid_yield, #               tickPrice() See Note 3 below
    51 => :ask_yield, #               tickPrice() See Note 3 below
    52 => :last_yield, #              tickPrice() See Note 3 below
    53 => :cust_option_computation, # tickOptionComputation()
    54 => :trade_count, #             tickGeneric()
    55 => :trade_rate, #              tickGeneric()
    56 => :volume_rate, #             tickGeneric()
    57 => :last_rth_trade, #            ?
    #   Note 1: Tick types BID_OPTION, ASK_OPTION, LAST_OPTION, and MODEL_OPTION return
    #           all Greeks (delta, gamma, vega, theta), the underlying price and the
    #           stock and option reference price when requested.
    #           MODEL_OPTION also returns model implied volatility.
    #   Note 2: When trading is halted for a contract, TWS receives a special tick:
    #           haltedLast=1. When trading is resumed, TWS receives haltedLast=0.
    #           A tick type, HALTED, tick ID= 49, is now available in regular market
    #           data via the API to indicate this halted state. Possible values for
    #           this new tick type are: 0 = Not halted, 1 = Halted.
    #   Note 3: Applies to bond contracts only.
}
FA_TYPES =

Financial Advisor types (FaMsgTypeName)

{1 => 'GROUPS',
2 => 'PROFILES',
3 =>'ALIASES'}
MARKET_DEPTH_OPERATIONS =

Market depth messages contain these “operation” codes to tell you what to do with the data. See also www.interactivebrokers.com/php/apiUsersGuide/apiguide/java/updatemktdepth.htm

{
    0 => :insert, # New order, insert into the row identified by :position
    1 => :update, # Update the existing order at the row identified by :position
    2 => :delete # Delete the existing order at the row identified by :position
}
MARKET_DEPTH_SIDES =
{
    0 => :ask,
    1 => :bid
}