| Overall Statistics |
|
Total Trades 0 Average Win 0% Average Loss 0% Compounding Annual Return 0% Drawdown 0% Expectancy 0 Net Profit 0% Sharpe Ratio 0 Probabilistic Sharpe Ratio 0% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 0 Annual Standard Deviation 0 Annual Variance 0 Information Ratio -3.103 Tracking Error 0.178 Treynor Ratio 0 Total Fees $0.00 |
import decimal
class CboeVix(PythonData):
'''CBOE Vix Download Custom Data Class'''
#use GetSource(SubscriptionDataConfig, DateTime, bool)
def GetSource(self, config, date, datafeed):
url_vix = "http://www.cboe.com/publish/scheduledtask/mktdata/datahouse/vixcurrent.csv"
return SubscriptionDataSource(url_vix,
SubscriptionTransportMedium.RemoteFile)
def Reader(self, config, line, date, datafeed):
if not (line.strip() and line[0].isdigit()): return None
# New CboeVix object
index = CboeVix();
index.Symbol = config.Symbol
try:
# Example File Format:
# Date VIX Open VIX High VIX Low VIX Close
# 01/02/2004 17.96 18.68 17.54 18.22
#print line
data = line.split(',')
date = data[0].split('/')
index.Time = datetime(int(date[2]), int(date[0]), int(date[1]))
index.Value = decimal.Decimal(data[4])
index["Open"] = float(data[1])
index["High"] = float(data[2])
index["Low"] = float(data[3])
index["Close"] = float(data[4])
except ValueError:
# Do nothing
return None
# except KeyError, e:
# print 'I got a KeyError - reason "%s"' % str(e)
return indexfrom my_custom_data import *
class VentralTachyonAtmosphericScrubbers(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2014, 10, 1)
self.SetEndDate(2014, 10, 31)
self.SetCash(500)
self.vixStr = "VIX"
self.AddData(CboeVix, "VIX")
def OnData(self, data):
if self.vixStr not in data:
return
self.Log(f"{data[self.vixStr].Close}")