Reference TWS Symbol not Underlying (symbol)

One possible solution is to use IBDictionary.txt to translate APTD to MCGN-LSE-STK-GBP
http://www.amibroker.com/devlog/2013/12/06/interactive-brokers-plugin-2-0-7/

IBDictionary.txt text file descriobes how symbols are translated before plugin talks to TWS API. It allows to use shorter name for symbols and addresses situations when IB starts trading given symbol on
multiple exchanges and SMART-STK-USD default becomes not enough to uniquely specify US symbol.
The format of this file is CSV (comma separated values): InputSymbol,OutputSymbol, comment (optional)

For example:
INTC,INTC-!NASDAQ

As to what is IBController and plugin doing with the symbol, it works as follows:

SYMBOL-EXCHANGE-TYPE-CURRENCY
or
SYMBOL-EXCHANGE!PRIMARYEXCHANGE-TYPE-CURRENCY

  • if security type (TYPE) is STK then contract.Symbol is set to SYMBOL and contract.localSymbol is empty
  • if security type (TYPE) is NOT STK then contract.Symbol is empty and contract.localSymbol is set to SYMBOL

Then contract.PrimaryExchange is set to PRIMARYEXCHANGE (if defined) or empty if not defined.

This is the only way found by experimentation to force IB API to work with stocks and all other security types, without need to specify TWO different symbols at once (which is absurd IMHO).

2 Likes