Overall Statistics
Total Trades
73
Average Win
10.89%
Average Loss
-3.05%
Compounding Annual Return
50.884%
Drawdown
37.200%
Expectancy
0.461
Net Profit
112.735%
Sharpe Ratio
1.036
Probabilistic Sharpe Ratio
40.186%
Loss Rate
68%
Win Rate
32%
Profit-Loss Ratio
3.57
Alpha
0.468
Beta
-0.086
Annual Standard Deviation
0.457
Annual Variance
0.208
Information Ratio
0.742
Tracking Error
0.711
Treynor Ratio
-5.503
Total Fees
$0.00
Estimated Strategy Capacity
$12000000.00
Lowest Capacity Asset
BTCUSD XJ
Portfolio Turnover
19.37%
# region imports
from AlgorithmImports import *
# endregion

class HipsterFluorescentPinkMule(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2021, 9, 1)  # Set Start Date
        self.SetEndDate(2023, 7, 1)
        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)