I saw Ray's post with a sample put option selling program on BMY, I cloned it and it ran fine. Next tried to change the symbol to QQQ, AAPL, GOOG, or SPY, and there were no contracts returned in OnData... (all of those symbols have weekly options just like BMY). Is there only a limited list of symbols available, or?
Jared Broad
Hey Ashley! We downloaded BMY all the way back to get a base line for a few tests, but currently all symbols (except BMY) are only done from Jan 1 2014 to August 2016. We're uploading all the data it just takes time as there are many terabytes! 2013 is on its way up now -- ETA Monday night.
The one we set as the BasicTemplate is a bad example though as the filter is very strict and its almost never hit. We'll update that shortly -- in the meantime I've updated the clone you gave to a Google contract.
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.
Jared Broad
Hey Lucas! We have SPX data but the modeling isn't really setup for index options yet. We completely agree this is a high priority and we've mapped out the "todo" list for its support.
Before we dive into building new features we want to make sure the existing code is stable and working as people expect. This might take a few weeks while we're debugging various issues.
In the meantime I'd recommend you use SPY as an equity-option proxy for the SPX index-options.
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.
Jared Broad
Thanks for the suggestion @User65267; Futures is up to date and completely processed.
Options is finished processing but patchy. There were bugs in AlgoSeek's data and we're getting them to fix it. As of today I wouldn't say its reliable to backtest on options as it may be missing strikes. AlgoSeek gave me an ETA of 2 weeks for the fixed data.
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.
Tyler Durden
Do we have index options data available now for SPX? The data managers shows it's currently trading but after having tried numerous dates and filters, i'm not getting chains into OnData. Works for GOOG etc.
from clr import AddReference
AddReference("System")
AddReference("QuantConnect.Algorithm")
AddReference("QuantConnect.Common")
from System import *
from QuantConnect import *
from QuantConnect.Algorithm import *
from datetime import timedelta
### <summary>
### This example demonstrates how to add options for a given underlying equity security.
### It also shows how you can prefilter contracts easily based on strikes and expirations, and how you
### can inspect the option chain to pick a specific option contract to trade.
### </summary>
### <meta name="tag" content="using data" />
### <meta name="tag" content="options" />
### <meta name="tag" content="filter selection" />
class BasicTemplateOptionsAlgorithm(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2017, 12, 1)
self.SetEndDate(2018, 1, 8)
self.SetCash(100000)
option = self.AddOption("SPX")
self.option_symbol = option.Symbol
# set our strike/expiry filter for this option chain
option.SetFilter(-100, +100, timedelta(0), timedelta(180))
# use the underlying equity as the benchmark
self.SetBenchmark("SPX")
def OnData(self,slice):
if self.Portfolio.Invested: return
for kvp in slice.OptionChains:
if kvp.Key != self.option_symbol: continue
chain = kvp.Value
# we sort the contracts to find at the money (ATM) contract with farthest expiration
contracts = sorted(sorted(sorted(chain, \
key = lambda x: abs(chain.Underlying.Price - x.Strike)), \
key = lambda x: x.Expiry, reverse=True), \
key = lambda x: x.Right, reverse=True)
# if found, trade it
if len(contracts) == 0: continue
for c in contracts:
self.Log("contract: {0} strike: {1} right: {2} expiry: {3} open interest: {4} last price: {5} bid: {6} bid size: {7} ask: {8} ask size: {9}".format(str(c), c.Strike, c.Right, c.Expiry, c.OpenInterest, c.LastPrice, c.BidPrice, c.BidSize, c.AskPrice, c.AskSize))
symbol = contracts[0].Symbol
self.MarketOrder(symbol, 1)
self.MarketOnCloseOrder(symbol, -1)
def OnOrderEvent(self, orderEvent):
self.Log(str(orderEvent))
Jing Wu
Hi Tyler,
We don't support index and index options. You could use the ETF like SPY
Bert Vaughan Merrick
SPY could be a substitute only if you supported changing its option style from American to European. I mean maybe add some flag to disable early excercise.
Right now, if I am actually interested in SPX options but use SPY options instead, the backtest throws in all these random early excercise events which make it unrealistic for SPX.
AshleyMesser
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!