def test_calendarDF(self): from pyEX import Client with patch('requests.get') as mock, \ patch('pickle.dump'): mock.return_value = MagicMock() mock.return_value.status_code = 200 mock.return_value.json = MagicMock(return_value=[]) c = Client(version='sandbox') c.calendarDF() c.holidaysDF()
def check_holiday(ords): new_ords = [] c = Client(authorizations['pyEX']) holiday_ords = [ holiday.toordinal() for holiday in c.calendarDF( type='holiday', direction='next', last=10)['date'].tolist() ] for ord in ords: if ord in holiday_ords: ord -= 1 new_ords.append(ord) return new_ords
def test_calendarDF(self): from pyEX import Client c = Client(version="sandbox") c.calendarDF() c.holidaysDF()