开云体育

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

Not receiving previous close price from ReqMktData


 

I'm not regularly receiving tick #9 today through the API after calling ReqMktData for one particular stock. Admittedly, this is not the first time I ran into this bug for any random stock, but today this it's repeats frequently (most of the time, indeed) with one particular stock. So I managed to log this problem with ease and now I have not one, but two API log excerpts running for at least 5 minutes during regular trading hours with lots of ticks coming in from ReqMktData, but not the Close Price tick.
?
The stock in question is XNYS:ATR, {Type='STK';LocalSymbol='ATR';PrimaryExchange='NYSE';Symbol='ATR';Exchange='SMART';Currency='USD';ContractId='4651'}. Its last closing price yesterday was 158.46 and it is displayed in TWS no problem in the respective Previous Close column, but is apparently not getting reliably reported through the API.
?
I ask the group to see my logs to help decide how to go about this issue.
?
I'm attaching the two decoded TWS API log text excerpts with everything before the respective REQ_CONTRACT_DATA and REQ_MKT_DATA calls removed due to representing sensitive account data and up to the point of API connection closing (about 5 minutes each), with a few short clarifying comments denoted with the starting symbol #.
?
--
Best,
DS


 

For the contrast, I'm also attaching another API session log from today where the #9 tick was reported immediately after ReqMktData call, as expected.
?
Unfortunately the fact that the tick is reported sometimes does not mitigate the issue of it not being reported some of the other times when the API trading program is regularly relying on it to make data driven decisions, and for my trading it is absolutely crucial.
?
--
Best,
DS


 

Not sure what to tell you, but maybe this is one for IBKR to look into. It does not feel like there is anything your client does wrong.

Here a few thoughts:
  • IBKR describes the "Close" tick as: "The last available closing price for the previous day. For US Equities, we use corporate action processing to get the closing price, so the close price is adjusted to reflect forward and reverse splits and cash and stock dividends."
  • That tells me that "Close" price most likely comes from the historical data "HMDS" farm and not the real-time data farm. Maybe you can check the TWS/IBGW logs to see whether there were any complaints about not being able to make or failed HMDS queries for the close price.
  • You could also enable more verbose HMDS logging in TWS if you want to drill down some more. But that is a real firehouse, interesting though.
I record "Close" ticks but don't really use them. But I am getting them a few times a day:
  • When the client connects some time after 16:00 US/Central
  • For US stocks shortly after 19:00 US/Central when the after-market session has ended
  • Whenever the data farms reset. That is usually between 23:00 and 23:30 US/Central during the maintenance window but occasionally also throughout the day

And it does not feel like I am missing "Close" ticks, but I can't say that for sure. One thing I do, though, is that I request "the kitchen sink" during reqMktData() instrument subscription calls. My tick list for stocks looks like this "100, 101, 104, 105, 106, 165, 220, 221, 232, 233, 236, 258, 292, 293, 294, 295, 318, 375, 411, 456, 460, 577, 586, 587, 588, 595, 614, 619, 623"

You should not have to specify any of these to get the "Close" tick reliably. But maybe it helps if the issue is HMDS query related.

闯ü谤驳别苍
?
?
?
On Tue, Jan 28, 2025 at 12:23 PM, ds-avatar wrote:

For the contrast, I'm also attaching another API session log from today where the #9 tick was reported immediately after ReqMktData call, as expected.
?
Unfortunately the fact that the tick is reported sometimes does not mitigate the issue of it not being reported some of the other times when the API trading program is regularly relying on it to make data driven decisions, and for my trading it is absolutely crucial.
?
--
Best,
DS