Overall Statistics |
Total Trades 33 Average Win 1.34% Average Loss -0.45% Compounding Annual Return 1.562% Drawdown 5.500% Expectancy 2.220 Net Profit 14.244% Sharpe Ratio 0.587 Probabilistic Sharpe Ratio 7.352% Loss Rate 19% Win Rate 81% Profit-Loss Ratio 2.96 Alpha 0.002 Beta 0.097 Annual Standard Deviation 0.019 Annual Variance 0 Information Ratio -0.671 Tracking Error 0.13 Treynor Ratio 0.113 Total Fees $31.45 Estimated Strategy Capacity $370000000.00 Lowest Capacity Asset ES XZDYPWUWC7I9 |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. # Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. from AlgorithmImports import * class BasicTemplateFuturesAlgorithm(QCAlgorithm): def Initialize(self): self.SetStartDate(2013, 10, 8) self.SetCash(1000000) self.DateRules.Every(DayOfWeek.Monday) self.TimeRules.At(21, 00) #self.contractSymbol = # Subscribe and set our expiry filter for the futures chain futureSP500 = self.AddFuture(Futures.Indices.SP500EMini) futureSP500.SetFilter(timedelta(0), timedelta(182)) benchmark = self.AddEquity("SPY") self.SetBenchmark(benchmark.Symbol) seeder = FuncSecuritySeeder(self.GetLastKnownPrices) self.SetSecurityInitializer(lambda security: seeder.SeedSecurity(security)) def OnData(self,slice): if not self.Portfolio.Invested: for chain in slice.FutureChains: # Get contracts expiring no earlier than in 90 days contracts = list(filter(lambda x: x.Expiry > self.Time + timedelta(90), chain.Value)) # if there is any contract, trade the front contract if len(contracts) == 0: continue front = sorted(contracts, key = lambda x: x.Expiry, reverse=True)[0] self.contractSymbol = front.Symbol self.MarketOrder(front.Symbol , 1)