<commit_before>module IB
  ### Widely used TWS constants:

  EOL = "\0"

  FA_TYPES = {1 => "GROUPS", # FaMsgTypeName
              2 => "PROFILES",
              3 =>"ALIASES"}

  # Enumeration of bar size types for convenience.
  # Bar sizes less than 30 seconds do not work for some securities.
  BAR_SIZES = ['1 sec', '5 secs', '15 secs', '30 secs',
               '1 min', '2 mins', '3 mins', '5 mins',
               '15 mins', '30 mins', '1 hour', '1 day']

  # Enumeration of data types
  DATA_TYPES = [:trades, :midpoint, :bid, :ask]

  # Valid security types (sec_type attribute of IB::Contract)
  SECURITY_TYPES = {:stock => "STK",
                    :option => "OPT",
                    :future => "FUT",
                    :index => "IND",
                    :futures_option => "FOP",
                    :forex => "CASH",
                    :bag => "BAG"}

  # Tick types as received in TickPrice and TickSize messages (enumeration)
  TICK_TYPES = {
      # 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 => :asky_ield, #               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.
  }
end # module IB
<commit_msg>Add constants used in market depth messages.<commit_after>module IB
  ### Widely used TWS constants:

  EOL = "\0"

  FA_TYPES = {1 => "GROUPS", # FaMsgTypeName
              2 => "PROFILES",
              3 =>"ALIASES"}

  # Enumeration of bar size types for convenience.
  # Bar sizes less than 30 seconds do not work for some securities.
  BAR_SIZES = ['1 sec', '5 secs', '15 secs', '30 secs',
               '1 min', '2 mins', '3 mins', '5 mins',
               '15 mins', '30 mins', '1 hour', '1 day']

  # Enumeration of data types
  DATA_TYPES = [:trades, :midpoint, :bid, :ask]

  # Valid security types (sec_type attribute of IB::Contract)
  SECURITY_TYPES = {:stock => "STK",
                    :option => "OPT",
                    :future => "FUT",
                    :index => "IND",
                    :futures_option => "FOP",
                    :forex => "CASH",
                    :bag => "BAG"}

  # Tick types as received in TickPrice and TickSize messages (enumeration)
  TICK_TYPES = {
      # 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 => :asky_ield, #               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.
  }

  #
  # Market depth messages contain these "operation" codes to tell you
  # what to do with the data.
  #
  # See also http://www.interactivebrokers.com/php/apiUsersGuide/apiguide/java/updatemktdepth.htm
  #
  MARKET_DEPTH_OPERATIONS = {
    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
  }
end # module IB

{'fraction_non_alphanumeric': 0.11632341723874905, 'fraction_numerical': 0.03041571319603356, 'mean_word_length': 1.789627659574468, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 148, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5290896', 'n_tokens_mistral': 3366, 'n_tokens_neox': 3123, 'n_words': 902}