Keyboard Shortcuts
Likes
Search
How to get market data, specifying exchange=NASDAQ, when ssh to a server that the TWS application is running on
If I run TWS app and TWA API from my local machine, I could request market data when setting exchange=NASDAQ? But when I ssh to a server where the TWS application is running, I get the error "200 No security definition has been found for the request". This happen if I?set exchange=NASDAQ and it is fixed if I set exchange=SMART.? |
I agree with @misantroop. I can't imagine anything reasons related to SSH or telco. However I idea popup in my mind: |
¿ªÔÆÌåÓýAs far as I¡¯m aware ¡°NASDAQ¡± doesn¡¯t appear in the list of valid exchanges in the contactDetails() callback for any security. The list for MSFT is typical: ? validExchanges = SMART,AMEX,NYSE,CBOE,PHLX,ISE,CHX,ARCA,ISLAND,DRCTEDGE,BEX,BATS,EDGEA,JEFFALGO,BYX,IEX, EDGX,FOXRIVER,PEARL,NYSENAT,LTSE,MEMX,TPLUS1,IBEOS,OVERNIGHT,PSX ? Market data requests must specify an item in this list. ? However ¡°NASDAQ¡± does appear as the primaryExchange attribute (whereas for IBM the primaryExchange is listed as ¡°NYSE¡±). ? Primary exchange has always been a very unclear concept in the API and isn¡¯t really defined properly anywhere. Originally there was a statement somewhere that its purpose was to disambiguate the meaning of ¡°SMART¡± ¨C because there are separate SMART routing infrastructures in different regions, eg US, Canada, EU, LSE. So if nothing else indicated which SMART routing infrastructure was to be used for an undirected order, primaryExchange would do it. Normally currency would do the job, but not in every case, though I don¡¯t remember any specific examples. This is all still true, but it may be that primaryExchange has some additional use now that I¡¯m not aware of. ? So primaryExchange is hardly ever necessary, but in my platform I always use the primaryExchange returned in the contractDetails(). ? |
What caught my attention were: |
¿ªÔÆÌåÓýSo where is this ¡°Compatibility Mode: Send ISLAND for US Stocks trading on NASDAQ" setting? I can¡¯t find it anywhere (on 10.19 or 10.25). ? From: [email protected] <[email protected]> On Behalf Of Gordon Eldest via groups.io
Sent: Tuesday, November 14, 2023 9:33 PM To: [email protected] Subject: Re: [TWS API] How to get market data, specifying exchange=NASDAQ, when ssh to a server that the TWS application is running on ? What caught my attention were: |
I don't know. Not seen on TWS. |
As I understand, primary exchange is the native exchange for the instrument, regardless where it could be trading. IBM is trading in USD on LSE, so a contract request for (symbol: IBM, currency: USD) would be ambiguous. IBM/SMART would cause even more issues as there are many IBMs listed. The only way to get NYSE listed IBM without fail is to specify NYSE as primaryExchange.
One silly foolproof option is to keep a static list of primaryExchanges, so every rejection for ambiguity will be retried with the next primaryExchange in the list until a match is made. Alternative for US equity markets is to use the ftp.nasdaqtrader.com symbol files and make a query there. |
On Wed, Nov 15, 2023 at 06:29 AM, <dungtran0127@...> wrote:
Be careful that one day IB may ask you to switch to NASDAQ instead of ISLAND (I guess your good for 1 or 2 years) Also: SMART is Ok to fetch market data unless you look for very specific exchange volumes (as opposed to prices which seems nearly always same across exchanges when looking historical) BUT if you use SMART for placeOrder that is a different story, as SMART allow variation on the theme (preference to speed/preference to lower commission/better price/ etc...) see TWS->File->Global Configuration->Orders->Smart Routing . In general SMART default is the safest choice, especially for low liquidity instrument. Just be aware of what is SMART doing. |
On Wed, Nov 15, 2023 at 04:54 AM, misantroop wrote:
As I understand, primary exchange is the native exchange for the instrument, regardless where it could be trading. IBM is trading in USD on LSE, so a contract request for (symbol: IBM, currency: USD) would be ambiguous. IBM/SMART would cause even more issues as there are many IBMs listed. The only way to get NYSE listed IBM without fail is to specify NYSE as primaryExchange. Very Good point, I hit that one too. |