Overall Statistics
Total Orders
45
Average Win
2.44%
Average Loss
-2.09%
Compounding Annual Return
3.690%
Drawdown
14.600%
Expectancy
0.183
Start Equity
25000
End Equity
28904.65
Net Profit
15.619%
Sharpe Ratio
0.286
Sortino Ratio
0.27
Probabilistic Sharpe Ratio
9.939%
Loss Rate
45%
Win Rate
55%
Profit-Loss Ratio
1.17
Alpha
-0.019
Beta
0.473
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.16%
from AlgorithmImports import *
from QuantConnect.DataSource import *

class VixCentralContangoAlgorithm (QCAlgorithm):

    def initialize(self) -> None:

        self.set_start_date(2014,1,1) 
        self.set_end_date(2018,1,1)  
        self.set_cash(25000)

        self.spy = self.add_equity("SPY", Resolution.DAILY).symbol
        self.contango = self.add_data(VIXCentralContango, "VX", Resolution.DAILY).symbol

    def on_data(self, slice: Slice) -> None:

        contango_data = slice.Get(VIXCentralContango, self.contango)
        ratio = contango_data.contango_f2_minus_f1 if contango_data else 0
            
        if not self.portfolio.invested and ratio > 0:
            self.market_order(self.spy, 100)
        elif ratio < 0:
            self.liquidate()