Overall Statistics |
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return -4.006% Drawdown 0.400% Expectancy 0 Net Profit 0% Sharpe Ratio -1.921 Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0.055 Beta -0.191 Annual Standard Deviation 0.016 Annual Variance 0 Information Ratio -7.088 Tracking Error 0.067 Treynor Ratio 0.157 Total Fees $1.85 |
from datetime import timedelta class BasicTemplateFuturesAlgorithm(QCAlgorithm): def Initialize(self): self.SetStartDate(2017, 9, 05) self.SetEndDate(2017, 9, 15) self.SetCash(1000000) futureGC = self.AddFuture(Futures.Metals.Gold) futureGC.SetFilter(timedelta(0), timedelta(182)) def OnData(self,slice): if not self.Portfolio.Invested: for chain in slice.FutureChains: contracts = filter(lambda x: x.Symbol.Value == 'GCZ17', chain.Value) if len(contracts) == 0: continue contract = sorted(contracts, key = lambda x: x.Expiry, reverse=True)[0] self.MarketOrder(contract.Symbol , 1) def OnOrderEvent(self, orderEvent): self.Log(str(orderEvent))