Overall Statistics |
Total Orders 0 Average Win 0% Average Loss 0% Compounding Annual Return 0% Drawdown 0% Expectancy 0 Start Equity 100000 End Equity 100000 Net Profit 0% Sharpe Ratio 0 Sortino 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.447 Tracking Error 0.149 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset Portfolio Turnover 0% |
# region imports from AlgorithmImports import * import pandas as pd # end region class FeaturesDataframeExample(QCAlgorithm): def initialize(self): self.set_start_date(2022, 1, 1) self.set_cash(100000) #self.settings.daily_precise_end_time = True self.lookback = 252 self.spy = self.add_equity("SPY", Resolution.DAILY).symbol self.spy_window = RollingWindow[TradeBar](self.lookback) self.consolidate(self.spy, Resolution.DAILY, lambda bar: self.spy_window.add(bar)) self.spy_rsi = self.rsi(self.spy, 15, resolution=Resolution.DAILY) self.spy_rsi.window.size = self.lookback self.spy_bb = self.bb(self.spy, 30, 2, resolution=Resolution.DAILY) self.spy_bb.window.size = self.lookback self.schedule.on( self.date_rules.every_day(self.spy), self.time_rules.after_market_open(self.spy,-30), self.gen_features) self.set_warm_up(self.lookback, Resolution.DAILY) def gen_features(self): if self.is_warming_up: return df = pd.concat( [ # OHLC self.pandas_converter.get_data_frame[TradeBar](self.spy_window).loc[self.spy], # Indicators self.pandas_converter.get_indicator_data_frame( { 'rsi': list(self.spy_rsi.window), 'bb': list(self.spy_bb.window), }) ], axis=1).dropna() return df