Overall Statistics |
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return 0% Drawdown 0% Expectancy 0 Net Profit 0% Sharpe Ratio 0 Probabilistic Sharpe Ratio 0% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 0 Annual Standard Deviation 0 Annual Variance 0 Information Ratio 0 Tracking Error 0 Treynor Ratio 0 Total Fees $1.85 Estimated Strategy Capacity $0 Lowest Capacity Asset GC W6S8T2U7M6CD |
from AlgorithmImports import * class CustomSlippageModel: def GetSlippageApproximation(self, asset, order): return 1 class BasicTemplateFuturesAlgorithm(QCAlgorithm): def Initialize(self): self.SetStartDate(2013, 10, 8) self.SetEndDate(2013, 10, 10) self.SetCash(1000000) #self.SetSecurityInitializer(self.CustomSecurityInitializer) futureGold = self.AddFuture(Futures.Metals.Gold) futureGold.SetFilter(0, 182) def CustomSecurityInitializer(self, security): seeder = FuncSecuritySeeder(self.GetLastKnownPrices) seeder.SeedSecurity(security) security.SetSlippageModel(CustomSlippageModel()) def OnData(self,slice): if not self.Portfolio.Invested: for chain in slice.FutureChains: # Select a contract contracts = list(filter(lambda x: x.Expiry > self.Time + timedelta(90), chain.Value)) if len(contracts) == 0: continue contract = sorted(contracts, key = lambda x: x.Expiry, reverse=True)[0] # Buy the contract self.MarketOrder(contract.Symbol , 1) else: self.Quit()