| Overall Statistics |
|
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return -98.323% Drawdown 100.000% Expectancy 0 Net Profit -5.093% Sharpe Ratio -18.845 Probabilistic Sharpe Ratio 0% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha -1.754 Beta -2.541 Annual Standard Deviation 0.052 Annual Variance 0.003 Information Ratio -9.285 Tracking Error 0.072 Treynor Ratio 0.384 Total Fees $33.97 |
class FormalYellowGreenDogfish(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2007, 4, 20) # Set Start Date
self.SetEndDate(2007, 4, 24)
self.SetCash(100000) # Set Strategy Cash
symbols = [Symbol.Create(ticker, SecurityType.Equity, Market.USA) for ticker in ["EWA", "EPP"]]
self.SetUniverseSelection(ManualUniverseSelectionModel(symbols))
self.AddAlpha(MyAlpha())
self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel(lambda x: None))
self.SetExecution(ImmediateExecutionModel())
class MyAlpha(AlphaModel):
symbols = []
called = False
def Update(self, algorithm, data):
algorithm.Plot("Equity", "Value", algorithm.Portfolio.TotalPortfolioValue)
for symbol in self.symbols:
if data.ContainsKey(symbol) and data[symbol] is not None:
algorithm.Plot("Price", symbol, data[symbol].Price)
if not self.called:
self.called = True
insights = []
for symbol in self.symbols:
if symbol.Value == 'EWA':
algorithm.Debug(f"Up for {symbol}")
insights.append(Insight.Price(symbol, timedelta(days=30), InsightDirection.Up))
return insights
return []
def OnSecuritiesChanged(self, algorithm, changes):
for security in changes.AddedSecurities:
self.symbols.append(security.Symbol)