| Overall Statistics |
|
Total Trades 97 Average Win 1.04% Average Loss -1.07% Compounding Annual Return -77.710% Drawdown 25.000% Expectancy -0.230 Net Profit -12.271% Sharpe Ratio -1.424 Probabilistic Sharpe Ratio 11.731% Loss Rate 61% Win Rate 39% Profit-Loss Ratio 0.97 Alpha -0.32 Beta 0.895 Annual Standard Deviation 0.524 Annual Variance 0.275 Information Ratio -0.664 Tracking Error 0.407 Treynor Ratio -0.835 Total Fees $541319.47 Estimated Strategy Capacity $0 Lowest Capacity Asset VETBTC 18N |
from AlgorithmImports import *
class CoinAPIDataAlgorithm(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2020, 6, 1)
self.SetEndDate(2020, 7, 1)
self.SetCash("BUSD", 100000)
self.SetCash("BTC", 1000)
# Kraken accepts both Cash and Margin type account.
self.SetBrokerageModel(BrokerageName.Binance, AccountType.Margin)
# 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.Binance, 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")