Overall Statistics |
Total Trades 11807 Average Win 0.01% Average Loss -0.01% Compounding Annual Return 4.951% Drawdown 1.100% Expectancy 0.706 Net Profit 30.359% Sharpe Ratio 3.342 Probabilistic Sharpe Ratio 100.000% Loss Rate 21% Win Rate 79% Profit-Loss Ratio 1.16 Alpha 0.053 Beta -0.016 Annual Standard Deviation 0.015 Annual Variance 0 Information Ratio -0.721 Tracking Error 0.188 Treynor Ratio -3.078 Total Fees $11901.41 Estimated Strategy Capacity $0 Lowest Capacity Asset PVI TXNSVRVKOEP1 |
########################################## #Kamer Ali Yuksel linkedin.com/in/kyuksel# ########################################## import numpy as np syms = ['TWM','SPXS','EFZ','RWM','MYY','SHY','SH','PSQ','SHV','AGZ','SPTI','EUM','SDS','MZZ','BIL','GSY','IEI','BSV','SBB','MBB','AAPL','PVI','YCS','CHT','PWZ','TVE','JPM','PZA','CYB','MSFT','GJP','IGSB','GJR','FFIN','DDG','WEC','BR','AMZN','GJO','CMS','WSO-B','COST','MKTX','PXD','ASML','IDXX','BIO-B','DPZ','KTH','TSM','WST','TVC','GJH','HRL','UPS','PZT','LLY','TMO','RIO','SDP','CMCSA','KDP','NEU','AON','BANFP','ROST','SNP','FXY','EXR','GPK','FXF','BWX','YCL','VRSN','EOG','ROP','BRK-A','STZ-B','CMF','PFE','UUP','EUO','VZ','SIVB','CASY','GJS','AOS','UNP','GABC','CBRE','KTN','CAT','WILC','SAIA','NTES','NOC','TPL','TZA','ASRVP','MAR','ERIE','HFBL','BFC','SLP','CMI','SAM','MLR','VFC','NFLX','CHD','TARO','HIFS','PG','FCN','JOUT','INTG','DLR','TXN','DZZ','UMC','CMG','IPGP','FORTY','DE','BKT','JOBS','DIS','UHAL','INSI','SELF','MNDO','GJT','NVMI','NVDA','RGR','MGPI','JCTCF','SGU','RGCO','ENSG','JNJ','GCBC','CATM','TIP','PKG','AEP','CLX','CRI','IEF','LRCX','SPIP','BKSC','TSCO','TCX','EDU','DDS','GLD','BND','OVLY','NXST','IAU','BIV','HUM','CIZN','MKC','ESBK','DGP','COG','DORM','KFS','BOTJ','DISCB','ATSG','ES','INTZ','SJM','SWN','SPAB','JAZZ','NSSC','TSRI','GFN','FUE','FBMS','GBF','BRID','WF','REGN','ATVI','VNDA','SFBC','WMT','DSWL','MKC-V','CBFV','HCI','LBC','NTAP','PNC','SWBI','SWKS','TLH','ITIC','WVVI','DGICB','SPTL','WVFC','ESS','PLW','NEWT','ALXN','CTXS','AMN','NVO','HVT-A','GYRO','AMD','PTC','MAYS','UBCP','HMNF','AGM-A','RDCM','KR','AXP','NLOK','ALX','FCAP','KRO','NDAQ','AKO-A','PZZA','SENEB','GRVY','NNI','CBSH','TMUS','PDEX','NEO','SNFCA','EQC','OSK','XSD','MNRO','UNFI','OBAS','BKE','UNAM','SCO','TXRH','MRK','IX','PBHC','USNA','DXCM','NYF','NBIX','MSON','SBSI','TFI','RDIB','CVI','SKX','AJRD','PRPH','AMGN','CPHC','BDX','BMRA','TCFC','SEF','HSKA','TGS','MITK','EBMT','AGX','MTB','WSBF','PLBC','CVLG','AWH','VRTX','CBRL','EEV','GLL','EGBN','CXDC','TAIT','INCY','UBOH','CAR','TRNS','CVCY','TREC','KINS','AKAM','ASR','OBCI','FBIZ','NHTC','CLR','RGEN','EEH','PLCE','SSP','EWV','DRD','ICCC','BAX','SAL','TTGT','LVS','IIN','ENTG','STMP','LEXX','ED','CSII','LOGI','MLCO','FCCY','RAND','NUS','SLV','KNX','KELYB','AWRE','PAC','HOLI','MPB','NSEC','CME','BLDP','HE','GILD','CORT','HALO','FGBI','VMW','CPSS','INBK','ZNH','ACAD','CNOB'] class MultidimensionalModulatedRegulators(QCAlgorithm): def Initialize(self): self.SetStartDate(2016, 1, 1) #self.SetEndDate(2017, 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([0.020757781,0.020757781,0.020757781,0.020757781,0.020757781,0.020757778,0.020757778,0.020757778,0.020757776,0.020757776,0.020757776,0.020757776,0.020757776, 0.020757774,0.020757774,0.020757774,0.020757772,0.02075777,0.017474476,0.016937884,0.013741451,0.0107814735,0.010001547,0.008120474,0.0078084944,0.007709787,0.006681498,0.006604398, 0.0063464227,0.006335632,0.0062769307,0.005832888,0.0056639696,0.0055094506,0.0053410004,0.0052778968,0.0052684094,0.0051782257,0.0050721564,0.004919593,0.0048951907,0.004633222, 0.0044894135,0.0043304106,0.0042967037,0.004188459,0.004096105,0.004074512,0.003957666,0.0039109103,0.003788501,0.003709523,0.003687722,0.0036603673,0.0036371413,0.0036319206, 0.0036206418,0.003604634,0.003574005,0.0034498454,0.0033474583,0.0033364273,0.0032858143,0.0031680851,0.003036304,0.0030003553,0.0029340168,0.0029295366,0.0029249997,0.002905119, 0.0028850627,0.0028614379,0.0028419506,0.0026689866,0.0026237562,0.002547338,0.002536734,0.0025086063,0.0025054805,0.002469022,0.002466935,0.0024281684,0.0024123949,0.0024022227, 0.0023972453,0.0023701652,0.0023686453,0.0023357428,0.002271413,0.0022669781,0.0022590174,0.0022547073,0.0022514814,0.0022463617,0.0022178774,0.0022176134,0.0022149412,0.0021837286, 0.002172616,0.0021565137,0.0021350554,0.002133781,0.0021132955,0.0021085613,0.0020974556,0.0020745667,0.0019934755,0.0019891197,0.0019867977,0.0019818617,0.0019694201,0.001962143, 0.0019430179,0.0019402413,0.0019321803,0.0019258575,0.0019032117,0.0018976282,0.0018915797,0.0018794417,0.0018637023,0.0018561254,0.0018480885,0.0018409187,0.0018335714,0.0018227702, 0.0018123917,0.0017569023,0.0017477234,0.0017299255,0.0017197486,0.0017021089,0.0017009639,0.0016783293,0.0016585425,0.001649583,0.0016357264,0.0015995841,0.0015949437,0.001591572, 0.0015882492,0.0015709586,0.001544464,0.0015346525,0.0015208417,0.0015126336,0.0014945924,0.001491742,0.0014916009,0.0014858557,0.0014789029,0.0014787214,0.0014700679,0.0014668857, 0.001457363,0.0014559887,0.0014427904,0.0014239072,0.0014219532,0.001418308,0.0014026001,0.0014009804,0.0013899738,0.0013864497,0.0013758049,0.0013663959,0.0013583829,0.0013579939, 0.0013574687,0.0013561312,0.0013462674,0.0013417536,0.0013247415,0.001315131,0.0013062751,0.001262592,0.0012597315,0.0012436002,0.0012341934,0.0012138642,0.0012021768,0.0011902436, 0.0011878726,0.0011818707,0.0011811105,0.0011781956,0.0011638091,0.0011566592,0.0011563873,0.0011501751,0.0011453922,0.001142659,0.0011385286,0.0011381526,0.0011291645,0.0011242257, 0.001123797,0.0011237641,0.0011231857,0.0011219059,0.0011170639,0.001105277,0.0010900417,0.0010839477,0.0010838931,0.0010765018,0.0010728217,0.0010680489,0.0010624466,0.0010595936, 0.0010578849,0.0010537308,0.00105248,0.0010427383,0.0010389988,0.0010380067,0.0010349298,0.0010340487,0.0010333293,0.0010291855,0.0010251743,0.0010237445,0.0010176346,0.0010048068, 0.0010039911,0.001003292,0.0009979865,0.0009919694,0.0009888884,0.0009870502,0.0009804362,0.00097133534,0.00096409547,0.0009589339,0.0009534358,0.0009531144,0.00095303013, 0.00095255586,0.000952219,0.00095045014,0.00093789806,0.0009378745,0.00093773985,0.00092865614,0.0009273117,0.0009232061,0.0009217225,0.0009130948,0.000909117,0.0009041993, 0.0008989108,0.00089458766,0.00089435105,0.00089336233,0.00088246615,0.0008773956,0.0008755829,0.00087010185,0.00086657953,0.0008617128,0.0008613163,0.00085847825,0.0008502835, 0.00084251974,0.0008396664,0.0008317726,0.000830402,0.0008227518,0.00082186965,0.00080013863,0.0007824686,0.0007805841,0.0007786103,0.00077244296,0.00077113835,0.0007708285, 0.00076774764,0.0007665304,0.0007637622,0.000757395,0.00075715344,0.0007557678,0.00075402966,0.0007443476,0.00073623285,0.00073453155,0.0007334176,0.00073155237,0.00073022937, 0.00072932127,0.00072738476,0.000720863,0.00072070345,0.0007183904,0.00071358413,0.0007128599,0.0007097928,0.0007046836,0.00070262636,0.000700026,0.0006914189,0.0006886177, 0.00068403425,0.00067361805,0.0006733095,0.00067318714,0.0006721933,0.00066484546,0.00066470174,0.00065883517,0.00065632357,0.00065434974,0.00065370766,0.0006517291,0.0006492128, 0.00064471783,0.0006427102,0.0006425591,0.00064024853,0.0006360539,0.00063161,0.00063086743,0.00062265503,0.00061854447,0.00061774475,0.0006124404,0.0006080582,0.00060516916, 0.0006051305,0.00060233084,0.0006017465,0.0005998078,0.00059918035,0.00059848046,0.0005914588,0.0005898631,0.000589387,0.0005807932,0.00058072695,0.0005779258,0.0005773799, 0.0005750373,0.00057500816,0.00057493313]) 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.1: 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])