Overall Statistics
Total Trades
11
Average Win
3.12%
Average Loss
0%
Compounding Annual Return
41.184%
Drawdown
4.900%
Expectancy
0
Net Profit
18.699%
Sharpe Ratio
3.555
Probabilistic Sharpe Ratio
91.112%
Loss Rate
0%
Win Rate
100%
Profit-Loss Ratio
0
Alpha
0.136
Beta
0.817
Annual Standard Deviation
0.12
Annual Variance
0.014
Information Ratio
1.278
Tracking Error
0.056
Treynor Ratio
0.522
Total Fees
$14.90
Estimated Strategy Capacity
$48000000.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 = 10000
        
        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