4
$\begingroup$

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.

$\endgroup$
4
$\begingroup$

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.

$\endgroup$
  • $\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$ – Gascoyne Dec 29 '18 at 7:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.