Overall Statistics
Total Trades
443
Average Win
0.60%
Average Loss
-0.40%
Compounding Annual Return
0.444%
Drawdown
10.200%
Expectancy
0.043
Net Profit
2.733%
Sharpe Ratio
0.093
Probabilistic Sharpe Ratio
0.424%
Loss Rate
58%
Win Rate
42%
Profit-Loss Ratio
1.50
Alpha
0.005
Beta
-0.007
Annual Standard Deviation
0.043
Annual Variance
0.002
Information Ratio
-0.766
Tracking Error
0.157
Treynor Ratio
-0.54
Total Fees
$581.37
Estimated Strategy Capacity
$0
Lowest Capacity Asset
TYC R735QTJ8XC9X
class WellDressedYellowCat(QCAlgorithm):

    def Initialize(self):

        self.SetStartDate(2015, 9, 1)  # Set Start Date
        self.SetEndDate(2021, 10, 1) # Set End Date
        self.SetCash(100000)  # Set Strategy Cash

        self.AddRiskManagement(TrailingStopRiskManagementModel(0.03))
        
        tickerList = ['STX','QRVO','BIG','THC','DV','FDO','VRTX','FTNT','PLL','RRD','ENDP','RX','MKTX','SE','R','WFM','KEYS','JNPR','PCL','NKTR','AVB','GNW','HRS','STE','COV','AV','DPS','LNT','WST','GOOGL','LIFE','DISCK','AMCR','MLM','HP','CBE','BXLT','WFR','EVRG','BLK','NYX','BRO','BRCM','POM','FMC','URBN','ZBRA','SBL','NFX','RCL','SNI','SBAC','NAVI','SYF','FRC','GMCR','CPGX','SWY','RAD','ALB','UNM','QEP','MMI','ARNC','EMC','APOL','MJN','VTR','MEE','PBCT','RMD','LEH','KBH','EW','CFG','EP','X','CRM','FII','MPC','HCBK','AMZN','ICE','EK','SCG','XLNX','CPWR','HCA','CPRI','JOY','ESV','CA','PETM','MNK','CRL','CEG','LDW','GGP','ANSS','NOV','AME','ROST','WRB','ALK','AOS','FSLR','NDSN','ABS','LRCX','CHK','DRE','NCLH','MOLX','MXIM','GME','HRB','TECH','WCG','SEDG','FTR','BR','SAI','CMG','PBI','GAS','NYT','GPN','ITT','XRX','GENZ','BMS','PSX','RAI','PTC','WIN','TMUS','FRE','DXCM','VRSK','DELL','JKHY','RJF','DISH','ACAS','FDC','EQIX','UA','LYV','CSC','TRB','DJ','GR','CHD','SRCL','ILMN','AJG','LO','FB','LLL','CBOE','MTCH','GRMN','WPX','DYN','MAC','LDOS','SIG','TER','AKS','ROL','XL','CDAY','LSI','PCS','AYI','TFX','IEX','HRL','TTWO','TLAB','TYL','FLS','EXPE','HBI','FANG','GNRC','OMX','NE','QTRN','SGP','JCP','PDCO','KHC','MPWR','CTX','MAT','LYB','COG','ALLE','KMI','JDSU','MHK','CSRA','JNS','ANR','ULTA','AMD','PNR','BHF','MAA','NOVL','LXK','BTU','PAYC','KSS','AN','AWK','CIEN','DD','AYE','MON','GLK','DF','DAL','MUR','ANET','JEC','JBL','NOW','UDR','KG','KFT','HSP','BCR','GPS','DO','PYPL','DXC','FTI','PRGO','LVLT','ETSY','ALTR','APC','HOG','ADS','TSCO','LUK','NXPI','ADT','BWA','KRFT','PKG','JNY','DLR','IPGP','RSH','CTVA','LKQ','ABMD','HNZ','LEG','ESRX','INCY','OI','SLR','ESS','JWN','CELG','IDXX','SHLD','CMCSK','PTV','NFLX','CDNS','PCG','DWDP','HII','RE','PCP','PVH','ALGN','NSM','COL','SLM','T','STI','ABBV','JEF','HSIC','USL','NWS','TRMB','ETFC','ATI','SWN','CHTR','MWW','TRIP','STJ','TSS','DNR','SIVB','TYC','COTY','CARR','OTIS','TDC','ALXN','BEAM','STR','KSU','TIE','MOS','TWTR','FDS','SII','CXO','SLE','FLR','EXR','ZTS','FTV','CCI','AMG','M','MRNA','AAP','WAB','COO','UAL','UHS','VAR','XEC','REG','DOW','FAST','MTD','GT','NBR','HOT','TGNA','MSCI','ANF','CPT','AIV','YHOO','CVH','BC','FRT','WU','CAM','HOLX','FHN','CEPH','TEG','TDY','SUN','PCLN','ENPH','FFIV','REGN','FOX','EQT','CCE','TE','DLTR','NBL','RIG','CPRT','KMX','AET','RDC','TIF','STZ','FL','MFE','SIAL','ATVI','TWX','CDW','MI','VIAB','BBBY','TEL','GHC','ARE','DFS','SMS','DLPH','FLIR','FLT','SLG','BS','EPAM','ARG','CVC','CB','WLTW','AA','BIO','FNM','SNPS','HLT','SBNY','ACE','RHT','TSLA','ABK','KORS','DTV','POOL','LM','IR','JBHT','S','TDG','MHS','ACN','FOSL','LW','VNT','GRA','RTN','ATO','PENN','CE','INFO','NCR','TSG','CNC','HFC','INTU','XYL','CERN','NVLS','V','TWC','CLF','AAL','O','HPE','CZR','MOH','AGN','SWKS','LLTC','RRC','IGT','SNDK','DPZ','CTLT','SBUX','MGM','CCK','HAR','LVS','SPLS','FOXA','ODP','GM','MBI','URI','CFN','OGN','DG','FRX','DNB','UAA','NVR','WYN','TSO','HWM','ANDV','EVHC','CVG','MNST','KSE','FBHS','IT','Q','CNX','XTO','BMC','BJS','PGN','AVGO','AVP','MIL','NLSN','ODFL','WB','SVU']
        for ticker in tickerList:
            self.AddEquity(ticker, Resolution.Daily)

        self.change = self.AddData(SPYChange, "change", Resolution.Hour).Symbol



    def OnData(self, data: Slice):
        if self.change in data:
            for ticker in data[self.change].Added:
                if ticker in data:
                    self.SetHoldings(ticker, 0.1)
            for ticker in data[self.change].Removed:
                if ticker in data:
                    self.SetHoldings(ticker, -0.05)


class SPYChange(PythonData):

    def GetSource(self, config, date, isLive):
        source = "https://www.dropbox.com/s/7nl66xfh1jukgma/SPYChangesWiki.csv?dl=1"
        return SubscriptionDataSource(source, SubscriptionTransportMedium.RemoteFile);

    def Reader(self, config, line, date, isLive):
        if not (line.strip() and line[0].isdigit()):
            return None
        
        data = line.split(',')
        change = SPYChange()

        try:
            change.Symbol = config.Symbol
            change.Time = datetime.strptime(data[0], '%Y-%m-%d') + timedelta(hours=10) # - timedelta(days=5)
            
            change.Value = 0
            change["Added"] = str(data[1]).split(" ")
            change["Removed"] = str(data[2]).split(" ")

        except ValueError:
            return None
        
        return change