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