Overall Statistics
Total Trades
338
Average Win
0.36%
Average Loss
-0.37%
Compounding Annual Return
234.152%
Drawdown
68.700%
Expectancy
0.417
Net Profit
84.290%
Sharpe Ratio
3.387
Probabilistic Sharpe Ratio
66.779%
Loss Rate
28%
Win Rate
72%
Profit-Loss Ratio
0.98
Alpha
3.073
Beta
-0.401
Annual Standard Deviation
0.898
Annual Variance
0.806
Information Ratio
2.834
Tracking Error
1.044
Treynor Ratio
-7.584
Total Fees
$345.99
from Execution.ImmediateExecutionModel import ImmediateExecutionModel

class ParticleQuantumFlange(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2019, 12, 2)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash
        
        self.tickers = ["SPY", "TSLA", "UBER"]
        self.symbols = [ Symbol.Create(t, SecurityType.Equity, Market.USA) for t in self.tickers]
        
        self.SetUniverseSelection( ManualUniverseSelectionModel(self.symbols) )
        self.UniverseSettings.Resolution = Resolution.Daily
        
        self.AddAlpha(MyAlphaModel(self))
        
        self.SetPortfolioConstruction(MyPCM())
        
        self.SetExecution(ImmediateExecutionModel())
        

    def OnData(self, data):
        pass

class MyPCM(InsightWeightingPortfolioConstructionModel):
    leverage = 0.5
    
    def CreateTargets(self, algorithm, insights):
        targets = super().CreateTargets(algorithm, insights)
        return [PortfolioTarget(x.Symbol, x.Quantity*(1+self.leverage)) for x in targets]   
    

class MyAlphaModel(AlphaModel):
    
    def __init__(self, algorithm):
        self.algo = algorithm
    
    def Update(self, algorithm, data):
        insights = []
        
        for ticker in self.algo.tickers:
            insight = Insight.Price(ticker, timedelta(1), InsightDirection.Up, None, None, None, 1)
            insights.append(insight)
                
        return insights
    
    def OnSecuritiesChanged(self, algorithm, changes):
        pass