Overall Statistics
Total Trades
4334
Average Win
0.01%
Average Loss
-0.03%
Compounding Annual Return
25.819%
Drawdown
9.500%
Expectancy
0.086
Net Profit
19.940%
Sharpe Ratio
1.514
Loss Rate
18%
Win Rate
82%
Profit-Loss Ratio
0.32
Alpha
0.208
Beta
-0.058
Annual Standard Deviation
0.13
Annual Variance
0.017
Information Ratio
-0.044
Tracking Error
0.184
Treynor Ratio
-3.355
Total Fees
$4418.91
from Execution.ImmediateExecutionModel import ImmediateExecutionModel
from Portfolio.EqualWeightingPortfolioConstructionModel import EqualWeightingPortfolioConstructionModel

class TransdimensionalResistanceAtmosphericScrubbers(QCAlgorithm):

    def Initialize(self):
        # Set Start Date so that backtest has 5+ years of data
        self.SetStartDate(2019, 1, 1)

        # No need to set End Date as the final submission will be tested
        # up until the review date

        # Set $1m Strategy Cash to trade significant AUM
        self.SetCash(1000000)

        # Add a relevant benchmark, with the default being SPY
        self.AddEquity('SPY', Resolution.Daily)
        self.SetBenchmark('SPY')

        # Use the Alpha Streams Brokerage Model, developed in conjunction with
        # funds to model their actual fees, costs, etc.
        # Please do not add any additional reality modelling, such as Slippage, Fees, Buying Power, etc.
        self.SetBrokerageModel(AlphaStreamsBrokerageModel())

        self.SetExecution(ImmediateExecutionModel())

        self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel())

        self.SetUniverseSelection(TechnologyETFUniverse())

        self.universe = { }
        
        self.Schedule.On(self.DateRules.EveryDay(), self.TimeRules.AfterMarketOpen('SPY', 0), self.ResetTrades)


    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
        '''
        
    
    def ResetTrades(self):
        for symbol, assetData in self.universe.items():
            self.EmitInsights(Insight.Price(symbol, timedelta(1), InsightDirection.Up))
        
    # Initializing ETF Universe Securities
    def OnSecuritiesChanged(self, changes):
        for s in changes.AddedSecurities:
            if s.Symbol not in self.universe:
                self.universe[s.Symbol] = s.Symbol