Overall Statistics |
Total Trades 7164 Average Win 0.05% Average Loss -0.02% Compounding Annual Return 7.564% Drawdown 0.700% Expectancy 0.709 Net Profit 142.094% Sharpe Ratio 6.316 Probabilistic Sharpe Ratio 100% Loss Rate 42% Win Rate 58% Profit-Loss Ratio 1.93 Alpha 0.072 Beta 0.024 Annual Standard Deviation 0.012 Annual Variance 0 Information Ratio -0.535 Tracking Error 0.178 Treynor Ratio 3.225 Total Fees $7675.91 |
########################################## #Kamer Ali Yuksel linkedin.com/in/kyuksel# ########################################## import numpy as np syms = ['ANDE', 'GRIF', 'ENSG', 'MLR', 'EZPW', 'AVB', 'WTM', 'CBB', 'IAC', 'ROK', 'SLG', 'MKTX', 'MCK', 'VRTS', 'MOS', 'ODFL', 'AES', 'JWN', 'SNPS', 'VVI', 'NOV', 'IEX', 'SCCO', 'CLAR', 'SBUX', 'ASTE', 'DX', 'AVAV', 'LUV', 'IART', 'TDY', 'HLF', 'TSBK', 'PVH', 'EXAS', 'LCII', 'OLP', 'WSBF', 'LORL', 'GBCI', 'EXPO', 'NOC', 'CASH', 'HIFS', 'RGR', 'CMI', 'PGR', 'DAR', 'COO', 'MU', 'ASH', 'LLY', 'ROLL', 'HBCP', 'PKG', 'CNA', 'CRVL', 'HRL', 'FITB', 'UNP', 'SONA', 'AXP', 'ATRI', 'EXR', 'KDP', 'PRSC', 'PKBK', 'ATO', 'NVDA', 'SGEN', 'EVR', 'CLFD', 'FHN', 'CNMD', 'COP', 'MDC', 'MPWR', 'NP', 'DDS', 'PFE', 'HMN', 'UFPT', 'SAIA', 'WAL', 'CDNS', 'JNJ', 'NEE', 'IRM', 'VGR', 'MED', 'WYND', 'DPZ', 'AJRD', 'XLNX', 'EVBN', 'MNR', 'HD', 'JBSS', 'CVLY', 'JCI', 'PFC', 'SNX', 'BK', 'AGNC', 'ABCB', 'PEBO', 'UNH', 'MPW', 'GCBC', 'PRK', 'CCF', 'DORM', 'LAD', 'SBSI', 'EEFT', 'TKR', 'SUI', 'OKE', 'WPC', 'GSBC', 'ROCK', 'UVE', 'AMZN', 'CVI', 'CHE', 'TRS', 'SBNY', 'MTSC', 'ICFI', 'AOS', 'RYN', 'MSCI', 'CMS', 'DHI', 'LXP', 'TCBI', 'WAB', 'LSCC', 'HTH', 'WINA', 'NYMT', 'GABC', 'MRO', 'SAFT', 'KWR', 'FCX', 'TCX', 'HRC', 'NVR', 'SMG', 'ZBRA', 'IHC', 'IOSP', 'CCBG', 'NPO', 'GRMN', 'SMBC', 'DIS', 'PRIM', 'CSV', 'INTC', 'FIZZ', 'CSGS', 'LBC', 'TREX', 'NTAP', 'ARGO', 'CR', 'SMTC', 'BLK', 'SFST', 'EIX', 'TXN', 'TYL', 'BRC', 'NLY', 'TJX', 'CB', 'MRVL', 'EA', 'IMKTA', 'CI', 'LKFN', 'KALU', 'CNS', 'DISCA', 'LDL', 'ALGN', 'MGPI', 'CVGW', 'SSB', 'EW', 'CMA', 'FFIC', 'SR', 'WBS', 'EBSB', 'PDFS', 'F', 'HI', 'URI', 'SNEX', 'RWT', 'EBAY', 'OFG', 'HBNC', 'HWKN', 'CAT', 'CTB', 'BFC', 'MBWM', 'AZO', 'AGM', 'CTAS', 'NYT', 'NNI', 'DE', 'WST', 'DHIL', 'CACC', 'STL', 'ESS', 'STLD', 'QCRH', 'AYI', 'CGNX', 'CPRT', 'VTR', 'FDX', 'CBRL', 'VAR', 'ABC', 'FFIV', 'ALG', 'SLP', 'JOUT', 'LULU', 'NATH', 'AWK', 'MRCY', 'SHEN', 'NNN', 'CASY', 'JCOM', 'ONTO', 'SBAC', 'EPR', 'NRIM', 'BKNG', 'GTY', 'TT', 'ERIE', 'ECPG', 'HEI', 'HCI', 'RCII', 'WLK', 'POL', 'UDR', 'HCCI', 'TREE', 'AAPL', 'TSN', 'WEX', 'BCML', 'STZ', 'CLR', 'IFF', 'LHX', 'LMAT', 'PKE', 'MSTR', 'TDG', 'KMX', 'TDW', 'PBH', 'TDC', 'ACGL', 'ODC', 'GLRE', 'CNP', 'YORW', 'ADS', 'FNB', 'NTUS', 'ETR', 'GRC', 'CUZ', 'DIOD', 'GHL', 'A', 'NUE', 'MFA', 'EXC', 'BDC', 'FMBH', 'APA', 'ADC', 'FARO', 'SBCF', 'PBCT', 'SCSC', 'NPK', 'WFC', 'Y', 'CIA', 'DGX', 'ESXB', 'POWI', 'NWN', 'SCOR', 'BSX', 'IBOC', 'FBP', 'KBR', 'DSPG', 'BXS', 'SLAB', 'WY', 'CF', 'HES', 'INVA', 'FBC', 'POR', 'CRAI', 'WABC', 'GD', 'SPGI', 'PLPC', 'CRL', 'AGCO', 'MKSI', 'J', 'HAFC', 'PAYX', 'FDS', 'LMNR', 'C', 'FE', 'MCO', 'KMT', 'ARE', 'TISI', 'HPQ', 'BLKB', 'NCMI', 'MD', 'PRAA', 'PCG', 'MTW', 'AAP', 'RGP', 'LDOS', 'TRST', 'WTS', 'EGBN', 'BSRR', 'MWA', 'DHT', 'EQIX', 'SRCL', 'UBSI', 'HTLF', 'JNPR', 'CHRW', 'FISV', 'CXW', 'HWM', 'ATI', 'JEF', 'HMSY', 'BELFB', 'CCRN', 'PGC', 'TTWO', 'AKR', 'DVN', 'XRX', 'LAMR', 'AVT', 'NKSH', 'CPF', 'FAST', 'INFN', 'EML', 'INGR', 'OLED', 'PDCE', 'CATO', 'AMG', 'SEE', 'L', 'CUB', 'MCY', 'CPSI', 'SJW', 'LOW', 'WHG', 'ATVI', 'HUBG', 'VIVO', 'SEIC', 'ELY', 'O', 'USD', 'SHBI', 'NWLI', 'STFC', 'GBL', 'ALBO', 'FSP', 'RL', 'BWA', 'CEVA', 'URBN', 'ARR', 'HIG', 'GPS', 'ALCO', 'BDGE', 'KRG', 'LAZ', 'TOL', 'UHT', 'VNO', 'ATNI', 'PICO', 'ANAT', 'GPN', 'R', 'TXT', 'NDAQ', 'NWPX', 'TTC', 'HNI', 'MAS', 'SNV', 'UCBI', 'RTX', 'YUM', 'ALXN', 'WEYS', 'ORRF', 'SPTN', 'VMW', 'DAKT', 'BKD', 'OC', 'PPL', 'CLGX', 'DCI', 'PFBC', 'LYV', 'CL', 'BH', 'BFIN', 'NATI', 'SLB', 'K', 'STT', 'EGLE', 'DHX', 'AWR', 'NUVA', 'INTU', 'EQC', 'SCHN', 'WWD', 'PNR', 'GFF', 'CFFI', 'LHCG', 'BBY', 'HTZ', 'ESSA', 'TPR', 'KW', 'CWCO', 'RMBS', 'KNX', 'ENZ', 'SIGI', 'RIGL', 'BEN', 'CTL', 'SCU', 'BMI', 'COWN', 'GEF', 'FORR', 'DD', 'MLP', 'PTVCB', 'FORM', 'KELYA', 'IMMR', 'VALU', 'HRB', 'TFSL', 'TNC', 'VLO', 'ACC', 'MANT', 'LEG', 'LMNX', 'MDT', 'CDZI', 'MSFT', 'IVZ', 'HE', 'FARM', 'NTCT', 'HUM', 'VRTX', 'FUL', 'CRY', 'TDS', 'SHW', 'ALKS', 'OI', 'HTLD', 'KVHI', 'AAL', 'TRC', 'CNR', 'ATGE', 'CVLT', 'CWT', 'AVID', 'DISH', 'GOOGL', 'MGLN', 'LQDT', 'MAT', 'WYNN', 'FCN', 'TR', 'FRBK', 'IRBT', 'HBMD'] class MultidimensionalModulatedRegulators(QCAlgorithm): def Initialize(self): self.SetStartDate(2009, 1, 1) 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.array([1.0632e-03, 1.3993e-04, 2.2546e-03, 1.5208e-03, 1.5724e-05, 3.9956e-05, 4.2705e-03, 8.4682e-04, 2.1307e-03, 1.8894e-03, 2.2423e-03, 1.6795e-03, 2.0469e-03, 1.0260e-03, 2.2002e-04, 2.1945e-03, 3.7548e-04, 7.2432e-04, 1.3225e-03, 2.6648e-03, 4.2864e-06, 3.0134e-03, 2.2584e-03, 7.8803e-04, 3.4138e-03, 1.0764e-03, 3.7196e-03, 5.3691e-04, 8.7684e-04, 4.3529e-04, 1.5755e-03, 6.3424e-04, 1.5131e-03, 7.2233e-05, 8.3982e-04, 9.9979e-04, 5.6818e-04, 9.6623e-04, 2.6156e-03, 7.3767e-03, 3.7221e-03, 5.2497e-03, 1.0454e-03, 2.8707e-03, 3.3052e-04, 1.5510e-03, 1.9909e-03, 1.8295e-03, 4.0836e-03, 1.3603e-03, 2.1450e-03, 4.3009e-03, 1.6922e-03, 9.3609e-04, 4.2176e-03, 7.6241e-05, 1.2114e-04, 4.2477e-03, 1.0854e-03, 9.8802e-04, 1.3451e-03, 9.3593e-04, 2.2959e-03, 5.4301e-03, 2.6702e-03, 1.4260e-03, 1.2961e-03, 8.0373e-03, 3.7784e-03, 7.0570e-04, 3.9088e-03, 1.3474e-03, 1.5573e-03, 2.4249e-03, 4.9821e-03, 1.1425e-05, 3.2738e-03, 1.2986e-03, 1.6027e-03, 1.2979e-03, 7.6903e-04, 4.0979e-04, 2.6126e-03, 4.2011e-03, 4.7251e-03, 4.4640e-03, 8.2041e-03, 1.3337e-03, 3.2114e-03, 8.0941e-04, 2.1070e-03, 1.1944e-03, 1.9163e-04, 3.6127e-04, 1.2682e-03, 2.2905e-03, 5.7478e-03, 2.7294e-03, 1.3941e-03, 1.2238e-04, 2.3342e-04, 2.0370e-03, 1.9744e-03, 6.6809e-04, 1.5065e-03, 1.4004e-03, 1.6178e-03, 4.1923e-04, 6.1486e-04, 1.9838e-04, 1.4769e-03, 4.3005e-04, 1.2819e-03, 2.1930e-03, 1.6866e-03, 5.4924e-04, 3.0391e-03, 2.2170e-03, 8.1372e-04, 2.0588e-03, 8.2069e-04, 1.0368e-03, 7.3993e-04, 2.3684e-03, 1.0015e-03, 1.4248e-03, 1.5179e-03, 1.5025e-03, 3.7318e-04, 1.0201e-03, 2.5345e-03, 1.8537e-03, 8.0688e-03, 2.6325e-03, 1.3888e-03, 1.4337e-03, 4.5010e-03, 1.5274e-03, 2.4439e-03, 2.5381e-03, 2.9098e-03, 2.7764e-03, 5.7248e-05, 2.6808e-03, 6.1625e-04, 1.5551e-03, 2.2494e-03, 1.2345e-03, 3.1427e-03, 1.0594e-03, 1.6048e-03, 1.2815e-03, 1.2394e-03, 1.6501e-03, 2.1121e-03, 8.3688e-05, 1.4767e-03, 1.3004e-03, 2.6160e-03, 2.1360e-03, 6.4649e-03, 2.4840e-03, 1.5472e-03, 3.9670e-04, 1.1960e-03, 1.7666e-03, 3.4273e-03, 2.0806e-03, 1.0041e-03, 6.0701e-04, 2.5904e-03, 4.3166e-03, 6.9705e-03, 1.1957e-03, 7.4541e-04, 4.4609e-04, 3.9366e-03, 3.8143e-03, 1.2839e-04, 4.1760e-05, 1.7218e-03, 1.9934e-03, 3.1597e-03, 1.0549e-03, 4.8231e-04, 3.1804e-03, 1.8850e-03, 5.3096e-04, 2.0476e-03, 8.1720e-04, 2.0982e-03, 6.7110e-04, 2.9891e-03, 8.3536e-05, 3.3408e-03, 2.4888e-03, 7.3328e-04, 1.8067e-03, 1.7688e-03, 1.4495e-03, 1.7153e-03, 1.2106e-03, 7.5108e-06, 2.3740e-03, 6.9317e-04, 3.6231e-03, 3.2365e-04, 2.8621e-03, 1.0193e-03, 9.0793e-04, 1.2585e-03, 4.0051e-03, 2.1194e-04, 1.8489e-03, 1.2288e-03, 1.5480e-03, 3.2541e-03, 5.0740e-03, 1.6503e-03, 2.1181e-03, 2.7363e-03, 5.1483e-05, 2.8367e-03, 1.4080e-03, 2.7398e-03, 1.7369e-03, 2.7533e-03, 3.3943e-03, 1.6085e-03, 3.5599e-03, 3.0033e-03, 3.3201e-03, 1.3631e-03, 1.0255e-03, 1.1511e-03, 1.5677e-03, 1.1225e-03, 3.2246e-03, 5.7729e-03, 1.1657e-03, 2.7687e-04, 1.4751e-03, 8.9612e-04, 4.6711e-04, 6.7730e-04, 7.2695e-04, 9.7713e-04, 2.1821e-03, 3.7321e-04, 2.6553e-03, 1.5488e-03, 2.8595e-03, 2.1527e-03, 8.0862e-04, 1.5620e-03, 1.0951e-03, 3.0429e-03, 3.2127e-03, 5.4630e-04, 4.5598e-05, 1.6203e-03, 3.7713e-03, 1.7797e-03, 1.0124e-03, 7.6302e-04, 2.1877e-03, 1.5707e-03, 5.8239e-04, 6.3126e-05, 1.6335e-03, 4.7950e-04, 2.2031e-03, 3.4219e-03, 2.5833e-03, -7.8048e-04, -1.0837e-03, -1.1084e-04, -5.1989e-04, -1.0037e-03, -3.5001e-03, -6.1141e-04, -1.6116e-03, -9.8592e-04, -2.1938e-03, -2.8648e-03, -8.7725e-03, -3.6248e-03, -3.1170e-03, -1.7959e-04, -1.0892e-03, -2.4216e-03, -5.0033e-03, -3.0411e-04, -4.6591e-03, -1.5372e-03, -2.2072e-03, -1.9831e-03, -1.9811e-04, -1.4051e-03, -2.1419e-03, -2.0010e-04, -1.1763e-03, -4.9295e-04, -5.0235e-04, -7.4461e-03, -2.2217e-03, -1.6864e-03, -2.9311e-05, -2.6901e-04, -4.3966e-03, -9.0948e-04, -3.3600e-03, -2.7501e-04, -1.3395e-03, -7.3186e-04, -3.0080e-03, -2.9000e-03, -2.6634e-03, -1.0509e-03, -6.9454e-05, -8.5777e-04, -7.5142e-04, -2.5512e-03, -1.2363e-04, -3.5217e-04, -3.0471e-03, -5.8584e-03, -1.1892e-05, -1.6755e-03, -2.2787e-03, -1.0711e-03, -4.9164e-05, -3.4679e-03, -2.9408e-03, -4.8603e-03, -2.5934e-03, -1.9708e-03, -3.4747e-03, -3.1116e-03, -1.8438e-03, -2.3701e-03, -3.0914e-03, -1.2347e-03, -7.7220e-04, -2.1090e-03, -1.3898e-03, -4.7786e-04, -6.6035e-04, -4.2379e-03, -2.4251e-03, -1.8981e-04, -2.6472e-03, -1.3166e-03, -6.7159e-03, -1.7537e-04, -2.4384e-04, -8.5990e-04, -4.9211e-04, -1.1501e-03, -2.2399e-03, -2.9826e-03, -1.0307e-03, -7.8305e-05, -6.7558e-04, -5.1446e-03, -1.0246e-03, -1.1932e-03, -2.4283e-05, -2.8765e-04, -2.0045e-04, -5.5290e-04, -3.3831e-04, -1.8309e-03, -2.0423e-03, -1.6725e-04, -2.0197e-03, -5.9723e-04, -2.9294e-03, -2.2519e-04, -4.6166e-03, -5.2628e-04, -1.6923e-03, -1.2553e-03, -6.9762e-04, -1.1763e-03, -3.7336e-03, -9.7665e-04, -1.3500e-03, -1.7379e-03, -8.6375e-07, -1.2435e-04, -6.0895e-03, -1.8586e-03, -1.2579e-03, -2.0554e-03, -2.4132e-03, -3.1516e-03, -1.5617e-03, -9.4715e-04, -2.1046e-03, -2.1602e-03, -1.0748e-04, -9.8454e-04, -2.2167e-03, -8.6634e-03, -1.3090e-03, -3.9426e-03, -1.7985e-03, -1.1934e-03, -1.3088e-03, -3.3660e-03, -1.1334e-03, -3.7865e-03, -1.2836e-03, -1.8149e-03, -3.7374e-03, -1.7756e-03, -1.4799e-03, -2.2284e-03, -3.0691e-03, -2.8786e-03, -2.5493e-03, -4.2855e-03, -2.5882e-04, -4.0299e-03, -8.0791e-04, -3.4195e-03, -1.6481e-04, -3.6559e-04, -1.6847e-03, -3.4224e-03, -2.4090e-03, -7.0961e-04, -4.3996e-04, -2.8402e-04, -3.3970e-04, -1.6554e-03, -1.3891e-03, -1.4818e-03, -4.9013e-03, -1.1597e-04, -2.8070e-03, -2.8578e-03, -9.7000e-04, -1.0239e-03, -2.2098e-04, -1.1636e-03, -2.6534e-03, -2.4618e-03, -1.5958e-03, -3.7158e-03, -1.5000e-03, -2.3855e-04, -5.8232e-03, -1.0143e-03, -3.8407e-03, -1.3451e-03, -2.8024e-03, -9.1745e-03, -9.2977e-05, -1.6338e-03, -1.4411e-03, -1.0715e-03, -1.5452e-03, -2.8992e-03, -5.9342e-04, -2.0355e-03, -9.4518e-04, -2.3694e-03, -1.5336e-03, -2.9273e-04, -4.7293e-04, -1.5469e-03, -1.5400e-03, -9.6018e-04, -5.9048e-04, -1.9472e-03, -1.3699e-03, -6.2683e-04, -1.2634e-03, -1.8587e-03, -1.6266e-03, -1.3865e-03, -2.6754e-03, -8.2174e-04, -7.8699e-05, -1.4140e-03, -6.7754e-04, -9.9069e-04, -1.4559e-03, -2.9140e-03, -9.5445e-04, -1.6321e-03, -1.0749e-03, -1.2558e-03, -1.3343e-03, -1.1455e-03, -2.9404e-03, -4.9959e-05, -2.3038e-03, -4.1891e-03, -2.3536e-03, -1.0767e-03, -1.9637e-03, -2.9029e-03, -5.0736e-03, -1.5321e-03, -1.9509e-03, -1.4398e-03, -4.8646e-03, -1.5394e-03, -1.3234e-03, -3.6433e-04, -1.8508e-03, -1.6623e-03, -7.1447e-04, -2.1217e-03, -1.8020e-04, -1.8060e-03, -2.5273e-03, -2.1285e-03, -5.8394e-04, -9.8301e-04, -2.2151e-03, -2.3699e-03, -1.2851e-03, -9.2534e-04, -1.5878e-03, -7.7510e-04, -1.4466e-03, -7.2053e-04, -2.4236e-03, -1.4248e-03, -1.8611e-03, -4.5002e-04, -1.6397e-03, -7.3769e-04, -9.5347e-04, -6.7193e-04, -1.1657e-03]) 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])