Reputation: 470
I try to find a way to receive the current market state and changes to the market state of a tradeable instrument through IB's API.
For example, I try to get a notification when TSLA moves from market-closed to pre-opening auction and then to the regular trading session, likewise during the day.
The only bit I found so far is https://interactivebrokers.github.io/tws-api/tick_types.html#halted - which gives me a "market halted" indication. That's not what I look for, markets can also go into an auction state throughout a trading session.
I can't find any reference to market states in IB's API. Any solution anyone?
Thanks a lot
Upvotes: 1
Views: 438
Reputation: 185
Indeed, it seems there is nothing to check if a market is open/closed.
I'm currently relying on getting the book (bid/ask).
A closed market will have:
By validating the book, you can get a grasp of what is being traded out there.
Obviously, it is not bulletproof, as a market can have a circuit breaker on.
Also note that requesting historical data is not enough, as a market can be open for trading, but without any trades traded so far (zero volume).
Upvotes: 0