Exemplo n.º 1
0
 def test_fetch_realtime_multiple_quote(self):
     raw_quotes = stocks._fetch_realtime_data(["SPX", "VIX", "AAPL"])
     self.assertIsInstance(raw_quotes, list)
     self.assertEqual(len(raw_quotes), 3)
     self.assertGreater(len(raw_quotes[0]), 50)
     self.assertIn("YearLow", raw_quotes[0])
     self.assertGreater(raw_quotes[0]["YearLow"], 0)
Exemplo n.º 2
0
 def test_fetch_realtime_non_existing_quote(self):
     raw_quotes = stocks._fetch_realtime_data([NON_EXISTING_SYMBOL])
     self.assertIsInstance(raw_quotes, dict)
     self.assertGreater(len(raw_quotes), 50)
     self.assertIn("YearLow", raw_quotes.keys())
     self.assertIsNone(raw_quotes["YearLow"])
Exemplo n.º 3
0
 def test_fetch_realtime_single_quote(self):
     raw_quotes = stocks._fetch_realtime_data(["SPX"])
     self.assertIsInstance(raw_quotes, dict)
     self.assertGreater(len(raw_quotes), 50)
     self.assertIn("YearLow", raw_quotes.keys())
     self.assertGreater(raw_quotes["YearLow"], 0)
Exemplo n.º 4
0
 def test_fetch_realtime_data_no_quote(self):
     self.assertIsNone(stocks._fetch_realtime_data([]))