Overall Statistics |
Total Trades 7553 Average Win 0.03% Average Loss -0.02% Compounding Annual Return 7.310% Drawdown 0.700% Expectancy 0.491 Net Profit 79.921% Sharpe Ratio 6.003 Probabilistic Sharpe Ratio 100% Loss Rate 43% Win Rate 57% Profit-Loss Ratio 1.64 Alpha 0.071 Beta 0.012 Annual Standard Deviation 0.012 Annual Variance 0 Information Ratio -0.539 Tracking Error 0.168 Treynor Ratio 6.037 Total Fees $8072.38 |
########################################## #Kamer Ali Yuksel linkedin.com/in/kyuksel# ########################################## import numpy as np syms = ['ERIE', 'UDR', 'DAR', 'CNS', 'MSCI', 'EBAY', 'SMTC', 'TCBI', 'SONA', 'NNN', 'PKE', 'SBUX', 'JNJ', 'ZBRA', 'FCX', 'EXAS', 'STZ', 'MU', 'SNPS', 'UNH', 'LDL', 'ENSG', 'VGR', 'JWN', 'ALG', 'WTM', 'GBCI', 'LULU', 'VAR', 'ROK', 'IRM', 'COO', 'XLNX', 'LAMR', 'LCII', 'ESXB', 'AJRD', 'PGR', 'DISCA', 'UFPT', 'COP', 'GTY', 'F', 'AES', 'IHC', 'DX', 'SPGI', 'TYL', 'LYV', 'KALU', 'HBNC', 'EEFT', 'VVI', 'AOS', 'CCBG', 'CLAR', 'GCBC', 'TXN', 'CTB', 'CAT', 'STT', 'LKFN', 'PEBO', 'BCML', 'UNP', 'MED', 'LMAT', 'PRIM', 'INTC', 'TREX', 'MNR', 'LLY', 'POR', 'OFG', 'HTLF', 'CACC', 'WSBF', 'IEX', 'ASTE', 'HD', 'MRVL', 'NOV', 'EXR', 'HTH', 'KWR', 'LORL', 'CBRL', 'EA', 'SNEX', 'PKG', 'MRO', 'AZO', 'ALGN', 'MTSC', 'DORM', 'FIZZ', 'MGPI', 'DE', 'PFC', 'OKE', 'CLR', 'SHW', 'CCF', 'SLP', 'CWT', 'CGNX', 'AWK', 'EGBN', 'SMG', 'CHE', 'HWKN', 'LXP', 'SAFT', 'LBC', 'RWT', 'ICFI', 'CB', 'NATH', 'NYMT', 'EXPO', 'BKNG', 'CPRT', 'NLY', 'CVI', 'AYI', 'NP', 'CDNS', 'EVBN', 'SCCO', 'FFIV', 'MFA', 'TDG', 'MKTX', 'ONTO', 'TSN', 'SUI', 'SBSI', 'MSTR', 'HEI', 'DDS', 'IART', 'POL', 'DHI', 'AAPL', 'NOC', 'HRL', 'TTWO', 'GABC', 'FDX', 'HBCP', 'EW', 'CMI', 'LSCC', 'SBNY', 'CSV', 'WLK', 'TDY', 'CASY', 'FHN', 'NTAP', 'EIX', 'CTAS', 'HRC', 'IBOC', 'WINA', 'AVAV', 'TRS', 'CBB', 'TT', 'ARGO', 'CMS', 'PDFS', 'CLCT', 'PVH', 'ATRI', 'CLFD', 'MPW', 'SFST', 'SMBC', 'UVE', 'SR', 'POWI', 'QCRH', 'CNMD', 'PKBK', 'CVGW', 'STLD', 'AAP', 'BFC', 'TFSL', 'BK', 'TSBK', 'WYND', 'SHEN', 'NVR', 'NYT', 'TKR', 'FITB', 'ABC', 'ADC', 'JCOM', 'AGM', 'DHIL', 'VTR', 'HI', 'KMX', 'RGR', 'LAD', 'IMKTA', 'NEE', 'PRSC', 'ABCB', 'SBAC', 'SSB', 'NPO', 'EVR', 'KDP', 'TJX', 'ECPG', 'WST', 'CVLY', 'STL', 'URI', 'RCII', 'DPZ', 'AMZN', 'HMN', 'BLK', 'DIS', 'CASH', 'HCI', 'RYN', 'JBSS', 'PFE', 'WBS', 'LUV', 'CSGS', 'IAC', 'SAIA', 'MLR', 'ATO', 'BRC', 'ROCK', 'TTC', 'SGEN', 'AXP', 'SNX', 'IOSP', 'EQC', 'MRCY', 'ROLL', 'SLG', 'ASH', 'WEX', 'CNP', 'CI', 'JOUT', 'GRIF', 'WAL', 'VRTS', 'MCK', 'GRMN', 'NRIM', 'WPC', 'GSBC', 'HIFS', 'MPWR', 'NVDA', 'NNI', 'TCX', 'CR', 'ODFL', 'ALXN', 'EBSB', 'CF', 'WAB', 'CMA', 'ANDE', 'TREE', 'MBWM','VRTX', 'AWR', 'OLP', 'BELFB', 'EQIX', 'WFC', 'ACC', 'YORW', 'MSFT', 'WWD', 'GBL', 'SCOR', 'MWA', 'UCBI', 'NWN', 'CUB', 'INVA', 'ETR', 'HCCI', 'WHG', 'FE', 'CCRN', 'AAL', 'MOS', 'SHBI', 'TOL', 'MLP', 'PNR', 'COWN', 'CRAI', 'IRBT', 'NUVA', 'BKD', 'EPR', 'ATVI', 'WY', 'CNA', 'PBH', 'NUE', 'MCO', 'HMSY', 'NKSH', 'FORM', 'HE', 'EXC', 'BWA', 'VALU', 'EZPW', 'PDCE', 'ATI', 'MTW', 'WTS', 'SBCF', 'ADS', 'NWLI', 'BXS', 'DIOD', 'FSP', 'RIGL', 'SCSC', 'KELYA', 'AVB', 'TRST', 'GPS', 'DCI', 'HBMD', 'SNV', 'NTCT', 'HUBG', 'APA', 'VMW', 'JCI', 'BMI', 'TNC', 'HLF', 'FARO', 'AGCO', 'HWM', 'SJW', 'PAYX', 'GD', 'CPF', 'FFIC', 'INFN', 'TDS', 'CVLT', 'L', 'ALCO', 'DSPG', 'HRB', 'OLED', 'AKR', 'KVHI', 'ARR', 'R', 'ATGE', 'SCHN', 'KBR', 'MAT', 'PBCT', 'AGNC', 'FAST', 'K', 'LOW', 'J', 'SLB', 'FUL', 'HPQ', 'TISI', 'CRY', 'ACGL', 'BLKB', 'DVN', 'WYNN', 'ODC', 'OC', 'FBP', 'PTVCB', 'AVID', 'LHX', 'ESSA', 'IVZ', 'STFC', 'BSX', 'GHL', 'DAKT', 'LMNX', 'NPK', 'FORR', 'GPN', 'BEN', 'HIG', 'HES', 'INGR', 'MD', 'Y', 'TXT', 'NTUS', 'SEE', 'INTU', 'TR', 'KNX', 'SCU', 'CXW', 'SIGI', 'WEYS', 'FARM', 'CTL', 'ALKS', 'LAZ', 'FMBH', 'PRAA', 'JNPR', 'PCG', 'HUM', 'FCN', 'RMBS', 'RTX', 'SPTN', 'CWCO', 'RL', 'CATO', 'CPSI', 'ORRF', 'MAS', 'SLAB', 'UHT', 'GOOGL', 'CHRW', 'XRX', 'EML', 'BSRR', 'WABC', 'GEF', 'C', 'HTLD', 'IMMR', 'JEF', 'FRBK', 'FNB', 'PPL', 'VLO', 'DISH', 'LDOS', 'SEIC', 'KMT', 'UBSI', 'CIA', 'KRG', 'HAFC', 'TRC', 'CRL', 'VIVO', 'BDC', 'BDGE', 'ANAT', 'HNI', 'MANT', 'USD', 'EGLE', 'CLGX', 'NCMI', 'GFF', 'FBC', 'ESS', 'MGLN', 'KW', 'MDC', 'PGC', 'CUZ', 'LQDT', 'DGX', 'LMNR', 'CL', 'SRCL', 'OI', 'LHCG', 'NDAQ', 'ATNI', 'URBN', 'PRK', 'CEVA', 'PLPC', 'MDT', 'BFIN', 'BH', 'PICO', 'AMG', 'ALBO', 'GLRE', 'FDS', 'TDC', 'DHT', 'IFF', 'ELY', 'ARE', 'PFBC', 'RGP', 'CNR', 'LEG', 'NWPX', 'TPR', 'A', 'CDZI', 'AVT', 'HTZ', 'GRC', 'DD', 'MCY', 'NATI', 'ENZ', 'CFFI', 'DHX', 'TDW', 'FISV', 'CRVL', 'MKSI', 'YUM', 'O', 'BBY', 'VNO'] class MultidimensionalModulatedRegulators(QCAlgorithm): def Initialize(self): self.SetStartDate(2009, 1, 1) self.SetEndDate(2017, 4, 27) #self.SetStartDate(2017, 4, 29) self.SetCash(1000000) self.SetExecution(VolumeWeightedAveragePriceExecutionModel()) self.symbols = [] for i in range(len(syms)): self.symbols.append(Symbol.Create(syms[i], SecurityType.Equity, Market.USA)) self.Debug(syms[i]) self.SetUniverseSelection(ManualUniverseSelectionModel(self.symbols) ) self.UniverseSettings.Resolution = Resolution.Hour self.AddEquity('SPY', Resolution.Hour) self.SetBenchmark('SPY') self.SetBrokerageModel(AlphaStreamsBrokerageModel()) self.constant_weights = np.ones(len(syms)) self.constant_weights[-261:] *= -1 self.constant_weights = self.constant_weights / np.sum(np.abs(self.constant_weights)) def OnData(self, data): rebalance = False if self.Portfolio.TotalHoldingsValue > 0: total = 0.0 for i, sym in enumerate(self.symbols): curr = (self.Securities[sym].Holdings.HoldingsValue/self.Portfolio.TotalPortfolioValue) diff = self.constant_weights[i] - curr total += np.abs(diff) if total > 0.25: rebalance = True if rebalance: for i, sym in enumerate(self.symbols): curr = (self.Securities[sym].Holdings.HoldingsValue/self.Portfolio.TotalPortfolioValue) if self.constant_weights[i] < curr: self.SetHoldings(sym, self.constant_weights[i]) for i, sym in enumerate(self.symbols): curr = (self.Securities[sym].Holdings.HoldingsValue/self.Portfolio.TotalPortfolioValue) if self.constant_weights[i] > curr: self.SetHoldings(sym, self.constant_weights[i]) else: for i, sym in enumerate(self.symbols): self.SetHoldings(sym, self.constant_weights[i])