-
Hi there I am a julia noob coming from python and Jib.jl is teaching me ALOT about coding practices in julia, all hail ibilli. This has me stumped. I am revisiting futures and am puzzled about how to write the call for getting the FRONT MONTH only. I understand the call in specific terms ( when I know the contract ID) but how can I generalize it please?
So if I want to get the contract id for the current front month ONLY of ES or CL what is the process please? thank you for any help. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
IB's continuous future contracts may be what you are looking for. Using the API, following IB docs, you can use cfut = Jib.Contract(symbol="CL", secType="CONTFUT", exchange="NYMEX")
Jib.reqContractDetails(ib, idx, cfut)
# Obtain the conId from the returned contract and then
Jib.reqMktData(ib, 1, Jib.Contract(conId=xxx, exchange="NYMEX"), "", false) Continuous contracts can be used directly in |
Beta Was this translation helpful? Give feedback.
IB's continuous future contracts may be what you are looking for.
Using the API, following IB docs, you can use
secType="CONTFUT"
to get the lead month contract, as in:Continuous contracts can be used directly in
reqContractDetails()
andreqHistoricalData()
but not inreqMktData()
, for which a two step approach as above is required.