| Overall Statistics |
|
Total Trades 1484 Average Win 0% Average Loss 0% Compounding Annual Return -91.515% Drawdown 1.600% Expectancy 0 Net Profit -1.343% Sharpe Ratio -5.42 Probabilistic Sharpe Ratio 0% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 1.208 Beta -4.821 Annual Standard Deviation 0.151 Annual Variance 0.023 Information Ratio -6.797 Tracking Error 0.182 Treynor Ratio 0.169 Total Fees $1484.00 |
class ParticleTransdimensionalAutosequencers(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2020, 11, 26)
self.SetEndDate(2020, 11, 27)
self.SetCash(100000)
self.AddEquity("SPY", Resolution.Minute)
self.AddUniverseSelection(CoarseFundamentalUniverseSelectionModel(self.CoarseSelectionFunction))
self.UniverseSettings.Resolution = Resolution.Minute
self.Schedule.On(
self.DateRules.EveryDay("SPY"),
self.TimeRules.At(10, 0),
self.SelectUniverse
)
self.universe = []
self.volume_by_symbol = {}
self.logged = False
def OnData(self, data):
if len(self.volume_by_symbol) == 0:
if not self.logged:
self.logged = True
#self.Log(f"Universe size after volume filter: {len(self.universe)}")
return
for symbol in self.volume_by_symbol.keys():
if data.ContainsKey(symbol) and data[symbol] is not None:
self.volume_by_symbol[symbol] += data[symbol].Volume
def CoarseSelectionFunction(self, coarse):
self.volume_by_symbol = {c.Symbol: 0 for c in coarse if c.Price > 10}
#self.Log(f"Universe size before volume filter: {len(self.volume_by_symbol)}")
return list(self.volume_by_symbol.keys())
def SelectUniverse(self):
self.universe = []
for symbol, volume in self.volume_by_symbol.items():
if volume > 50000:
self.universe.append(symbol)
if self.CurrentSlice.ContainsKey(symbol) and self.CurrentSlice[symbol] is not None:
self.MarketOrder(symbol, 1)
self.volume_by_symbol.clear()
self.logged = False
def OnSecuritiesChanged(self, changes):
self.changes = changes
#self.Log(f"OnSecuritiesChanged({self.Time}):: {changes}")
for security in self.changes.RemovedSecurities:
if security.Invested:
self.Liquidate(security.Symbol)
#
#for security in self.changes.AddedSecurities:
# self.SetHoldings(security.Symbol, 0.18)
#self.Debug("BUY")
#self.Debug(security.Symbol)
#self.Debug(security.Price)
#self.Debug(self.Time)