Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Market (aggregate) endpoint get_market_cap is broken #261

Open
nima opened this issue Feb 19, 2021 · 0 comments
Open

Market (aggregate) endpoint get_market_cap is broken #261

nima opened this issue Feb 19, 2021 · 0 comments

Comments

@nima
Copy link

nima commented Feb 19, 2021

Here's how it's expected to work:

In [9]: api.iex.Stock(['AAPL', 'MSFT']).get_price()
Out[9]: {'AAPL': 129.71, 'MSFT': 243.79}

In contrast, here's what actually happens:

In [10]: api.iex.Stock(['AAPL', 'MSFT']).get_market_cap()
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-10-a10133b42a85> in <module>
----> 1 api.iex.Stock(['AAPL', 'MSFT']).get_market_cap()

~/rh/.venv/lib/python3.9/site-packages/iexfinance/stocks/base.py in get_market_cap(self)
    867 
    868     def get_market_cap(self):
--> 869         return self._get_field("quote", "marketCap")
    870 
    871     def get_beta(self):

~/rh/.venv/lib/python3.9/site-packages/iexfinance/stocks/base.py in _get_field(self, endpoint, field)
     91             raise NotImplementedError("Endpoint %s not implemented." % endpoint)
     92         if field not in data:
---> 93             raise KeyError("Field %s not found in %s." % (field, endpoint))
     94         if self.output_format == "json":
     95             if self.single_symbol:

KeyError: 'Field marketCap not found in quote.'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant