Overall Statistics |
Total Trades 0 Average Win 0% Average Loss 0% Compounding Annual Return 0% Drawdown 0% Expectancy 0 Net Profit 0% Sharpe Ratio NaN Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 0 Annual Standard Deviation 0 Annual Variance 0 Information Ratio NaN Tracking Error NaN Treynor Ratio NaN Total Fees $0.00 |
namespace QuantConnect { /* * QuantConnect University: Futures Example * * QuantConnect allows importing generic data sources! This example demonstrates importing a futures * data from the popular open data source Quandl. * * QuantConnect has a special deal with Quandl giving you access to Stevens Continuous Futurs (SCF) for free. * If you'd like to download SCF for local backtesting, you can download it through Quandl.com. */ public class VolatilityETN : QCAlgorithm { string shortTerm = "VXX"; string longTerm = "VXZ"; decimal IVTS = new decimal(); string VIX = "YAHOO/INDEX_VIX"; string VXV = "CBOEFE/INDEX_VXV"; DateTime sampledToday = DateTime.Now; //Initialize the data and resolution you require for your strategy: public override void Initialize() { SetStartDate(2004, 1, 1); SetEndDate(DateTime.Now.Date.AddDays(-1)); SetCash(25000); AddSecurity(SecurityType.Equity, shortTerm, Resolution.Minute); AddSecurity(SecurityType.Equity, longTerm, Resolution.Minute); AddData<Quandl>(VXV, Resolution.Daily); AddData<Quandl>(VIX, Resolution.Daily); } /// <summary> /// Event - v3.0 DATA EVENT HANDLER: Basic template for user to override for receiving all subscription data in a single event /// </summary> /// <code> /// TradeBars bars = slice.Bars; /// Ticks ticks = slice.Ticks; /// TradeBar spy = slice["SPY"]; /// List<Tick> aaplTicks = slice["AAPL"] /// Quandl oil = slice["OIL"] /// dynamic anySymbol = slice[symbol]; /// DataDictionary<Quandl> allQuandlData = slice.Get<Quand> /// Quandl oil = slice.Get<Quandl>("OIL") /// </code> /// <param name="slice">The current slice of data keyed by symbol string</param> public void OnData(Slice data) { // gets all Quandl data from our 'Slice' object var quandls = data.Get<Quandl>(); if (!quandls.ContainsKey(VIX) || !quandls.ContainsKey(VXV)) return; // add logic to have orders placed once / day // IVTS = VIX / VXV IVTS = quandls[VIX].Value / quandls[VXV].Value; // Add buy/sell logic } } }