| 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.415 Tracking Error 0.086 Treynor Ratio 0 Total Fees $0.00 |
from datetime import datetime
class AWSData(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2020, 12, 1) # Set Start Date
self.SetEndDate(2020, 12, 31)
self.SetCash(10000) # Set Strategy Cash
self.assets = ["VMVL"]
for etf in self.assets:
symbol = self.AddData(AWSImport, etf, Resolution.Daily).Symbol
self.Log(str.format("{0} data was added with symbol {1}.", etf, symbol.Value))
def OnData(self, data):
'''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
Arguments:
data: Slice object keyed by symbol containing the stock data
'''
for asset in self.assets:
if not data.ContainsKey(asset):
self.Log("Asset key not found in data slice.")
return
if data[asset] is not None:
self.Log("Asset data slice empty.")
return
self.Log(data[asset].Value)
self.SetHoldings("VMVL", 0.8)
class AWSImport(PythonData):
'''Custom Data Class to import prepared AWS data'''
def GetSource(self, config, date, isLiveMode):
cids = {"VMVL": 986914,
"IMIE": 45820,
"LRUS": 47592,
"XD3E": 38681,
"IS3S": 959560,
"IUSN": 1123006}
requrl = str.format("https://v78wgv6s66.execute-api.us-east-2.amazonaws.com/test/get_data_from_investing?cid={0}&ticker={1}&start_date={2}&end_date={3}&resolution={4}",
cids[config.Symbol.Value],
config.Symbol.Value,
str.format("{0}/{1}/{2}", date.month, date.day, date.year),
str.format("{0}/{1}/{2}", date.month, date.day+1, date.year),
"Daily")
return SubscriptionDataSource(requrl, SubscriptionTransportMedium.Rest)
def Reader(self, config, line, date, isLiveMode):
# New AWSImport object
index = AWSImport()
index.Symbol = config.Symbol
try:
data = line.split(';')
index.Time = datetime.strptime(data[0], "%b %d, %Y")
index.Value = float(data[1])
index["Close"] = float(data[1])
index["Open"] = float(data[2])
index["High"] = float(data[3])
index["Low"] = float(data[4])
index["Volume"] = float(data[5][:-1])*1000
index["Dailyreturn"] = float(data[6][:-1]) / 100
except ValueError:
return None
return index