Overall Statistics
Total Trades
114
Average Win
0.11%
Average Loss
-0.31%
Compounding Annual Return
-17.628%
Drawdown
14.900%
Expectancy
-0.251
Net Profit
-1.677%
Sharpe Ratio
-0.676
Probabilistic Sharpe Ratio
25.997%
Loss Rate
45%
Win Rate
55%
Profit-Loss Ratio
0.35
Alpha
0.163
Beta
1.094
Annual Standard Deviation
0.53
Annual Variance
0.281
Information Ratio
0.347
Tracking Error
0.342
Treynor Ratio
-0.328
Total Fees
$219971.59
Estimated Strategy Capacity
$16000.00
Lowest Capacity Asset
TRXBTC 10B
from AlgorithmImports import *

class CoinAPIDataAlgorithm(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2020, 6, 1)
        self.SetEndDate(2020, 7, 1)
        self.SetCash(100000)
        self.SetCash("BTC", 1000)

        # Kraken accepts both Cash and Margin type account.
        self.SetBrokerageModel(BrokerageName.Kraken, 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.Kraken, 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(crypto_coarse, 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")