5
$\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$

1 Answer 1

6
$\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$
2
  • $\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
    Commented 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$
    – horaceT
    Commented Apr 14, 2021 at 18:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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