Overall Statistics |
Total Orders 45 Average Win 2.45% Average Loss -2.10% Compounding Annual Return 3.701% Drawdown 14.700% Expectancy 0.183 Net Profit 15.668% Sharpe Ratio 0.287 Sortino Ratio 0.271 Probabilistic Sharpe Ratio 9.939% Loss Rate 45% Win Rate 55% Profit-Loss Ratio 1.17 Alpha -0.019 Beta 0.474 Annual Standard Deviation 0.059 Annual Variance 0.003 Information Ratio -0.93 Tracking Error 0.063 Treynor Ratio 0.036 Total Fees $45.00 Estimated Strategy Capacity $450000000.00 Lowest Capacity Asset SPY R735QTJ8XC9X Portfolio Turnover 2.17% |
#region imports using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Globalization; using System.Drawing; using QuantConnect; using System.Text.RegularExpressions; using QuantConnect.Algorithm.Framework; using QuantConnect.Algorithm.Framework.Selection; using QuantConnect.Algorithm.Framework.Alphas; using QuantConnect.Algorithm.Framework.Portfolio; using QuantConnect.Algorithm.Framework.Execution; using QuantConnect.Algorithm.Framework.Risk; using QuantConnect.Algorithm.Selection; using QuantConnect.Parameters; using QuantConnect.Benchmarks; using QuantConnect.Brokerages; using QuantConnect.Util; using QuantConnect.Interfaces; using QuantConnect.Algorithm; using QuantConnect.Indicators; using QuantConnect.Data; using QuantConnect.Data.Consolidators; using QuantConnect.Data.Custom; using QuantConnect.DataSource; using QuantConnect.Data.Fundamental; using QuantConnect.Data.Market; using QuantConnect.Data.UniverseSelection; using QuantConnect.Notifications; using QuantConnect.Orders; using QuantConnect.Orders.Fees; using QuantConnect.Orders.Fills; using QuantConnect.Orders.Slippage; using QuantConnect.Scheduling; using QuantConnect.Securities; using QuantConnect.Securities.Equity; using QuantConnect.Securities.Future; using QuantConnect.Securities.Option; using QuantConnect.Securities.Forex; using QuantConnect.Securities.Crypto; using QuantConnect.Securities.Interfaces; using QuantConnect.Storage; using QCAlgorithmFramework = QuantConnect.Algorithm.QCAlgorithm; using QCAlgorithmFrameworkBridge = QuantConnect.Algorithm.QCAlgorithm; #endregion using QuantConnect.DataSource; namespace QuantConnect { public class VixCentralContangoAlgorithm : QCAlgorithm { private Symbol _spy; private Symbol _contango; public override void Initialize() { SetStartDate(2014, 1, 1); SetEndDate(2018, 1, 1); SetCash(25000); _spy = AddEquity("SPY", Resolution.Daily).Symbol; _contango = AddData<VIXCentralContango>("VX", Resolution.Daily).Symbol; } public override void OnData(Slice slice) { var contangoData = slice.Get<VIXCentralContango>(_contango); var ratio = contangoData?.Contango_F2_Minus_F1 ?? 0; if (!Portfolio.Invested && ratio > 0) { MarketOrder(_spy, 100); } else if(ratio < 0) { Liquidate(); } } } }