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 -1.375 Tracking Error 0.147 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 |
from datetime import date, timedelta, datetime import numpy as np import json from QuantConnect.Data import SubscriptionDataSource from QuantConnect.Python import PythonData class CalculatingGreenGiraffe(QCAlgorithm): def Initialize(self): self.SetStartDate(2021, 1, 1) # Set Start Date self.SetEndDate(2021, 3, 21) self.SetCash(100000) # Set Strategy Cash self.testSymbol = self.AddData(Fbsox, "D_FBSOX", Resolution.Daily).Symbol def OnData(self, data): if not data.ContainsKey("D_FBSOX"): return bar = data['D_FBSOX'] self.Debug(str(bar.Value) + " " + str(bar.Time)) if not self.Portfolio.Invested: self.SetHoldings(self.testSymbol, 1) class Fbsox(PythonData): def GetSource(self, config, date, isLiveMode): return SubscriptionDataSource("https://www.dropbox.com/s/4s1gy1n9ziwdprn/fbsox.csv?dl=1", SubscriptionTransportMedium.RemoteFile); def Reader(self, config, line, date, isLiveMode): if not (line.strip() and line[0].isdigit()): return None symbolIndex = Fbsox() symbolIndex.Symbol = config.Symbol try: data = line.split(',') value = data[4] if value == 0: return None symbolIndex.Time = datetime.strptime(data[0][0:8], "%Y%m%d") symbolIndex.EndTime = symbolIndex.Time + timedelta(days=1) symbolIndex.Value = value symbolIndex["Open"] = float(data[1]) symbolIndex["High"] = float(data[2]) symbolIndex["Low"] = float(data[3]) symbolIndex["Close"] = float(data[4]) except ValueError: return None return symbolIndex