开云体育

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

C++ TWS API reqMktDepth() giving 309 error


 

Hi,
?
I have had the same setup for streaming the level 2 market depth for a long time now. Yesterday, I started receiving this error "[20240905-12:58:19] Error [Id, Code, Msg]: 1001 : 309 -> Max number (3) of market depth requests has been reached".
?
My code makes the stream request right before entering my main trading logic loop, and it only makes it once, so I am confused as to why this is happening now.
?
The contract I am trying to stream is a future w/ these details:
TICKER -> "NQ"
EXP_MONTH -> "202412"
LOCAL_SYMBOL -> "NQZ4"
EXCHANGE = "CME"
CURRENCY = "USD"
?
Any help would be appreciated, especially if a change has been made to the API without my knowledge.
?
Here is the line where I am making the request, m_sPtrIbc is a smart pointer that represents the client I built out. ReqMarketDepth() is simply a one liner -> m_pClient->reqMktDepth()...
//launch streaming of orderbook depth...
m_reqMktDepthId += 1;
m_sPtrIbc->ReqMarketDepth(m_reqMktDepthId, m_contract, 5, false, TagValueListSPtr());


 

Anyone else experiencing this? Same error code / thing happening in a python dummy script I put together as well for reqMktDepth() w/ ib_insync() api. My subscriptions all seem to be in tact too...


 

No problem here. Just tried NQZ4 as the third subscription through a paper account that already had two active reqMktDepth subscriptions for other instruments. Worked as expected.

Any chance you are indeed requesting market depth subscriptions for more than three different instruments simultaneously? Keep in mind that TWS L2 tools count against the three subscription limit, in case you use those.

闯ü谤驳别苍

?
?
On Tue, Sep 10, 2024 at 08:16 AM, Brendan Lydon wrote:

Anyone else experiencing this? Same error code / thing happening in a python dummy script I put together as well for reqMktDepth() w/ ib_insync() api. My subscriptions all seem to be in tact too...


 

Suppose I have windows open in my TWS platform requesting market depth. Would that count against the limit? That seems to be the only thing I can think of as I am 99% sure I am requesting only once in these projects and nothing else is running against TWS in my task manager.
?
Thanks,
Brendan


 

Ya that has to be it. I just ran it in my simulated account and it works no problem getting market depth.
?
Brendan


 

And I have no other contracts being requested in TWS.