The YahooDataDownloader appears to work nicely. Is there a similar tool for creating the factor files? It appears the necessary data is available via yahoo. For example. http://ichart.finance.yahoo.com/x?s=AAPL&a=00&b=2&c=1962&d=04&e=25&f=2016&g=v&y=0&z=30000
If said tool does not exist, does anyone understand the spec of the factor files? Or more importantly the math required to do the conversion? https://github.com/QuantConnect/Lean/blob/master/Data/equity/usa/factor_files/aapl.csv
When comparing the two samples of data from above I also noticed the 7:1 Split occurs on Jun 9 for the yahoo data but appears to occur on Jun 6 in the factor file. Not sure it matters, but maybe someone has an explanation.
Thanks!
Jeff Miller
I worked through the calculations on a spreadsheet. The results aren’t exact for the dividend adjustment, but probably close enough.
Looks like the Factor file columns are [Date of Previous Close, Dividend Adjustment, Split Adjustment].
I believe the calculations are as follows
Dividend Adjustment = Prev Adj - Dividend / ( Prev Close * Split Adj)
Split Adjustment =((Prev Close / Split ) / Prev Close)
Am I missing anything?
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.
Alexandre Catarino
Factor files have three colums: date, price factor (e.g.: dividend) and split factor.
The last value is always unity, because if we multiply the stock price for it, it will not change (be adjusted).
For instance, AAPL had three splits:
2000-06-21 (Wed) -> 2:1 2005-02-28 (Mon) -> 2:1 2014-06-09 (Mon) -> 7:1
Prices are adjuted for split on the last trading day before the event and previous splits are "refactored":
2000-06-20 (Tue) -> 0.0357143 (1/2)*(1/2)*(1/7) 2005-02-25 (Fri) -> 0.0714286 (1/2)*(1/7) 2014-06-06 (Fri) -> 0.142857 (1/7)
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
Dividends factors are a little harder to reverse engineer; but from the LEAN Project the Dividend.cs file, and the FactorFile.cs
Distribution = close - (close * priceFactorRatio);
priceFactorRatio = 0; var index = _data.IndexOfKey(date); if (index > -1 && index < _data.Count - 1) { // grab the next key to ensure it's a dividend event var thisRow = _data.Values[index]; var nextRow = _data.Values[index + 1]; // if the price factors have changed then it's a dividend event if (thisRow.PriceFactor != nextRow.PriceFactor) { priceFactorRatio = thisRow.PriceFactor/nextRow.PriceFactor; return true; } } return false;
You take the current factor / previous factor to get the factor ration and then apply that to the closes to get the price.
We absolutely need this in LEAN :) If you can make a toolbox Yahoo Split and Factor file generator it would be a huge help :)
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.
Jeff Miller
>We absolutely need this in LEAN :) If you can make a toolbox Yahoo Split and Factor file generator it would be a huge help :)
I agree. Being able to write algos in a real IDE with a debugger puts Lean at a huge advantage over the competition. The first step was open sourcing the engine, which was done. The next hurdle remains getting local data. Once that hurdle is satisfied I suspect an increased rate of contributions from novices. As these people aren’t typically going to drop thousands of dollars on purchasing data just to be able to play around.
Back to the topic.
My approach will be to assume daily data was already downloaded. In that case I’ll need to go lookup the previous close price. I’m unfamiliar with the Lean framework, so what’s the optimal way to retrieve this daily data from within our new split/div downloader? I see LeanDataWriter.LoadHourlyOrDailyFile is kinda what I need, but I’m guessing there is a cleaner way that will return a nice data structure rather than dealing with file parsing.
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
getting splits, dividends and price from one place. You could even update
the existing yahoo downloader to get it as well.
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.
Jeff Miller
> Id assume it was independent from local data and use Yahoo.
This is what I ended up doing. However, I see a potential problem if someone is using the incremental merge capability of the Yahoo downloader. For example. Downloading a single day at the end of the trading day. The easiest way around this for now is just to download the entire stock history every time. Maybe a slightly more efficient way that keeps the merge capability is to look for any new split/dividend events within in window that’s specified. If any exists then force a full history download, otherwise do a merge.
Here are my generated results for AAPL. I can't figure out why the values are off slightly when compared to the values in git. The first dividend calculation on 20151104 results in 0.9957377 vs. 0.9957381
My equation looks like this
0.9957377 = PrevDividendAdjustment - (Dividend / (PeviousClose * PrevSplitAdjustment ));
0.9957377 = 1 - (0.52 / (122 * 1));
My Results
19980102,0.9288142,0.0357143
20000620,0.9288142,0.0357143
20050225,0.9288142,0.0714286
20120808,0.9288142,0.1428571
20121106,0.9330894,0.1428571
20130206,0.9376360,0.1428571
20130508,0.9434302,0.1428571
20130807,0.9500057,0.1428571
20131105,0.9565650,0.1428571
20140205,0.9623695,0.1428571
20140507,0.9683196,0.1428571
20140606,0.9738740,0.1428571
20140806,0.9738740,1
20141105,0.9788234,1
20150204,0.9831409,1
20150506,0.9870720,1
20150805,0.9912316,1
20151104,0.9957377,1
20501231,1,1
From GIT
19980102,0.9311149,0.0357143
20000620,0.9311149,0.0357143
20050225,0.9311149,0.0714286
20120808,0.9311149,0.142857
20121106,0.9351125,0.142857
20130206,0.9393839,0.142857
20130508,0.9448594,0.142857
20130807,0.9511153,0.142857
20131105,0.9573959,0.142857
20140205,0.9629841,0.142857
20140507,0.9687481,0.142857
20140606,0.9741588,0.142857
20140806,0.9741588,1
20141105,0.9790044,1
20150204,0.9832496,1
20150506,0.9871304,1
20150805,0.9912512,1
20151104,0.9957381,1
20501231,1.0000000,1
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.
Alexandre Catarino
It looks like the closing price used to generate the value of 0.9957381 we find in the github file is $122.01:
0.9957381 = 1 - (0.52 / (122.01 * 1))
From my experiece, different platforms display different adjusted prices when we go back enough in time, so this slight discrepancy is expected.
This reinforces the wisdom of Jared's proposed assumption, since it is better to know from where all your variables in your equiations come from and their value.
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.
Andrew Hart
Jeff, I think your calculations are correct. I also think Alexandre is probably right too, although I'm not sure where the data came from if that's the case. Everywhere I have looked, including the data that comes from QuantConnect, the closing price on 11/4/2015 is $122.00.
I have created a pull request on github that expands the ability of the YahooDataDownloader to download split and dividend data. I also created a utility that can create a FactorFile object. Using the Yahoo Split/Dividend data and the AAPL daily equity data, my utility (FactorFileGenerator) was able to confirm Jeff's calculations (up to a small rounding error).
https://github.com/QuantConnect/Lean/pull/592
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.
Jeff Miller
Nice! I’m glad to have you take this one over. :)
I have a decent implementation working, but my code is incredibly stove piped.
The only thing I didn’t notice in your pull request is how you are handling a split and dividend events that occur on the same day. Dividends should be applied pre-split in most cases.
Here is my code if you would like to compare the output results.
Program.cs : https://drive.google.com/open?id=0B7uLVigTKyqrRVB1Sm9uOW9oQmM
YahooDownloader.cs : https://drive.google.com/open?id=0B7uLVigTKyqrbmNfUXh3emhzVG8
Program.cs has a bunch a symbols hacked in for testing. I also adding an option to cache the yahoo data locally on the first pass. After the first run just set downloader.useLocalCopy = true to regenerate the factor files from the cached copy.
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.
Andrew Hart
Thanks Jeff! Your code will definitely be helpful. I do have some questions about your feedback. I think a better place to discuss these issues would be on the github. I'm going continue the discussion there, if that's alright?
https://github.com/QuantConnect/Lean/pull/592
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.
Mislav Sagovac
Hi Andrew Hart Jeff Miller ,
I have just discovered these thread. Is it possible to download factor files for choosen tickers using YahooDownloader or some other toolbox?
I can retrieve yahoo daily data but factor files are not downloaded by simply calling YahooDownloader.
I can't find the file in Lean/Toolbox that can download factor files.
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
We're creating a new subscription product to get all QC's map and factor files updated daily. It should be ready end of next week.
Yahoo's won't cut it for true universe selection.
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.
Mislav Sagovac
Jared Broad thanks on info! That's exactly the product I need right now :)
Do you know what will be the price for the subscription? Will it be included in current plans for web QC?
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
It's an external vendor so will not be able to be included in the plans. We'll try and make it easy for you to get LEAN setup locally but it's not cheap.
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.
Mislav Sagovac
Thanks, how can I know when the service will be ready?
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
I'll post here to let you know Mislav
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.
Mislav Sagovac
Hi Jared Broad ,
Have you ever made factor file available for purschase?
I am strugling with my local data set up, so maybe I would buy complete factor and map files if available.
I have "raw" data with only symbols, but I can't find publicly avaialble file which desrcibes ticker changes through time.
Best,
Mislav
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
Hi Mislav;
We've made a plan for this and scheduled the work. It should be done in the next 2 weeks. The plan requires a daily update to the map and factor file as they become out of date as soon as a company releases new dividend information or splits. We're going to sell the data for a flat subscription of $600 per year for maps, factors, and $240 for coarse universe data.
The daily price data will be available at a per-day rate we're yet to decide. We redesigning the data download portal to allow you to check out almost all of the data we have available in our cloud in LEAN format. Perfectly curated and maintained by the QC team. We hope this paired with the LEAN CLI will make it incredibly easy to run backtests locally and in the cloud.
Best,
Jared
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.
Mislav Sagovac
Thanks for the feedback. It would make local development much easier for sure. This is one of the biggest botleneck for me right now. I would be glad to pay. It isvery valuable and we have to suport your great work :)
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.
Petter Hansson
Here's the algo I'm broadcasting adapted from QT (link/attribution in code). I noticed it's trying to issue some too large orders at some points I don't really care to spend time figuring out why, and the code could use a cleanup. Also, if someone wanted to use this, carefully investigating slippage (particularly ensuring TLT and XIV have different values) is a necessity and possibly optimizing the order execution.
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.
Petter Hansson
(Also, a disclaimer, with XIV it's good to familiarize with the the fact you could lose 100% of your investment overnight in some extreme circumstance... you're making money taking on tail risk.)
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.
Thomas Chang
@Petter,
>>you could lose 100% of your investment overnight in some extreme circumstance...
Yes. But I think maybe this is a little bit exaggerated? :-)
As Alex said: But you can easily re-construct (using pandas or even Excel) VXX and XIV back to 1990 by using their underlying indices...
If it's really could be re-constructed, one knows how to do the risk-management in his algo, right? And I think this is at least much 'saver' than doing PUT or SHORT.
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.
Petter Hansson
Sure, just pointing out so nobody puts 100% of their capital into something like this. :-)
As for assuming the future will be same as the past, I don't recommend it in this case. Shorting volatility is a lot more popular now than in the past, which may lead to bigger kickbacks.
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.
Petter Hansson
Good reading from time on time regarding the subject of risks in volatility, if somewhat gloomy.
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.
Stevehank
Has anyone adapted any of the QT algorithms in below and successfully backtested in QC?
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.
Petter Hansson
I messed around with a ML version of something similar on QT but concluded the 'amazing' results in backtests were classical overfitting or out of date market inefficiencies. My ML version wanted to be long XIV mostly (go figure). These guys seem to arrive at something similar with better analysis than mine. That's not to say there isn't some signal in that data, but a few decision tree like rules or some linear classifier/regressor isn't going to cut it.
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.
Stevehank
Much of the gains from strategies in the previous link are via UVXY, has anyone implemented a volatility strategy in QC with UVXY?
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.
Thomas Chang
With UVXY? You will short it or long it?
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.
Petter Hansson
Caveat: Shorting UVXY is easy in the same way that being long XIV is "easy" - algos that do either on average will likely work for some time for that reason.
Also, the backtest will not take into account short interest paid and by default IB's leverage limitation (IIRC now effectively cancelling out leverage you get versus XIV) isn't represented.
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.
Stephen Oehler
Be careful about shorting something this volatile. I mentioned this in another post, but: you can not only lose your shirt but also your house by shorting something that has the potential to climb instantly for no reason. XIV has some protections in place to prevent it from climbing too rapidly (if one decides to thumb through the prospectus) but who knows the circumstances in which that would happen.
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.
TurboDZyl
I would like to implement a similar strategy as Alex did above, but selling call spreads or buying put options on UVXY, to limit risk. However if I simply add
option = self.AddOption("UVXY")
in Initialize to be able to trade options, I get the following error once the backtest hits March 20, 2012:
Runtime Error: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: The best overloaded method match for `System.Collections.Generic.KeyValuePair<QuantConnect.Symbol,QuantConnect.Data.BaseData>.KeyValuePair(QuantConnect.Symbol, QuantConnect.Data.BaseData)' has some invalid arguments
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
turboDZyl -- Please avoid necro-posting or thread hijacking. If you have an issue with your specific algorithm post a new discussion and attach the backtest. To reference the original thread post a link to it in your new discussion.
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.
Anthony FJ Garner
Given Quantopian's abandonment of personal automated trading I'm not surprised the refugees come over here. Especially since Python is now possible. What I would really need to trade VIX algorithmically is an automatically generated front month concatenated futures contract also showing spot VIX so as to be able to compute my favoured measure of contango/backwardation.
Although presumably one could just keep taking in the individual front month contract.
The big worry on XIV of course is a termination event. While VXX may seem unlikley to terminate (although I have not checked the prospectus) it is designed to go bust anyway and will just have another price consolidation (reverse split). I guess the bigger worry however is that the managers may not be unable to purchase futures contracts (to rebalance) during a spike in vol since the vast short brigade will be competing to gain cover and reverse their shorts.
Nonetheless a safer route to long XIV may just be deep ITM VXX puts.
I much look forward to working on Quantconnect now it has integrated Python.
I must say that my VIX adventure so far is a simple monthly rebalance between an inverse VIX fund such as XIV and a geared bond fund based on simple inverse volatility. Maximum drawdown on back testing is vastly reduced but of course the low correlation may not hold and XIV may suffer a liquidation event.
However, provided a liquidation event only occurs once in a blue moon, the method should enable one to survive. And you need to be ready with an alternative way to short VIX. Shorting VIX options seems hopeless. I can find little joy there although theoretically of course the options are based on futures. Nonetheless trading monthly VIX puts does not produce anywhere like the performance of a monthly short of the futures front month.
Perhaps I have made an error somewhere.
Anyway, I'm a Quantopian refugee although I have to say I had not been active there for about a year. I suggested they "offer bread today not jam tomorrow" and they seem to have heeded me as regards their competition. Nonetheless Quantopian is of little interest now that you can no longer trade using their framework. Especially since few have interest in the model they want to trade – a very low beta long short US equity approach.
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.
Anthony FJ Garner
No, you can not go back to 1990 by using indices.
While the VIX index itself goes back as far as 1990, futures on the VIX only commenced in 2004 and options in 2006. Without futures there is no contango/backwardation and no XIV or VXX.
The S&P Index on which XIV is basd only goes back 10 years. What you need to do it to use the actual futures contracts to simulate XIV and VXX and you need to interpolate the front ans second month as per the index. The first chart below is the drawdown chart obtained by maintaining a 1x short position in the VIX front month futures contract since 2004. No interpolation applied. The second chart is the drawdown of the S&P 500 VIX Short Term Futures Inverse Daily Index TR since 2007. As you can see the drawdown for XIV in the last crash would have been close to 90%. Not pretty!
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.
Artemiusgreat
My implementation for C#.
The main problem that I see with Pairs Trading is that it's not clear when spread between correlated assets is enough to open positions. Prices of assets are often different and to compare them we need to normalize them, but usually after normalization we cannot compare actual prices because they are measured in abstract units, e.g. logarithms. Will it be enough to compensate commision if divergence is equal to 0.35 or 0.25? In my strategy I tried to use difference between fast and slow MAs, but it's also an approximation, and thus strategy has losses, because when MAs converge it doesn't mean that actual prices converged too.
Idea with RSI proposed by author also looks like an aproximation and also gives loses, maybe someone has a better idea for indicator that can display divergence between correlated assets?
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.
Alex Muci
@Anthony FJ Garner: you're right, I was imprecise - thanks for clarifying here.
Unfortunately, I've just learnt that European retail investors cannot puchase more XIV shares from 1st Jan 2018.
Long explanation: under the coming MIFID 2, the XIV is classified as a PRIIP ("Packaged Retails Investment and Insurance Product") and its issuer must publish a Key Information Document (KID) before private investors can make further purchases (we are, of course, allowed to keep or sell the shares we already own). The issuer of the XIV (Credit Suisse) apparently does not intend to publish a KID and this is the real issue.
I guess this is a good execuse (new regulations) for CS to constraint or limit some recent buying pressure on the ETN.
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.
Anthony FJ Garner
Alex
How about SVXY? I usually register myself as a professional investor - I had better check I did so with IB. I wonder how that affects dealing in the derivatives. Not that there are any in XIVs case but of couse you could always buy VXX puts.
Regulators in general are not the brightes or most constructive of people.
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.
Alex Muci
Anthony.
I don't know about SVXY. I've only received a communication from my pension provider regarding XIV (since in my portfolio), but nothing yet from IB. Perhaps you are right and regulations does not apply to me as professional. Worst case my solution is shorting VX futures - less granular and more risky (since being long XIV had at least the the beaty to have a bound loss, not a luxury you have with short futures).
Definetely something worth checking with IB.
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.
Anthony FJ Garner
Totally agree re shorting the futures - madness. If XIV becomes impossible (and also SVXY) I shall buy VXX puts. If those get banned well....um...its pointless using VIX options. Despite the fact they are linked to the relevant futures contract extracting the contango seems impossible from my back testing. I must triple check my back tester but....The returns using VIX options suck compared to using futures or the futures related ETFs.
Despite my scepticism I have also begun disaster insurance for my short VIX products using LEAPS going out two years, deep OTM. At least its some protection against a complete bust. Its a good strategy but it will be interesting to live throgh the coming shitstorm and survive....
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!