| Overall Statistics |
|
Total Trades 99 Average Win 0.13% Average Loss -0.38% Compounding Annual Return -97.107% Drawdown 33.600% Expectancy -0.382 Net Profit -27.260% Sharpe Ratio -1.726 Probabilistic Sharpe Ratio 1.271% Loss Rate 54% Win Rate 46% Profit-Loss Ratio 0.34 Alpha -0.204 Beta 2.319 Annual Standard Deviation 0.527 Annual Variance 0.278 Information Ratio -1.366 Tracking Error 0.443 Treynor Ratio -0.392 Total Fees $799716.59 Estimated Strategy Capacity $10000.00 Lowest Capacity Asset LRCBTC 2S7 |
from AlgorithmImports import *
class CoinAPIDataAlgorithm(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2022, 1, 1)
self.SetEndDate(2022, 2, 1)
self.SetCash(100000)
self.SetCash("BTC", 1000)
# Warm up the security with the last known price to avoid conversion error
self.SetSecurityInitializer(lambda security: security.SetMarketPrice(self.GetLastKnownPrice(security)))
self.UniverseSettings.Resolution = Resolution.Daily
# Add universe selection of cryptos based on coarse fundamentals
self.AddUniverse(CryptoCoarseFundamentalUniverse(Market.BinanceUS, self.UniverseSettings, self.UniverseSelectionFilter))
self.AddAlpha(ConstantAlphaModel(InsightType.Price, InsightDirection.Up, timedelta(days=1), 0.025, None))
self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel())
def UniverseSelectionFilter(self, crypto_coarse):
return [d.Symbol for d in sorted([x for x in crypto_coarse if x.VolumeInUsd], key=lambda x: x.VolumeInUsd, reverse=True)[:5]]
def OnSecuritiesChanged(self, changes):
for security in changes.AddedSecurities:
# Historical data
history = self.History(security.Symbol, 30, Resolution.Daily)
self.Debug(f"We got {len(history)} items from our history request")