How to merge Trade ticks with Bid_Ask ticks from IB API reqHistoricalTicks, like the Time&Sales window?

reqHistoricalTicks returns data with 1 second precision, so only looking at timestamp is not enough to merge them. But it seems that the Time&Sales window in TWS is able to consistently present historical tick data in exactly the merged format I want (except it also only has 1 second precision), including rows where the Bid/Ask changed with no trades taking place:

How can I get this format from the API? Is TWS using some tricks/assumptions to merge the two data sources, or is there another undocumented endpoint that provides pre-merged data?

Submitted October 17, 2020 at 02:22PM by davidtgq

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s