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 0 Tracking Error 0 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset |
import numpy as np class BotSetUp(QCAlgorithm): def Initialize(self): self.SetStartDate(2020, 1, 1) self.SetCash(10000) FinvizSymbols = ("CLPS", "JOB", "MYMD", "SPY") #however we decide to get our universe self.indicators_by_symbols = {} self.SetWarmup(365, Resolution.Daily) for symbol in FinvizSymbols: sym = self.AddEquity(symbol, Resolution.Daily).Symbol self.indicators_by_symbols[sym] = SymbolData(self,sym) def OnData(self, data): for symbol, value in self.indicators_by_symbols.items(): if not self.indicators_by_symbols[symbol].year_min.IsReady: return holdings = self.Portfolio[symbol].Quantity profit = self.Portfolio[symbol].UnrealizedProfit tpv = self.Portfolio.TotalPortfolioValue price = self.Securities[symbol].Price close = self.Securities[symbol].Close yrmn = value.year_min.Current.Value yrmx = value.year_max.Current.Value mthmx = value.month_max.Current.Value self.Quit(f"Year minimum for {symbol} is {yrmn} and occurred on the bar stamped with date {value.historical_dates[value.year_min.PeriodsSinceMinimum]}") class SymbolData: def __init__(self, algorithm, symbol): self.symbol = symbol self.historical_dates = np.array([]) self.year_min = Minimum(365) self.year_max = Maximum(365) self.month_max = Maximum(30) DailyConsolidator = TradeBarConsolidator(1) DailyConsolidator.DataConsolidated += self.DailyHandler algorithm.SubscriptionManager.AddConsolidator(self.symbol, DailyConsolidator) def DailyHandler(self,sender,Bar): self.year_min.Update(Bar.Time,Bar.Low) self.year_max.Update(Bar.Time,Bar.High) self.month_max.Update(Bar.Time,Bar.High) self.historical_dates = np.append(Bar.Time.date(), self.historical_dates)[:365]