Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
79228162514264337593543950335%
Drawdown
11.700%
Expectancy
0
Net Profit
1718.611%
Sharpe Ratio
7.932
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
1387.097
Beta
-17050.917
Annual Standard Deviation
137.789
Annual Variance
18985.914
Information Ratio
7.932
Tracking Error
137.79
Treynor Ratio
-0.064
Total Fees
$235.27
from System import * # CLR namespaces to be treatedas Python packages
from QuantConnect import *
from QuantConnect.Algorithm import *
from QuantConnect.Python import PythonQuandl
from datetime import datetime, timedelta
from decimal import Decimal
import numpy as np

class VolPySplit(QCAlgorithm):

    def Initialize(context):

        context.SetStartDate(2018, 6, 7)
        context.SetEndDate(2018, 6, 12)
        context.SetCash(100000)

        context.SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage, AccountType.Margin)

        # add the #2 ETFs (short and long VIX futures)
        context.L1 = context.AddEquity("TVIX", Resolution.Minute).Symbol


        context.Schedule.On(context.DateRules.On(2018, 6, 7),
                context.TimeRules.At(10,00),
                Action(context.buy_stock))

        context.Schedule.On(context.DateRules.On(2018, 6, 12),
                context.TimeRules.At(10,00),
                Action(context.log_data))

    def buy_stock(context):
        context.SetHoldings(context.L1, 100)
        context.Log("{0} bought {1} at ${2}".format(context.L1, context.Portfolio[context.L1].Quantity, context.Portfolio[context.L1].AveragePrice))


    def log_data(context):
        context.Log("{0} currently holds {1} at ${2}".format(context.L1, context.Portfolio[context.L1].Quantity, context.Securities['TVIX'].Price))