Example #1
0
    def test_sectorPerformanceDF(self):
        from pyEX import sectorPerformanceDF
        with patch('requests.get') as mock:
            mock.return_value = MagicMock()
            mock.return_value.status_code = 200
            mock.return_value.json = MagicMock(return_value=[])

            sectorPerformanceDF()
Example #2
0
def get_sector_perf(sector=None):
    if sector == None:
        d = pd.DataFrame(p.sectorPerformanceDF())
        return d
    d = pd.DataFrame(p.sectorPerformanceDF())
    lst_of_industries = ['Consumer Discretionary', 'Financials', 'Industrials', 'Materials',
                         'Energy', 'Consumer Staples', 'Utilities', 'Health Care',
                         'Real Estate', 'Communication Services', 'Technology']
    idx = d.index[d['name'] == sector].tolist()
    idx = idx[0]
    perf = d['performance'][idx]

    return perf
def update_sector_rTime():
    print("updating sector_rTime sheet....")
    sectorPerformance = p.sectorPerformanceDF() #all sectors
    techSector = sectorPerformance.iloc[9] #tech sector
    
    timestamp = techSector[0] #time date
    performance = techSector[1] #change
    
    sheet.sector_rTime.append_row([str(timestamp),performance])#send to google
Example #4
0
 def test_sectorPerformanceDF(self):
     from pyEX import sectorPerformanceDF
     sectorPerformanceDF()