lbilli / Jib.jl

A Julia implementation of Interactive Brokers API
MIT License
62 stars 14 forks source link

past and future stock options prices ? #5

Open ihiasi opened 4 years ago

ihiasi commented 4 years ago

Hi - is it possible to have an example of how would I get past and future stock options prices ? Thank you.

lbilli commented 4 years ago

Just define the appropriate Contract and pass it to reqHistoricalData(). For a stock option something along these lines:

opt = Jib.Contract(symbol="GOOG", secType="OPT", currency="USD", exchange="SMART")
opt.lastTradeDateOrContractMonth = "20200717" # expiration
opt.strike = 1450     # strike price
opt.right = "C"       # call

Check IB docs for more contract examples. However, keep in mind that, except for forex and commodities, you need a paid subscription to be able to download pretty much any other historical data.