Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to specify an instrument's Exchange in the API's Command function?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to specify an instrument's Exchange in the API's Command function?

    Certain instruments have the same symbol name on different exchanges. It appears that IB requires the Exchange and maybe even the Primary Exchange to be specified when trading these instruments, otherwise it returns an error saying it is basically too ambiguous.

    When using the API "Command" function, how can the instrument's Exchange be specified?

    From https://ninjatrader.com/support/help...functions.htm:
    int Command(string command, string account, string instrument, string action, int quantity, string o rderType, double limitPrice, double stopPrice,
    string timeInForce, string oco, string orderId, s tring strategy, string strategyId)

    Can the exchange be specified as a prefix to the "instrument" parameter? Ex: NASDAQ.Open or NASDAQ:Open or NASDAQ/Open
    ("Open", the symbol for Opendoor Technologies Inc, is a problematic for IB through NT not because it is on different exchanges but because it collides with a reserved keyword.)
    (I haven't tried the prefixes shown above to see if any will work because I wanted to get a complete definitive answer to the question.)

    Here is the only relevant info I could find at IB [https://interactivebrokers.github.io...ontracts.html] :
    Stocks
    • Contract contract = new Contract();
      contract.Symbol = "IBKR";
      contract.SecType = "STK";
      contract.Currency = "USD";
      //In the API side, NASDAQ is always defined as ISLAND in the exchange field
      contract.Exchange = "ISLAND";
    For certain smart-routed stock contracts that have the same symbol, currency and exchange, you would also need to specify the primary exchange attribute to uniquely define the contract. This should be defined as the native exchange of a contract, and is good practice to include for all stocks:
    • Contract contract = new Contract();
      contract.Symbol = "MSFT";
      contract.SecType = "STK";
      contract.Currency = "USD";
      contract.Exchange = "SMART";
      //Specify the Primary Exchange attribute to avoid contract ambiguity
      // (there is an ambiguity because there is also a MSFT contract with primary exchange = "AEB")
      contract.PrimaryExch = "ISLAND";
    For the purpose of requesting market data, the routing exchange and primary exchange can be specified in a single 'exchange' field if they are separated by a valid component exchange separator, for instance exchange = "SMART:ARCA". The default separators available are colon ":" and slash "/".

    #2
    Hello N4Apound,

    Thank you for your message.


    Unfortunately, the exchange cannot be customized from within NinjaTrader. The software will use the same exchange for all orders on an instrument and its data based on the Instrument's Settings in the Tools > Instruments window. This information is set automatically by the server.

    Please let me know if you have any additional questions.
    Justin D.NinjaTrader Customer Service

    Comment


      #3
      Thanks for your reply.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by GussJ, 03-04-2020, 03:11 PM
      15 responses
      3,271 views
      0 likes
      Last Post xiinteractive  
      Started by Tim-c, Today, 02:10 PM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by Taddypole, Today, 02:47 PM
      0 responses
      2 views
      0 likes
      Last Post Taddypole  
      Started by chbruno, 04-24-2024, 04:10 PM
      4 responses
      51 views
      0 likes
      Last Post chbruno
      by chbruno
       
      Started by TraderG23, 12-08-2023, 07:56 AM
      10 responses
      403 views
      1 like
      Last Post beobast
      by beobast
       
      Working...
      X