Overall Statistics
Total Trades
434
Average Win
0.13%
Average Loss
-0.03%
Compounding Annual Return
10.089%
Drawdown
25.000%
Expectancy
3.779
Net Profit
78.094%
Sharpe Ratio
0.847
Probabilistic Sharpe Ratio
31.771%
Loss Rate
2%
Win Rate
98%
Profit-Loss Ratio
3.90
Alpha
0.075
Beta
0.244
Annual Standard Deviation
0.13
Annual Variance
0.017
Information Ratio
-0.188
Tracking Error
0.185
Treynor Ratio
0.453
Total Fees
$5844.62
import numpy as np

syms = ['NXN', 'INSI', 'BKT']

class MultidimensionalModulatedRegulators(QCAlgorithm):
    def Initialize(self):
        self.SetStartDate(2015, 1, 1)
        self.SetCash(1000000)
        self.SetExecution(VolumeWeightedAveragePriceExecutionModel())
 
        self.symbols = []
        for i in range(len(syms)):
            self.symbols.append(Symbol.Create(syms[i], SecurityType.Equity, Market.USA))
            self.Debug(syms[i])
            
        self.SetUniverseSelection( ManualUniverseSelectionModel(self.symbols) )
        self.UniverseSettings.Resolution = Resolution.Hour
        
        self.AddEquity('SPY', Resolution.Hour)
        self.SetBenchmark('SPY')

        self.SetBrokerageModel(AlphaStreamsBrokerageModel())
        
        self.constant_weights = np.array([0.09424385, 0.21781130, 0.68794489])

        self.constant_weights /= np.sum(np.abs(self.constant_weights))
        self.leverage = 1.9

    def OnData(self, data):
                
        rebalance = False
        
        if self.Portfolio.TotalHoldingsValue > 0:
            total = 0.0
            for i, sym in enumerate(self.symbols):
                curr = (self.Securities[sym].Holdings.HoldingsValue/self.Portfolio.TotalHoldingsValue)
                diff = self.constant_weights[i] - curr
                total += np.abs(diff)
                
            if total > 0.01: 
                rebalance = True

        if rebalance or (not self.Portfolio.Invested):
            for i, sym in enumerate(self.symbols):
                if self.constant_weights[i] != 0:
                    self.SetHoldings(sym, self.constant_weights[i] * self.leverage)