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

Retrieving crypto data #35

Open
Luis-ob-uc3m opened this issue Nov 3, 2021 · 1 comment
Open

Retrieving crypto data #35

Luis-ob-uc3m opened this issue Nov 3, 2021 · 1 comment

Comments

@Luis-ob-uc3m
Copy link

Luis-ob-uc3m commented Nov 3, 2021

I was trying to retrieve some data from crypto market, for instance Bitcoin.

import pynance as pn
btc = pn.data.get('BTC-USD')
print(btc)

(I tried all the combinations, with capital letters, with - ....)

But the following result is returned, None:
image

If the source code of data.get is checked, we can see it uses the pandas_datareader

import pandas as pd
import pandas_datareader.data as web
import pynance as pn
def get(equity, *args, **kwargs):
"""get(equity, start=None, end=None)
Get DataFrame for an individual equity from Yahoo!
.. versionchanged:: 0.5.0
Default `start` (2001-01-31) and `end` (current date).
Examples
--------
>>> import pynance as pn
>>> aapl = pn.data.get('aapl', '2014-03-01', '2015-03-01')
>>> goog = pn.data.get('goog', '2014')
"""
df = web.DataReader(equity, 'stooq', *args, **kwargs)
df.index = pd.to_datetime(df.index)
return df

If we implement manually what the datareader does we can observe that it perfectly performs the data retrieve:

from pandas_datareader import data
btc = data.DataReader('BTC-USD','yahoo')
print(btc)

And the obtained result:
image

I do not know If I am wrongly coding something, but it seems like a bug or a feature it might be added

@Luis-ob-uc3m
Copy link
Author

Having a look again to the code, we can observe a difference between the google documentation
image
and the implemented code, as it uses 'stooq' instead of 'yahoo'. I don't know if this can be the issue, but seems to be a clue.

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