Beispiel #1
0
 def _check_database_quotes(self, symbol, total, check_date, total_date, is_eod, stock):
     with database.connect_db(TEST_DB_NAME) as db:
         db.execute("SELECT COUNT(*) FROM options WHERE symbol=?;", [symbol])
         self.assertEqual(db.fetchall(), [(total,)])
     if total > 0:
         database_quotes = options.query_historical(symbol, check_date, TEST_DB_NAME)
         self.assertEqual(len(database_quotes), total_date)
         self._check_quotes(database_quotes, symbol, check_date, is_eod, stock)
Beispiel #2
0
 def test_query_historical_non_existing(self):
     test_date = dates.get_database_timestamp().date()
     quotes = options.query_historical(NON_EXISTING_SYMBOL, test_date, TEST_DB_NAME)
     self.assertEqual(len(quotes), 0)
Beispiel #3
0
 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)