开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

what data subscription do I need to get real-time data via the TWS API?


 

Hi,

What kind of data subscription do I need to be able to access live market data through the TWS API in python? This is for US stock data such as QQQ or NVDA.


I've subscribed to the following data packages:

NASDAQ (Network C/UTP)(NP,L1)
NYSE (Network A/CTA) (NP,L1)
NYSE American, BATS, ARCA, IEX, and Regional Exchanges (Network B) (NP,L1)

But when I'm requesting live or close to live data via the python API, I'm not getting any data back, but I'm getting an error, for example:

ERROR Error 162, reqId 35: Historical Market Data Service error message:HMDS query returned no data: QQQ@SMART Trades, contract: Stock(symbol='QQQ', exchange='SMART', currency='USD')

I seem to be getting the live data in Trader Workstation. I spent over an hour reading up on your market data offerings, but I just can't figure out what I need to do.

Can you please share specifics?

Best regards,

?kos


 

Looks like you are trying to request historical data, not "live" data.
Use reqMktData to subscribe and tickPrice to receive streaming market data.
?
?


 

I'm requesting 'recent' market data in 1 minute trade bars, that is, from the past few minutes, as this is what my algorithm needs. and I'm getting this error message if the requested timeframe?is less than 15 minutes,?while beyond this timeframe I'm getting the trade bars requested. Would reqMktData give me desired results?


On Fri, Oct 18, 2024 at 11:58?AM bespalex via <besp.mail=[email protected]> wrote:
Looks like you are trying to request historical data, not "live" data.
Use reqMktData to subscribe and tickPrice to receive streaming market data.
?
?


 

开云体育

This historical data request works fine for me, returning five 1-minute bars to 20241017 15:59:00 US/Eastern (or to 20241018 05:50:00 if “Use RTH=0”):

?

Contract.Symbol=QQQ

Contract.Sectype=STK

Contract.Exchange=SMART

Contract.Currency=USD

Include expired=0

End date=20241018 05:50:19 US/Eastern

Bar Size=1 min

Duration=300 S

Use RTH=1

What to show=TRADES

Date format=1

KeepUpToDate=0

Options=

?

If you use reqMktData, you have to build the bars yourself from the tick data stream. This is more work. If you only need completed bars, and the delay in retrieving the historical data is acceptable, then the historical data should be fine (and will actually be more accurate, since the realtime data doesn’t include all price ticks, so occasionally bar highs and lows may be a tick or two out for bars constructed from the tick stream).

?

Richard

?

?

From: [email protected] <[email protected]> On Behalf Of ?kos Maróy
Sent: 18 October 2024 11:32
To: [email protected]
Subject: Re: [TWS API] what data subscription do I need to get real-time data via the TWS API?

?

I'm requesting 'recent' market data in 1 minute trade bars, that is, from the past few minutes, as this is what my algorithm needs. and I'm getting this error message if the requested timeframe?is less than 15 minutes,?while beyond this timeframe I'm getting the trade bars requested. Would reqMktData give me desired results?

?

On Fri, Oct 18, 2024 at 11:58?AM bespalex via <besp.mail=[email protected]> wrote:

Looks like you are trying to request historical data, not "live" data.

Use reqMktData to subscribe and tickPrice to receive streaming market data.

?

?