Does anyone know how to request historical data for futures contracts that have already expired in IbPy?
There are plenty of examples for requesting historical data for example this post, however these fail if you put in a contract expiration date that is in the past.
$\begingroup$
$\endgroup$
Add a comment
|
1 Answer
$\begingroup$
$\endgroup$
2
After some research and reading the source, I found there is a field in the Contract class called: m_includeExpired. Set this to True and you can get data for expired contracts.
-
$\begingroup$ How far back does this go? The docs on Unavailable Historical Data say "Expired futures data older than two years counting from the future's expiration date." $\endgroup$– GascoyneCommented Dec 29, 2018 at 7:19
-
$\begingroup$ @Peter It's been a while since it was posted. It doesn't seem to work for me. Any new thought? $\endgroup$– horaceTCommented Apr 14, 2021 at 18:53