| Overall Statistics |
|
Total Trades 250 Average Win 0.15% Average Loss -0.01% Compounding Annual Return 8.648% Drawdown 18.400% Expectancy 13.272 Net Profit 55.100% Sharpe Ratio 0.933 Probabilistic Sharpe Ratio 40.537% Loss Rate 12% Win Rate 88% Profit-Loss Ratio 15.24 Alpha 0.048 Beta 0.452 Annual Standard Deviation 0.099 Annual Variance 0.01 Information Ratio -0.05 Tracking Error 0.114 Treynor Ratio 0.204 Total Fees $288.39 |
class SPYTLT6040InsightWeighted(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2015, 1, 1) # Set Start Date
self.SetCash(1000000) # Set Strategy Cash
self.spy = self.AddEquity("SPY", Resolution.Minute).Symbol
self.tlt = self.AddEquity("TLT", Resolution.Minute).Symbol
self.SetBenchmark('SPY')
# Scheduled event
self.Schedule.On(self.DateRules.MonthStart(self.spy), self.TimeRules.AfterMarketOpen(self.spy, 5), self.emitNewInsights)
# Use the Alpha Streams Brokerage Model
self.SetBrokerageModel(AlphaStreamsBrokerageModel())
# Immediate execution model
self.SetExecution(ImmediateExecutionModel())
# Insight Weighted portfolio construction
self.SetPortfolioConstruction(InsightWeightingPortfolioConstructionModel(self.RebalanceFunction, PortfolioBias.Long))
def emitNewInsights(self):
insights = []
# Up insight for SPY with weight 60%
insights.append(Insight.Price(self.spy, timedelta(days=35), InsightDirection.Up, None, None, None, 0.6))
# Up insight for TLT with weight 40%
insights.append(Insight.Price(self.tlt, timedelta(days=35), InsightDirection.Up, None, None, None, 0.4))
self.EmitInsights(insights)
def RebalanceFunction(self, time):
return None