Overall Statistics
Total Trades
4074
Average Win
0.02%
Average Loss
-0.01%
Compounding Annual Return
15.003%
Drawdown
24.100%
Expectancy
2.616
Net Profit
106.633%
Sharpe Ratio
0.922
Probabilistic Sharpe Ratio
42.341%
Loss Rate
12%
Win Rate
88%
Profit-Loss Ratio
3.11
Alpha
0.128
Beta
-0.038
Annual Standard Deviation
0.134
Annual Variance
0.018
Information Ratio
0.135
Tracking Error
0.184
Treynor Ratio
-3.229
Total Fees
$4105.12
class StarterV0(QCAlgorithm):
    def Initialize(self):
        self.SetStartDate(2014, 11, 1)
        self.SetCash(1e6)
        self.AddEquity('AAPL')
        self.AddEquity('SPY')
        self.SetBenchmark('SPY')
        self.SetBrokerageModel(AlphaStreamsBrokerageModel())
        self.SetExecution(ImmediateExecutionModel())
        self.SetPortfolioConstruction(InsightWeightingPortfolioConstructionModel())
        self.UniverseSettings.Resolution = Resolution.Minute
        self.universe = {}
        
        self.Schedule.On(self.DateRules.EveryDay('SPY'),
                         self.TimeRules.AfterMarketOpen('SPY', 10),    
                         self.Daily)
                         
    def Daily(self):
        insights = []
        
        for symbol, symbolData in self.universe.items():
            insights.append(Insight.Price(symbol, timedelta(days=7), InsightDirection.Up,
                            None, None, None, symbolData.weight))
        
        self.EmitInsights(insights)

    def OnSecuritiesChanged(self, changes):
        symbols = [x.Symbol for x in changes.AddedSecurities]
        for symbol in symbols: self.universe[symbol] = Symbol(symbol, self)

class Symbol:
    def __init__(self, symbol, alg):
        self.symbol = symbol
        if symbol.Value == 'AAPL': self.weight = 0.25
        elif symbol.Value == 'SPY': self.weight = 0.75