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:

https://preview.redd.it/ot4azmuqrpt51.png?width=448&format=png&auto=webp&s=c5b84a5257534b7d5a5b7ac5e00f957f29f27ecd

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
via https://ift.tt/3lX4B4t

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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