示例#1
0
def get_available_symbols(**kwargs):
    """
    MOVED to iexfinance.refdata.get_symbols
    """
    import warnings
    warnings.warn(WNG_MSG % ("get_available_symbols", "refdata.get_symbols"))
    _ALL_SYMBOLS_URL = "https://api.iextrading.com/1.0/ref-data/symbols"
    handler = _IEXBase(**kwargs)
    response = handler._execute_iex_query(_ALL_SYMBOLS_URL)
    if not response:
        raise IEXQueryError("Could not download all symbols")
    else:
        return response
示例#2
0
def get_available_symbols(**kwargs):
    """
    Top-level function to obtain IEX available symbols

    Parameters
    ----------
    kwargs:
        Additional Request Parameters (see base class)

    Returns
    -------
    data: list
        List of dictionary reference items for each symbol
    """
    _ALL_SYMBOLS_URL = "https://api.iextrading.com/1.0/ref-data/symbols"
    handler = _IEXBase(**kwargs)
    response = handler._execute_iex_query(_ALL_SYMBOLS_URL)
    if not response:
        raise IEXQueryError("Could not download all symbols")
    else:
        return response
示例#3
0
 def test_cloud_fails_no_token(self, block_keys):
     with pytest.raises(IEXAuthenticationError):
         _IEXBase()
示例#4
0
    def test_token_arg(self, set_keys):
        a = _IEXBase(token="TESTKEY2")

        assert a.token == "TESTKEY2"
示例#5
0
    def test_token_env(self, set_keys):
        a = _IEXBase()

        assert a.token == "TESTKEY"
示例#6
0
 def test_invalid_format_env(self, bad_format):
     with pytest.raises(ValueError):
         _IEXBase()
示例#7
0
 def test_invalid_output_format(self):
     with pytest.raises(ValueError):
         _IEXBase(output_format='BADFORMAT')
示例#8
0
    def test_output_format_env(self, pandas_format):
        base = _IEXBase()

        assert base.output_format == 'pandas'
示例#9
0
    def test_output_format_passed(self):
        base = _IEXBase(output_format='pandas')

        assert base.output_format == 'pandas'
示例#10
0
    def test_all_defaults(self, block_format_env):
        base = _IEXBase()

        assert base.output_format == 'json'
        assert base.pause == 0.5
        assert base.token is None
示例#11
0
    def test_all_defaults(self, block_format_env):
        base = _IEXBase()

        assert base.output_format == "pandas"
        assert base.pause == 0.5