{"id":1170,"date":"2015-09-29T10:40:51","date_gmt":"2015-09-29T15:40:51","guid":{"rendered":"http:\/\/www.amibroker.com\/kb\/?p=1170"},"modified":"2015-09-30T10:45:02","modified_gmt":"2015-09-30T15:45:02","slug":"invalid-symbol-message-for-us-stocks-traded-on-multiple-exchanges-interactive-brokers","status":"publish","type":"post","link":"https:\/\/www.amibroker.com\/wordpress\/kb\/2015\/09\/29\/invalid-symbol-message-for-us-stocks-traded-on-multiple-exchanges-interactive-brokers\/","title":{"rendered":"“Invalid symbol” message for stocks traded on multiple exchanges (IB)"},"content":{"rendered":"

Some of the symbols available from Interactive Brokers data-feed may be traded on multiple exchanges. In such case, when we enter the symbol to the database as:<\/p>

\rINTC\rGLD\rCSCO\r<\/pre>

then we may see “Invalid symbol” message displayed by the Interactive Brokers plugin, as symbol SMART-STK-USD default format is not enough to uniquely identify the symbol. Therefore we would need to specify the primary exchange for the given symbol. <\/p>

The primary exchange can be specified in the symbol using -!EXCHANGE suffix, so we can write the symbol like this<\/p>

\rINTC-!NASDAQ\r<\/pre>

and it will instruct Interactive Brokers plugin to send NASDAQ as Primary Exchange for INTC to TWS.<\/p>

We can however maintain similar ticker naming for all symbols in our database and use short names for all US symbols. To make it possible there is special dictionary (or translation table) for IB symbols that both plugin and IB automated trading interface use. In AmiBroker main folder there is a IBDictionary.txt file, which we can edit with any plain text editor (like Notepad) and provide symbol translations. It describes how symbols are translated before plugin communicates with TWS API.<\/p>

The format of this file is CSV (comma separated values):<\/p>

\rInputSymbol,OutputSymbol, comment (optional)\r<\/pre>

For example:<\/p>

\rINTC,INTC-!NASDAQ, This is because INTC is now traded on multiple exchanges, so we need to set primary exchange\rCSCO,CSCO-!NASDAQ, The same as above \rMSFT,MSFT-!NASDAQ\rGLD,GLD-!ARCA\r<\/pre>","protected":false},"excerpt":{"rendered":"

Some of the symbols available from Interactive Brokers data-feed may be traded on multiple exchanges. In such case, when we enter the symbol to the database as: INTC GLD CSCO then we may see “Invalid symbol” message displayed by the Interactive Brokers plugin, as symbol SMART-STK-USD default format is not enough to uniquely identify the […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5,25],"tags":[54,60],"_links":{"self":[{"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/posts\/1170"}],"collection":[{"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/comments?post=1170"}],"version-history":[{"count":2,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/posts\/1170\/revisions"}],"predecessor-version":[{"id":1174,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/posts\/1170\/revisions\/1174"}],"wp:attachment":[{"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/media?parent=1170"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/categories?post=1170"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/tags?post=1170"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}