Back

Easy Volatility Trading - unable to get this to run

Hi - following earlier discussions I have added addiional lines to the code samples but this still does not seem to run. I am new to the platform so may be missing something straightforward - any suggestions welcome on how to get this to run thank you.

 

namespace QuantConnect
{
////ADDED THIS SECTION
public class QuandlVix : Quandl {
public QuandlVix() : base(valueColumnName: "vix close") { }
}


public class VixBug : QCAlgorithm
{
decimal vix;
decimal vxv;
decimal vx1;
public override void Initialize()
{
// backtest parameters
SetStartDate(2018, 1, 1);
SetEndDate(DateTime.Now);

// cash allocation
SetCash(100000);



//AddData<Quandl>("CBOE/VIX");
AddData<Quandl>("CBOE/VXV");
AddData<Quandl>("CHRIS/CBOE_VX1");
////ADDED LINE BELOW
AddData<QuandlVix>("CBOE/VIX");
}

public override void OnData(Slice data)
{

}

public void OnData(Quandl data)
{
if (data.Symbol=="CBOE/VIX")
{
vix=data.Value;
Log("VIX="+vix.ToString());
}
if (data.Symbol=="CBOE/VXV")
{
vxv=data.Value;
Log("VXV="+vxv.ToString());
}
if (data.Symbol=="CHRIS/CBOE_VX1")
{
vx1=data.Value;
Log("VX1="+vx1.ToString());
}
}
}
}

 

Update Backtest







0

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.


Hi  Alexandre Catarino and Warren Harding I have followed your code examples but I am not sure why the backtest will not run so wanted to ask if I needed a seperate account with Quandl in order for this code to run?

0

Hi Warren,

The code above runs as expected. See the attached backtest and plots for reference.

Best,
Derek Melchin

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.


Thanks for your help on this Derek - that runs ok!

0

Update Backtest





0

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.


Loading...

This discussion is closed