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

Issue - loading cryptos such as BTC-USD result in returning NaN. #1097

Closed
josebsalazar opened this issue Oct 21, 2022 · 8 comments
Closed

Issue - loading cryptos such as BTC-USD result in returning NaN. #1097

josebsalazar opened this issue Oct 21, 2022 · 8 comments

Comments

@josebsalazar
Copy link

No description provided.

@bruce1095
Copy link

Yes. The issue also applies to currencies like 'EURUSD=X' , certain indices like'^STOXX50E', symbols from non-US exchanges, like 'IS0L.DE'

@ValueRaider
Copy link
Collaborator

ValueRaider commented Oct 21, 2022

Check you are running latest version, then provide code that reproduces error because I don't see error.

And provide the error message, in case I can't reproduce.

@josebsalazar
Copy link
Author

@ValueRaider , it just started working. I did updated and checked. It wasn't working.

(pandas) jxs@jxs-MacBook-Pro-M1 quant % pip show yfinance
Name: yfinance
Version: 0.1.79

@ValueRaider
Copy link
Collaborator

Were you using old version?

@josebsalazar
Copy link
Author

Were you using old version?

(pandas) jxs@jxs-MacBook-Pro-M1 quant % pip show yfinance
Name: yfinance
Version: 0.1.79

No, I wasn't. I updated then restarted.

@bruce1095
Copy link

Still not working, even on latest version.

Here's the code and output:

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import math

import warnings
warnings.filterwarnings("ignore")

fix_yahoo_finance is used to fetch data

import yfinance as yf
yf.pdr_override()

symbols = ['^GSPC','^STOXX50E','^RUT']
start = '2018-01-01'
end = '2022-12-30'

df = pd.DataFrame()
for s in symbols:
df[s] = yf.download(s,start,end)['Adj Close']

df.head()

#OUTPUT
^GSPC ^STOXX50E ^RUT
Date
2018-01-02 00:00:00-05:00 2695.810059 NaN 1550.010010
2018-01-03 00:00:00-05:00 2713.060059 NaN 1552.579956
2018-01-04 00:00:00-05:00 2723.989990 NaN 1555.719971
2018-01-05 00:00:00-05:00 2743.149902 NaN 1560.010010
2018-01-08 00:00:00-05:00 2747.709961 NaN 1561.810059

df.tail()

#OUTPUT

^GSPC ^STOXX50E ^RUT
Date
2022-10-17 00:00:00-04:00 3677.949951 NaN 1735.750000
2022-10-18 00:00:00-04:00 3719.979980 NaN 1755.959961
2022-10-19 00:00:00-04:00 3695.159912 NaN 1725.760010
2022-10-20 00:00:00-04:00 3665.780029 NaN 1704.390015
2022-10-21 00:00:00-04:00 3752.750000 NaN 1742.239990

@ValueRaider
Copy link
Collaborator

Oh I see the issue now. You can workaround immediately by just doing:

df = yf.download(symbols, start, end)['Adj Close']

@bruce1095
Copy link

Oh I see the issue now. You can workaround immediately by just doing:

df = yf.download(symbols, start, end)['Adj Close']

Awesome! Thank you

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

3 participants