Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
4.347%
Drawdown
9.700%
Expectancy
0
Net Profit
2.157%
Sharpe Ratio
0.303
Probabilistic Sharpe Ratio
27.646%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
-0
Beta
0.997
Annual Standard Deviation
0.119
Annual Variance
0.014
Information Ratio
-0.375
Tracking Error
0
Treynor Ratio
0.036
Total Fees
$1.14
Estimated Strategy Capacity
$360000000.00
Lowest Capacity Asset
SPY R735QTJ8XC9X
class FormalBlackBear(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2021, 8, 6)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash
        
        self.leverage = 20/3     # e.g. leverage of 6.667
        
        # Set custom security initializer.
        self.SetSecurityInitializer(self.CustomSecurityInitializer)
        
        self.AddEquity("SPY", Resolution.Daily)


    def OnData(self, data):
        '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
            Arguments:
                data: Slice object keyed by symbol containing the stock data
        '''

        if not self.Portfolio.Invested:
            self.SetHoldings("SPY", 1)
            
        self.Plot("Remaining Buying Power", "Remaining Buying Power", self.Portfolio.MarginRemaining * self.leverage)
        
    def CustomSecurityInitializer(self, security):
        # Set custom leverage for each security added into the universe.
        security.SetLeverage(self.leverage)