Overall Statistics |
Total Trades 71 Average Win 0.57% Average Loss -1.24% Compounding Annual Return 27.281% Drawdown 24.000% Expectancy -0.026 Net Profit 61.968% Sharpe Ratio 0.942 Loss Rate 33% Win Rate 67% Profit-Loss Ratio 0.46 Alpha 0.252 Beta 1.461 Annual Standard Deviation 0.298 Annual Variance 0.089 Information Ratio 0.875 Tracking Error 0.298 Treynor Ratio 0.193 Total Fees $75.91 |
from clr import AddReference AddReference("System") AddReference("QuantConnect.Algorithm") AddReference("QuantConnect.Common") from System import * from QuantConnect import * from QuantConnect.Algorithm import * from QuantConnect.Indicators import * from QuantConnect.Data.Market import TradeBar import numpy as np import decimal as d from datetime import timedelta, datetime class OptionsAlgorithm(QCAlgorithm): def Initialize(self): self.SetStartDate(2017, 1, 1) self.SetEndDate(2018, 12, 31) self.SetCash(50000) self.SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage) self.equitylist = ["JNUG", "JDST", "DUST", "NUGT","DGAZ","UGAZ"] #total number of equities self.noe = len(self.equitylist) def zerolistmaker(n): listofzeros = [0] * n return listofzeros #generate blank list self.equity = zerolistmaker(self.noe) self.syl = zerolistmaker(self.noe) # Add assets you'd like to see for x in range(self.noe): self.equity[x] = self.AddSecurity(SecurityType.Equity, self.equitylist[x], Resolution.Minute) self.syl[x] = self.equity[x].Symbol self.days_counter = 100000 #Set Trading and closing Times, for 1 day intra self.Schedule.On(self.DateRules.EveryDay(),self.TimeRules.At(9, 35),Action(self.Rebalance)) def Rebalance(self): self.days_counter+=1 if self.days_counter >= 60: for x in range(self.noe): self.SetHoldings(self.syl[x], -1/(self.noe)) self.days_counter = 0 #end