def update_quotes(): """Retrieves all required historical quotes""" logger = logging.getLogger(__name__) logger.info('Updating quotes ...') all_symbols = [ 'VIX', 'VXST', 'VXV', 'VXMT', 'VVIX', 'SPX', 'XIV', 'VXX', 'TLT'] for symbol in all_symbols: stocks.fetch_historical(symbol) structures.update_stocks_vol('SPX') futures.fetch_historical('VX') options.fetch_historical('SPX') logger.info('Done')
def test_fetch_historical_non_existing(self): test_date = dates.get_database_timestamp().date() lines = options.fetch_historical(NON_EXISTING_SYMBOL, TEST_DB_NAME) self.assertEquals(lines, 0) self._check_database_quotes(NON_EXISTING_SYMBOL, 0, test_date, 0, True, None)
def test_query_historical_existing(self): test_date = dates.get_database_timestamp().date() options.fetch_historical("VIX", TEST_DB_NAME) quotes = options.query_historical("VIX", test_date, TEST_DB_NAME) self._check_quotes(quotes, "VIX", test_date, True, None)
def test_fetch_historical_existing(self): test_date = dates.get_database_timestamp().date() lines = options.fetch_historical("VIX", TEST_DB_NAME) self.assertGreater(lines, 0) self._check_database_quotes("VIX", lines, test_date, lines, True, None)