I have been using the TWS API for almost a year now without any issues and now have been getting issues recently. As of May 3, 2021, my program has not been working properly and April 29, 2021 was the last date that it worked to my knowledge. After going through extensive testing, I found out that some quotes would not return current and/or previous close prices for a good chunk of quotes I use, regardless if trading is opened or closed. It seems that U.S. Indices (NASDAQ, S&P 500, and Russell 2000) and mutual funds do not break my program and has current and close prices. However, most foreign indices and U.S. equities I use do not have a current price and/or a previous price (and when it does, it's only for a short period of time until it doesn't have them). I've tried finding contact information directly on the site but couldn't find one for technical services like the TWS API. If anyone can point me in the right direction, it would be greatly appreciated. On a side note, I wanted to mention I was also receiving some of the error messages mentioned in this thread last week (particularly "Unable to read beyond the end of the stream." and "Unable to read beyond the end of the stream.") but does not seem to occur anymore since May 9, 2021: https://www.elitetrader.com/et/thre...ith-ib-gateway-9-63-and-with-api-9-73.320979/
This sentence gives me the impression that something got changed in your market data subscriptions. May 3rd was the first working day of this month. Have you verified that you are still subscribed to the correct market data? You can send a ticket to IB from the online account environment. When you create a ticket you will be asked what kind of topic it refers to. Here you can indicate that it is API related.
I sent a ticket regarding this manner. Thank you. I have verified that I am still subscribed to Network A and C. I just tested it a few minutes ago with pre-market trading and same thing occurs. Somehow, I was able to get full data for some random quotes, like CAC 40, IBEX 35, CZR, and WMT, but that was it (skipped over 20 quotes). I did a second iteration after about 10 minutes and it skipped CZR and WMT (which showed the first time) but showed HD (which didn't show the first time). This behavior definitely is not normal. I also noted that in the market data connection, when I make a request to the DAX 30, the status of eufarm shows connected but then it is removed when the API connection status is accepted. For IBEX 35, the status of eufarm shows connected but it is not removed. I believe there was some maintenance done on Saturday, May 1, 2021 but not sure if TWS API was affected. The only other thing I can think of is that I am not waiting long enough after making a reqMktData call, maybe 1 second is too quick? I only get tick IDs 1 and 2 but not 4, 9, 68, or 75 for missing price data. I'll update here if/when I hear back from support.
With reqMktData() you subscribe to a stream of data. You will remain subscribed until you cancel that subscription. The actual price data is then returned to you via tickPrice(). However: you only receive a feedback if the price changes from the previously sent value! So if the price does not change for ten minutes, you won't receive an update during those ten minutes! Using any kind of timer function (e.g. the 1 second you mention) may cause you to not receive an update at all, depending on how fast the prices are changing.
I have found out a few hours ago that it's not just reqMktData not returning all data but also reqContractDetails and it's not causing contractDetailsEnd to be invoked from time to time. This also causes my program to stall and is something I will take into account. I hope Interactive Brokers can get back to me on this issue. But thank you for helping me with this.
secretply - I had the same problem with data from api. I downgraded tws to 983.2j and it worked correctly. Don’t use beta versions.