¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Historical Market Depth?


gururise
 

How is everyone back-testing their strategies that utilize Market Depth? As far as I can tell, historical market depth data is not available through the API, or am I missing something?

Thanks!


 

I save collected market depth data and backtest against my own database.

On 4/29/2011 5:55 PM, gururise wrote:

How is everyone back-testing their strategies that utilize Market
Depth? As far as I can tell, historical market depth data is not
available through the API, or am I missing something?

Thanks!


gururise
 

After looking through the Java API docs more carefully, in the reqHistoricalData() function, there is an input variable named whatToShow that can be set to BID, ASK or BID_ASK.

Does anyone have experience with this and how it works, and how the data is calculated? Would setting it to BID return Bid data during the bar in question?? How would BID_ASK work?

I'm wondering if one can recreate market depth data using this...

--- In TWSAPI@..., Jim Covington <jim@...> wrote:

I save collected market depth data and backtest against my own database.

On 4/29/2011 5:55 PM, gururise wrote:

How is everyone back-testing their strategies that utilize Market
Depth? As far as I can tell, historical market depth data is not
available through the API, or am I missing something?

Thanks!


[Non-text portions of this message have been removed]


 

I'm afraid you're SOL on getting historical Market Depth from TWS. I also have
recorded data from TWS to replay through my backtest software, but even then,
you are limited to only 3 simultaneous market depth subscriptions at a time from
TWS.





________________________________
From: gururise <no_reply@...>
To: TWSAPI@...
Sent: Fri, April 29, 2011 7:45:52 PM
Subject: Re: [TWS API] Historical Market Depth?

After looking through the Java API docs more carefully, in the
reqHistoricalData() function, there is an input variable named whatToShow that
can be set to BID, ASK or BID_ASK.

Does anyone have experience with this and how it works, and how the data is
calculated? Would setting it to BID return Bid data during the bar in
question?? How would BID_ASK work?

I'm wondering if one can recreate market depth data using this...



--- In TWSAPI@..., Jim Covington <jim@...> wrote:

I save collected market depth data and backtest against my own database.

On 4/29/2011 5:55 PM, gururise wrote:

How is everyone back-testing their strategies that utilize Market
Depth? As far as I can tell, historical market depth data is not
available through the API, or am I missing something?

Thanks!






------------------------------------

Yahoo! Groups Links


 

Like Rob said you can forget Market Depth.

But all the whatToShow values are either obvious (at least upon testing) or
documented--probably in the release notes for several years back if not in
the actual API user guide.

As you can read about, BID_ASK is the odd-ball non-obvious one. It combines
hi ask, lo bid, and sticks time-weighted average bid and
time-weighted-average ask in the open/close fields.

I am collecting data but have not yet done testing to determine the utility
of this. It seemed to me that for 1-second bars getting the time-weighted
average might give an edge of additional information over the lo ask, hi
bid, and open/close for determining execution, so it seems worth trying.
Maybe it is even more true for bars other than 1-sec, don't know. But with
1-sec bars for many instruments you will see many seconds with no price
change, and some with a change. So which approach gives more information
for one of those seconds with a price change, given that you already have
data for surrounding seconds?

Anyway the big penalty of BID_ASK is that it "costs" you two historical
requests for purposes of determining request pacing, yet gives only as many
fields as a single request, so it is a bummer. For some things I am
downloading BID, ASK, and BID_ASK, which means I get changed for 4 requests
but much of the data is redundant. I look forward to figuring out what is
more useful, but haven't yet.

-Kurt

On 4/29/11 7:45 PM, "gururise" <no_reply@...> wrote:

After looking through the Java API docs more carefully, in the
reqHistoricalData() function, there is an input variable named whatToShow that
can be set to BID, ASK or BID_ASK.

Does anyone have experience with this and how it works, and how the data is
calculated? Would setting it to BID return Bid data during the bar in
question?? How would BID_ASK work?

I'm wondering if one can recreate market depth data using this...



--- In TWSAPI@..., Jim Covington <jim@...> wrote:

I save collected market depth data and backtest against my own database.

On 4/29/2011 5:55 PM, gururise wrote:

How is everyone back-testing their strategies that utilize Market
Depth? As far as I can tell, historical market depth data is not
available through the API, or am I missing something?

Thanks!


 

Sorry for necromancing this 2011.

In 2020...

...
The API provides real-time market depth but I don't think every change to the order book is sent since changes occur too frequently (multiple times per sec). Do you think this is accurate?

Can we pull historical market depth on US equities?


 

I haven't tried that in practice, but looking at limitations with historical data https://interactivebrokers.github.io/tws-api/historical_limitations.html#non-available_hd I can suppose you can't get market depths in a historical manner.
The maximum granularity you can get is 30-sec bars (open, high, low and close prices. may be with volume).

IB have a small possibility to suscribe on, receive and store tick-by-tick data,
but it's not the main purpose of that api.


Nick
 

¿ªÔÆÌåÓý

Unless something changed recently historical o/h/l/c data is available at 10, 5 and 1 sec bars.


On 11/22/2020 1:52 PM, Mikhail Ershov wrote:

I haven't tried that in practice, but looking at limitations with historical data I can suppose you can't get market depths in a historical manner. The maximum granularity you can get is 30-sec bars (open, high, low and close prices. may be with volume). IB have a small possibility to suscribe on, receive and store tick-by-tick data,
but it's not the main purpose of that api.


 

Available, but only 6 months


 

It is accurate as far as I used it.? At least it seems to reasonably represent what IB is able to trade.

You can get it from IEX and compare (IEX is very small volume so easy) never seen it different.

?

Again: IBKR is NOT the best supplier of LII informations.

They do NOT have any method (that I am aware of) that allow to get historical LII,

You should buy it from a specialized feed,

Doesn't seems IB intent to deliver better service on that. (They already charge for LII on an exchange basis but are resonably cheap for the 'cheap' service they deliver)

?

Really playing using LII range in the 2000$/month subscription to a professional feed.? polygon.io for exemple

What some of us do is record it on some tickers (not many allowed simultaneously!!) and create a DB of it.

BTW LII is so "news" and psycho-contextual? driven that you may not need more than 3 months of data to get enough for backtesting. Especially theses times where Robinhood crowd and HFT are figthing in same arena. (HFT winner)