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.781 Tracking Error 0.367 Treynor Ratio 0 Total Fees $0.00 |
class CalibratedVentralCircuit(QCAlgorithm): def Initialize(self): self.SetStartDate(2020, 3, 13) # Set Start Date self.SetCash(100000) # Set Strategy Cash tickers = ['SPY', 'BND'] symbols = [ Symbol.Create(ticker, SecurityType.Equity, Market.USA) for ticker in tickers ] self.AddUniverseSelection( ManualUniverseSelectionModel(symbols) ) # Add Liquid Universe self.SetAlpha(MyAlphaModel()) self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel()) self.SetExecution(ImmediateExecutionModel()) class MyAlphaModel(AlphaModel): spy = None spy_sma = None bnd = None liquid_symbols = [] def Update(self, algorithm, data): # if spy > spy_sma: # emit insights for the liquid symbols # else: # emit insight for BND return [] def OnSecuritiesChanged(self, algorithm, changes): for security in changes.AddedSecurities: ticker = str(security.Symbol).split()[0] if ticker == 'SPY': self.spy = security.Symbol # Setup spy SMA # Warm up spy SMA elif ticker == 'BND': self.bnd = security.Symbol else: pass # Add symbol to liquid symbols list for security in changes.RemovedSecurities: pass # remove symbol from liquid symbols list