Overall Statistics
Total Trades
36
Average Win
0%
Average Loss
0%
Compounding Annual Return
42.508%
Drawdown
17.200%
Expectancy
0
Net Profit
183.848%
Sharpe Ratio
1.888
Probabilistic Sharpe Ratio
94.426%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0.235
Beta
0.295
Annual Standard Deviation
0.155
Annual Variance
0.024
Information Ratio
0.512
Tracking Error
0.194
Treynor Ratio
0.989
Total Fees
$36.00
Estimated Strategy Capacity
$96000.00
Lowest Capacity Asset
BTC TLQHZ0DZBGPX
from math import trunc
class DynamicParticleComputer(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2019, 1, 1)  # Set Start Date
        self.SetEndDate(2021, 12, 12)
        self.SetCash(3000)  # Set Strategy Cash
        self.AddEquity("BTC", Resolution.Daily)
        self.time_to_add = self.Time.month

    def OnData(self, data):
        if not self.Portfolio.Invested:
            shares = 100 / data['BTC'].Close
            self.MarketOrder("BTC", trunc(shares))
        
        if data.Bars.ContainsKey("BTC"):
            self.Log(f'Portfolio Cash: {self.Portfolio.Cash}')
            if self.time_to_add != self.Time.month:
                self.Log('Adding $100 to portfolio')
                # Add cash
                self.Portfolio.SetCash(self.Portfolio.Cash + 100)
                # Place order
                shares = 100 / data['BTC'].Close
                self.MarketOrder("BTC", trunc(shares))
                self.time_to_add = self.Time.month