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

Batch fails when missing data #239

Open
shaunpatterson opened this issue Dec 14, 2020 · 3 comments
Open

Batch fails when missing data #239

shaunpatterson opened this issue Dec 14, 2020 · 3 comments

Comments

@shaunpatterson
Copy link

Summary (include Python version)

Python 3.8

print(Stock(['ICUI'], token=token).get_quote(filter='latestPrice'))
print(Stock(['CVLB'], token=token).get_quote(filter='latestPrice'))
print(Stock(['ICUI', 'CVLB'], token=token).get_quote(filter='latestPrice'))

Prints

          latestPrice
ICUI       197.02
Empty DataFrame
Columns: []
Index: [CVLB]
...
ValueError: Mixing dicts with non-Series may lead to ambiguous ordering.

Date/time of issue

Dec 14th, 10:54am

Expected behavior

A dataframe with just ICUI, dropping CVLB

Actual behavior

ValueError

@addisonlynch
Copy link
Owner

Thanks. Will look to patch this for a minor release this week.

@addisonlynch
Copy link
Owner

Ahh, now I am unable to reproduce (I was able to yesterday). For your call I get

>>> a = Stock(["ICUI", "CVLB"])
>>> a.get_quote(filter="latestPrice")
      latestPrice
ICUI       201.50
CVLB         7.82

and also:

>>> a = Stock(["ICUI", "BADSYMBOL"])
>>> a.get_quote(filter="latestPrice")
      latestPrice
ICUI       203.61

@shaunpatterson
Copy link
Author

Strange.

print(Stock(['ICUI', 'BADDD'], token=token).get_quote(filter='latestPrice'))

works for me

print(Stock(['ICUI', 'CVLB'], token=token).get_quote(filter='latestPrice'))

is still throwing the ValueError for me.

In iexfinance/base.py _format_output out is equal to

{'ICUI': {'quote': {'latestPrice': 205.34}}, 'CVLB': {}}

but

{'ICUI': {'quote': {'latestPrice': 205.34}}}

when I try 'ICUI' and 'BADSYMBOL'

{'ICUI': {'quote': {'latestPrice': 205.34}}, 'CVLB': {}}

This dict gets passed down to pd.DataFrame(). I don't see an easy way of fixing this...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants