| 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 |
# region imports
from AlgorithmImports import *
# endregion
# ----------------------------------------------------------
STOCKS = ["BTCUSD", "ETHUSD"]
# ----------------------------------------------------------
class NewestAdditions(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2022, 9, 30) # Set Start Date
self.SetCash(100000) # Set Strategy Cash
# These lists are filled out by the universe selection filtering method:
self.ListOfCryptosOlderThan1Y = []
self.ListOfYoungCryptos = [] # contains elements such as { "symbol": "BTCUSD", "age": 2000 }
# FTX universe
self.UniverseSettings.Resolution = Resolution.Daily
self.AddUniverse(CryptoCoarseFundamentalUniverse(Market.FTX, self.UniverseSettings, self.UniverseSelectionFilter))
def UniverseSelectionFilter(self, crypto_coarse):
selectedCryptos = [ x for x in crypto_coarse if x.Symbol not in self.ListOfCryptosOlderThan1Y ]
for crypto in selectedCryptos:
history = self.History([crypto.Symbol], 365, Resolution.Daily)
symbolData = history.loc[crypto.Symbol]
if len(symbolData) >= 365:
self.ListOfCryptosOlderThan1Y.append(crypto.Symbol)
else:
#if any(x['symbol'] == crypto.Symbol for x in self.ListOfYoungCryptos):
for i in range(len(self.ListOfYoungCryptos)):
if self.ListOfYoungCryptos[i]["symbol"] == crypto.Symbol:
del self.ListOfYoungCryptos[i]
break
self.ListOfYoungCryptos.append({"symbol": crypto.Symbol, "age": len(symbolData)})
self.ListOfYoungCryptos.sort(key=lambda x: x.get("age"))
if (len(self.ListOfYoungCryptos) == 0):
self.Debug("No crypto younger than 1Y found")
else:
for crypto in self.ListOfYoungCryptos:
self.Debug(f"Crypto selected: {crypto['symbol']} (age: {crypto['age']})")
return [ x["symbol"] for x in self.ListOfYoungCryptos ]
def OnData(self, data: Slice):
pass