| Overall Statistics |
|
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return -92.001% Drawdown 12.800% Expectancy 0 Net Profit -3.846% Sharpe Ratio -7.486 Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 2.105 Beta -262.275 Annual Standard Deviation 0.323 Annual Variance 0.104 Information Ratio -7.516 Tracking Error 0.324 Treynor Ratio 0.009 Total Fees $11.76 |
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, 1)
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))