Downloading expired contract data with TWS/IB data plugin

Is there a way to download historical futures contracts with the built in TWS data plugin?
For instance: MESU0-GLOBEX-FUT-USD does not download any data.

I'm assuming this is because the backfill only allows for n-days back from today? But this is just a guess.

Thank you

Are you subscribed to GLOBEX? Only subscribed markets offer backfill.

Thanks for the reply @Tomasz,

Sorry I should have included that information in my first post.
I am subscribed to "US Securities Snapshot and Futures Value Bundle".

The above symbol's backfill is available in TWS, and backfill works with the current contract (MESH1-GLOBEX-FUT-USD)

The plugin makes reqHistoricalData request https://interactivebrokers.github.io/tws-api/historical_bars.html with endTime parameter being current time and duration string say "5 D" (for 5 past days).
It depends on Interactive Brokers if they return past data if current data are not available because symbol is expired.

I will explore this with the python API and report back here when I do.
I saw a tool online that claimed it downloaded expired contracts. So I'm assuming it's just sliding the endTime window back.

Hello everyone, just for the record, I have found the way to download the expired futures data with Python IB API, works as IB says up to 24 month prior to expiration. You define the contract normally as you do with live contracts, the only additional thing you need to do is to use .includeExpired flag within within the Contract class and set it to TRUE i.e. =1. Heres the link to their github doc: https://interactivebrokers.github.io/tws-api/basic_contracts.html#fut

Then you can import the data into Amibroker.

I wrote a script to do this, see my thread here: Python script: Download multiple historical IB TWS CME Futures contracts - #15 by Pinecone

:grinning:

Thank you Pinecone, sorry I somehow did not expect this conversation to end without referring to that your work, so I found it only expost. Thank you for posting the comprehensive solution.