示例#1
0
 def setup_class(self):
     self.share = Stock("AAPL")
     self.share2 = Stock("AAPL", output_format='pandas')
     self.share4 = Stock("AAPL",
                         json_parse_int=Decimal,
                         json_parse_float=Decimal)
     self.share5 = Stock("TSLA")
示例#2
0
 def setup_class(self):
     self.cshare = Stock("aapl")
     self.cshare2 = Stock("aapl", output_format='pandas')
     self.cshare3 = Stock("svxy")
     self.cshare4 = Stock("aapl",
                          json_parse_int=Decimal,
                          json_parse_float=Decimal)
     self.cshare5 = Stock("gig^")
示例#3
0
 def test_wrong_iex_input_type(self):
     with pytest.raises(ValueError):
         Stock(34)
     with pytest.raises(ValueError):
         Stock("")
     with pytest.raises(ValueError):
         ls = []
         Stock(ls)
示例#4
0
 def setup_class(self):
     self.batch = Stock(["AAPL", "TSLA"])
     self.batch2 = Stock(["AAPL", "TSLA"], output_format='pandas')
     self.batch4 = Stock(["AAPL", "TSLA"],
                         json_parse_int=Decimal,
                         json_parse_float=Decimal)
示例#5
0
 def test_invalid_symbol(self):
     data = Stock("BAD SYMBOL")
     with pytest.raises(IEXSymbolError):
         data.get_price()
示例#6
0
 def test_invalid_symbol_or_symbols(self):
     with pytest.raises(IEXSymbolError):
         a = Stock(["TSLA", "BAD SYMBOL", "BAD SYMBOL"])
         a.get_price()
示例#7
0
 def setup_class(self):
     self.cbatch = Stock(["aapl", "tsla"])
     self.cbatch2 = Stock(["aapl", "tsla"], output_format='pandas')
     self.cbatch3 = Stock(["uvxy", "svxy"])
示例#8
0
 def test_symbol_list_too_long(self):
     with pytest.raises(ValueError):
         x = ["tsla"] * 102
         Stock(x)
示例#9
0
 def test_listed_crypto_symbols(self):
     a = Stock(self.ticks)
     assert isinstance(a.get_quote(), dict)