Overall Statistics
Total Trades
21
Average Win
12.94%
Average Loss
-4.22%
Compounding Annual Return
97.009%
Drawdown
25.700%
Expectancy
1.033
Net Profit
181.881%
Sharpe Ratio
1.744
Probabilistic Sharpe Ratio
67.374%
Loss Rate
50%
Win Rate
50%
Profit-Loss Ratio
3.07
Alpha
0.754
Beta
0.012
Annual Standard Deviation
0.432
Annual Variance
0.186
Information Ratio
1.277
Tracking Error
0.673
Treynor Ratio
65.061
Total Fees
$0.00
Estimated Strategy Capacity
$780000.00
Lowest Capacity Asset
BTCUSD XJ
# region imports
from AlgorithmImports import *
# endregion

class HipsterFluorescentPinkMule(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2021, 8, 1)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash
        self.symbol = self.AddCrypto("BTCUSD", Resolution.Daily).Symbol
        self.EnableAutomaticIndicatorWarmUp = True
        self.mom = self.MOMP(self.symbol, int(self.GetParameter("lookback")), Resolution.Daily)
        self.dataset_symbol = self.AddData(RegalyticsRegulatoryArticles, "REG").Symbol
        self.SetBenchmark(self.symbol)

    def OnData(self, slice: Slice) -> None:
        # Parse articles
        if not slice.ContainsKey(self.dataset_symbol):
            return
        found = 0
        articles = slice[self.dataset_symbol]
        for article in articles:
            if "Crypto" in article.Title or "Crypto" in article.Summary:
                found += 1
        if found == 0:
            return
        if self.mom.Current.Value > 0 and not self.Portfolio[self.symbol].IsLong:
            self.SetHoldings(self.symbol, 1)
        if self.mom.Current.Value < 0 and not self.Portfolio[self.symbol].IsShort:
            self.SetHoldings(self.symbol, -1)