Overall Statistics
Total Trades
31
Average Win
0.02%
Average Loss
-0.97%
Compounding Annual Return
-99.695%
Drawdown
57.100%
Expectancy
-0.786
Net Profit
-47.552%
Sharpe Ratio
-0.756
Probabilistic Sharpe Ratio
6.915%
Loss Rate
79%
Win Rate
21%
Profit-Loss Ratio
0.02
Alpha
0.852
Beta
1.996
Annual Standard Deviation
1.316
Annual Variance
1.732
Information Ratio
-0.106
Tracking Error
0.658
Treynor Ratio
-0.498
Total Fees
$0.00
Estimated Strategy Capacity
$19000000.00
Lowest Capacity Asset
SPY R735QTJ8XC9X
# ignore this, see research



















class TestingAlgorithm(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2008,9,5)  
        self.SetEndDate(2008,10,15) 
        self.SetCash(100000) 
        self.UniverseSettings.Resolution = Resolution.Daily

        self.spy = self.AddEquity("SPY")
        self.tlt = self.AddEquity("TLT")
        self.SetBenchmark("SPY")
        self.SetSecurityInitializer(lambda x: x.SetFeeModel(CustomFeeModel())) 
        
        #Add bond
        
        # Schedule trading 
        self.Schedule.On(self.DateRules.EveryDay("SPY"), self.TimeRules.AfterMarketOpen("SPY", 60), self.RebalanceFunction)

        
        self.Schedule.On(self.DateRules.EveryDay("SPY"), self.TimeRules.AfterMarketOpen("SPY", 60), self.TrackFunction)
        
    # Testing Function
    def RebalanceFunction(self):
        #self.SetHoldings([PortfolioTarget("SPY", 0.7), PortfolioTarget("TLT", 0.3)])
        self.SetHoldings("SPY", 2)
        return
    
    def TrackFunction(self):
        leverage = self.Portfolio.TotalHoldingsValue / self.Portfolio.TotalPortfolioValue
        self.Plot("Leverage", "Leverage Chart", leverage)
        return
    
    def OnSecuritiesChanged(self, changes):
        self.Log("Setting fees")
        for security in changes.AddedSecurities:
            security.SetFeeModel(ConstantFeeModel(0))
            self.Log("Setting fees for " + str(security))