Very exciting day for me as I've been awaiting options support. Today I was able to execute a live trade on my IB paper account (want to test more before going real money).
This algo was a little hacked together as a test but I'm too excited not to share it.
Who are my options traders out there? Looking forward to working on broader strategies but will probably start simple with short puts & covered calls. Then strangles etc. Some of the example algos show that multi asset class algorithms are already working. Stoked
Justinwwaz
Finally a way to backtest options...will await patiently for Index data
Morfix
Stephen Oehler
Hi Hugo,
Compounding Annual Return is not scaled: here it is 4.431%, so his net profit over a single year would nominally be just 4%.
A Compounding Annual Return of 100% would be effectively doubling your investment every year.
Ray Bohac
For what its worth I was showing this as an example on how to enter a trade. There is no strategy here
Richard Hale Shaw
Ray, in your example, a build yields warnings about hiding the base class OnData method (pretty standard C# warning if you have a base class non-virtual method and you redefine it in a derived class).
Question: does QCAlgorithm.OnData do anything, or is it just a place-holder? If so, what? And should the derived class implementation routinely ignore the warning or call the base class method?
Thanks,
Richard
Jared Broad
@Richard - in the base class it is a placeholder; you can ignore the OnData method if you do not need it. Regarding the warning - we have a helper method which automatically routes to the OnData method you use (so you can use it with or without the override specifier).
To make LEAN easy to use we've made the API layer of LEAN somewhat heuristic; the more strict C# and beautiful engineering is enforced under the surface.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Peter Chen
Hi Ray,
I'm a newbie here on QuantConnect(though not a newbie to options & trading). So, I'm playing with
Research notebooks and the options example in it. I'm using the sample code here:
googopts = qb.AddOption("GOOG")
googopts.SetFilter(-10, 1, timedelta(0), timedelta(780))
option_history = qb.GetOptionHistory(googopts.Symbol, datetime(2015, 7, 24))
print option_history.GetStrikes()
print option_history.GetExpiryDates()
h6 = option_history.GetAllData()
Output:
[640.0, 642.5, 645.0, 647.5, 635.0, 637.5, 630.0, 632.5, 627.5, 625.0, 622.5, 620.0]
[datetime.datetime(2015, 8, 21, 0, 0), datetime.datetime(2015, 9, 18, 0, 0), datetime.datetime(2015, 10, 16, 0, 0), datetime.datetime(2015, 12, 18, 0, 0), datetime.datetime(2016, 1, 15, 0, 0)]
How do I access the exact option I want and not the entire chain?More specifically, I'm looking to get the time series data(both daily and minutely or hourly) GOOG 18SEP15 545.0 P
That is the GOOG Put for 18Sep15 with strike 545.
So, I see that it has the Sept18 2015 chain. How do I specify exactly and how do I plot as candlesticks? Right now, # Gets historical data from the subscribed assets, between two dates with daily resolution
h1 = qb.History(goog.Symbol, datetime(2015,7,1), datetime(2015,9,2), Resolution.Daily)
# Plot closing prices from "GOOG"
h1.loc["GOOG"]["close"].plot()
It only produces line charts! I want candlestick charts for daily and minutely(zoomed in for 2 particular dates).Bare with me as I'm newbie to QC. But I'm so EXCITED about the availability of optionsdata! One of the key attraction to the QC platform!
Thanks in advance!
Alexandre Catarino
Say you want to GOOG 18SEP15 645.0 P, please use:
put = h6.loc[datetime(2015,9,18), 645, 'Put']
At the moment, we only have minute-data for options. However, you can use pandas to compute lower resolution candles. We are looking into installing plotly for candle plotting.
Peter Chen
Hi Alex, AWESOME! So, the output when I just did put by itself is a table with the following headings:
askclose askhigh asklow askopen asksize bidclose bidhighbidlowbidopenbidsizeclosehighlowopensymboltime
can I select each of those column individually? What is the data structure of put? is it another dataframe?
It's interesting that you said candle plotting is not available but I've seen graphs with candlesticks? I just haven't seen the code to do so.
Thanks for all the help! This is getting me a start to exploring more of QC!
Peter
Alexandre Catarino
We can select columns with this snippet:
put = h6.loc[datetime(2015,9,18), 645, 'Put'] close = put["close"]
It will result in a pandas.Series object.
For candle plotting, you can use matplotlib:
from matplotlib.finance import candlestick2_ohlc fig, ax = plt.subplots() df = h1.loc["SPY"] candlestick2_ohlc(ax,df['open'],df['high'],df['low'],df['close'],width=0.6)
Ray Bohac
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!