Overall Statistics
Total Trades
171
Average Win
3.12%
Average Loss
0%
Compounding Annual Return
40.852%
Drawdown
4.900%
Expectancy
0
Net Profit
18.560%
Sharpe Ratio
3.531
Probabilistic Sharpe Ratio
90.912%
Loss Rate
0%
Win Rate
100%
Profit-Loss Ratio
0
Alpha
0.133
Beta
0.817
Annual Standard Deviation
0.12
Annual Variance
0.014
Information Ratio
1.216
Tracking Error
0.056
Treynor Ratio
0.519
Total Fees
$172.77
Estimated Strategy Capacity
$1700000.00
Lowest Capacity Asset
SPY R735QTJ8XC9X
class JumpingFluorescentYellowDolphin(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2021, 1, 12)
        self.SetCash(100000) 
        self.AddEquity("SPY", Resolution.Minute)
        
        self.Schedule.On(self.DateRules.MonthStart("SPY"),
                 self.TimeRules.AfterMarketOpen("SPY"),
                 self.BuySpy)
        
        self.Schedule.On(self.DateRules.MonthEnd("SPY"),
                 self.TimeRules.AfterMarketOpen("SPY"),
                 self.SellSpy)
        
    def BuySpy(self):
        max_num_per_batch = 10
        
        q = int(self.CalculateOrderQuantity("SPY", 1.0))
        
        n_groups = q // max_num_per_batch
        remainder = q - n_groups*max_num_per_batch
        
        for i in range(n_groups):
            self.MarketOrder("SPY",max_num_per_batch)
        self.MarketOrder("SPY",remainder)
        
    
    def SellSpy(self):
        self.Liquidate("SPY")

    def OnData(self, data):
        pass