Overall Statistics
Total Trades
1588
Average Win
0.23%
Average Loss
-0.11%
Compounding Annual Return
14.032%
Drawdown
20.300%
Expectancy
0.358
Net Profit
54.651%
Sharpe Ratio
1.07
Loss Rate
55%
Win Rate
45%
Profit-Loss Ratio
2.01
Alpha
0.156
Beta
-0.779
Annual Standard Deviation
0.131
Annual Variance
0.017
Information Ratio
0.917
Tracking Error
0.131
Treynor Ratio
-0.18
Total Fees
$1619.97
import numpy as np

class spxsSPXLAlgo(QCAlgorithm):

    def Initialize(self):
        
        self.SetStartDate(2016,1, 1) # Set Start Date
        self.SetCash(100000)         # Set Strategy Cash

        # Define the security universe
        self.tickers = ["SPXS","SPXL"]
        for symbol in self.tickers:
            self.AddEquity(symbol, Resolution.Daily)
        

    def OnData(self, data):
            # Rebalance portfolio daily
            for symbol in self.tickers:
                if symbol=="SPXS":
                    self.SetHoldings(symbol,-2/3)
                else:
                    self.SetHoldings(symbol,-1/3)