¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

TWS API | Options market data request issue.


 

Hello!?
I'm trying?to request option chain and subscribe market data, to get prices for options on a given STK contract.

I do
client().reqMarketDataType(DELAYED);
client().reqContractDetails(requestId, stkOptionContract);
at this moment I have a number of Put\Call contracts,?
then I try?
client().reqMktData(nextReqId(), optionContract, "", false, false, null);
for each option contract.?

Aaand after that I keep getting this message?| 10197 | No market data during competing live session,
In very rare cases I could get data, but mostly errors and nothing (like 95% of requests failed).
I don't have any other device with TWS, or accounts. Only one I?logged in from this computer.
I'm using a paper account for development, and I don't have any subscriptions to IB, could that be a problem?

Still STK market data arrives as it should for any number of requests.?

Thanks!


 

Worth mentioning, you should register a trial account.
In demo account without registration (I think it's called demo_tws user)
API team said it [having 10197 error] is possible.


 

Probably problem fixed in 981th version,
try to use TWS latest of IB Gateway latest version.


LS
 

Thanks for your reply.?
I tried as you suggested, still nothing.

Now I downloaded IBGateway and tried it as well, still same error.?
In the log tab I could see another weird?message:?
"Model is not valid: Active:true TSLA/20201127/490.0/Call TOP/PACED....."?
that kept repeating.

What could be the problem?

image.png
image.png

Contracts to request market data are looking like this:


image.png

§á§ä, 20 §ß§à§ñ§Ò. 2020 §Ô. §Ó 17:24, Mikhail Ershov <misha-ershov@...>:

Probably problem fixed in 981th version,
try to use TWS latest of IB Gateway latest version.


LS
 

here is the log for stable version, no "model is not valid" error, but still "competing?live session" error

image.png

§ã§Ò, 21 §ß§à§ñ§Ò. 2020 §Ô. §Ó 14:57, LS <justgreey@...>:

Thanks for your reply.?
I tried as you suggested, still nothing.

Now I downloaded IBGateway and tried it as well, still same error.?
In the log tab I could see another weird?message:?
"Model is not valid: Active:true TSLA/20201127/490.0/Call TOP/PACED....."?
that kept repeating.

What could be the problem?

image.png
image.png

Contracts to request market data are looking like this:


image.png

§á§ä, 20 §ß§à§ñ§Ò. 2020 §Ô. §Ó 17:24, Mikhail Ershov <misha-ershov@...>:
Probably problem fixed in 981th version,
try to use TWS latest of IB Gateway latest version.


 

On Friday I've seen the same,
trial account have 10197 error sometimes on latest (now 981.2d) version.

Hope API team give some advices what to do,
I'll update here.


 

Seeing the same error when requesting option prices with the following steps:

1. Connect to TWS with a paper account on port 7497
2.?app.reqMarketDataType(4)
3.?app.reqMktData(1, contract, "", False, False, [])
4. receive data as expected
5. disconnect
6. reconnect to the same account by rerunning the same python script
7. repeat 2. and 3. above
8. receive error "10197? ?No market data during competing live session"

The same python script works without issues when requesting stock prices as opposed to option prices.

Is this a known issue with option prices from paper accounts?
Are there different recommendations to ensure proper disconnect/reconnect cycles?

Thanks


 

How much time do you have to wait to get back again good data ?

?

I will hypothesis that this is not related to connection issue but to some delay that IB introduce to pace down subscriptions.

Some of them are "not within 15 sec" some others are even "10 minutes" base. (never saw anything longer than 10 min)
Like 15 sec for tick

And the problem is that I guess that when ungracefully closed, TWS doesn't reset some counters (or thing alike)

so that restarting it does help (sometime, not enough case found to decide that there is a true correlation)

?

Try getting an idea of how long you have to wait to cure that

Try restarting TWS (or Gateway) and see

?

Also be careful that TWS itself is accounted in the limitations. So depending upon what you do on TWS you may of may not encounter oddities.

Gateway is safer for sake of hecking repeatability of error. But also restart it when you see such thing and check log


 

IB support suggests checking
that I don't run several user sessions on one computer
and don't fall under these cases??


 

On Fri, Dec 11, 2020 at 05:41 PM, rtx wrote:
Are there different recommendations to ensure proper disconnect/reconnect cycles?
Your message contains an 8 step overview. I would like to emphasize that step #5 must contain two activities:
5a. cancel market data subscription for the tickerID: cancelMktData(1)
5b. disconnect socket connection: eDisconnect()
Unsubscribing from all that you were subscribed to before closing the connection is necessary to ensure that IB's servers understand your intentions, and that the used tickerID values are released and can be re-used.

Having said that, I sometimes also get a error "10197? ?No market data during competing live session". However, I don't use a paper trading account. Instead, I receive this in my live trading account, even though there is only one account active. Thus far this error message has not affected my automated trading, so I simply ignore it.


 

Thank you, J G. Calling cancelMktData(<ticker_id>) before calling disconnect() fixed the issue, both with live and paper trading.

I'll keep monitoring for error 10197 on the live trading account to check if it is still returned occasionally as you mentioned.

Thanks!


 

TWS API team?buried in the research of the problem...

I'm currently ignore that error as a warning, and it seems
market data comes after some time.


// C#

? ? ? ? public override void error(int id, int errorCode, string errorMsg)
? ? ? ? {
? ? ? ? ? ? // to ignore
? ? ? ? ? ? /*
? ? ? ? ? ? ?* Code: 10090, Msg: Part of requested market data is not subscribed. Subscription-independent ticks are still active.Delayed market data is available.
? ? ? ? ? ? ?* Code: 10167, Msg: Requested market data is not subscribed. Displaying delayed market data...
? ? ? ? ? ? ?* Code: 10197, Msg: No market data during competing live session
? ? ? ? ? ? ?*/
? ? ? ? ? ? HashSet<int> warnings = new HashSet<int>() { /*2104, 2106, 2108,*/ 10167, 10090, 10197 };
? ? ? ? ? ? if (warnings.Contains(errorCode))
? ? ? ? ? ? {
? ? ? ? ? ? ? ? return;
? ? ? ? ? ? }
? ? ? ? }


 

Hello,

As anyone received some feedback from IB about it?
As this issue still occurs with the latest release (TWS 984)
I use TWS 973 and I don't get this bug.
But this version will become deprecated at some point in the future.
So I'd like really to get this bug fixed.

Regards


 

Hello,
As I can see, in latest TWS 984.1h issue about "concurrect live session" is fixed,
I can't reproduce it. What bug with options market data do you mean?