Fully automated futures trading

hmm, I just tried Coffee (KC), for which I don't have a subscription, and reqHistoricalData worked, but only after adding reqMarketDataType(3). I've never tried it before, so can't say if it always worked or it's something new..
 
I also did this last summer for a bunch of ICE markets for which I didn't have a subscription and it worked for me as well then, for what it's worth.
 
Sorry for the OT, but I was hoping someone could help me on this.
My understanding was that through IB's API it's possible to get historical price data only for instruments for which I have a paid data subscription. I also thought that, for instruments for which I don't pay, the only kind of data I could get was a price snapshot through ib.reqMktData(contract, snapshot = True), after setting ib.reqMarketDataType(3).

But now I realized that reqHistoricalData works also on exchanges for which I don't pay for data, and it works with daily data but also with 5secs data.

What am I missing?

Wow!

I can confirm this is working for me too, at least with TWS...have not tried with the Gateway.

Edit: also wanted to add that I have definitely tried this before (a couple years ago, not recently), and it didn't work.

I'm using TWS version: Build 10.21.1o, Feb 14, 2023 5:00:24 PM

Here is a complete code snippet (copied from @younggotti but added the imports & initialization bits). I'm using S&P 500 micro contract here - I have zero IB data subscriptions:

Code:
from ib_insync import Future
from ib_insync import IB

ib = IB()
ib.connect("127.0.0.1", 7496)
ib.reqMarketDataType(3)
contract = Future("MES", "202303", "CME")
ib.qualifyContracts(contract)
bars = ib.reqHistoricalData(contract, endDateTime='', durationStr='1 M', barSizeSetting='1 day', whatToShow='TRADES',
                            useRTH=True, formatDate=1)
print(bars)

This is huge if it continues to work, and isn't just a mistake!
 
Wow!

I can confirm this is working for me too, at least with TWS...have not tried with the Gateway.

Edit: also wanted to add that I have definitely tried this before (a couple years ago, not recently), and it didn't work.

I'm using TWS version: Build 10.21.1o, Feb 14, 2023 5:00:24 PM
Perhaps it depends on the build. I am on TWS: Build 10.19.1k, Jan 23, 2023 5:13:03 PM

I try not to update the build unless something goes wrong, and since I was testing it purely out of curiosity, I won't be upgrading just to test this.
 
I also wanted to add that if I use reqMarketDataType(1) it fails for the usual reason...

Just to preempt anyone wondering if that CME example works for me because of the free non-professional US futures data package (I don't have it).
 
The solution of using delayed data type to obtain both streaming and historical data was raised in this thread by @Kernfusion back in June 2022. Link here.

Whilst Kernfusion uses a data stream to collect data, I have been using reqMarketDataType(3) together with reqHistoricalData() to obtain historical data for ICE and EUREX markets ever since Kernfusion's post set me on the right path.

KH
 
Back
Top