ranaroussi / yfinance

Download market data from Yahoo! Finance's API
https://aroussi.com/post/python-yahoo-finance
Apache License 2.0
14.89k stars 2.44k forks source link

0.2.42 still issue with timezone-aware with multiply tickers #2035

Open githubbla opened 3 months ago

githubbla commented 3 months ago

`!pip install yfinance==0.2.42 --upgrade --no-cache-dir import yfinance as yf

df2 = yf.download(["SPY","QQQ"], "2023-01-01", "2023-12-31", auto_adjust=True,ignore_tz = True) df = yf.download("QQQ", "2023-01-01", "2023-12-31", auto_adjust=True,ignore_tz = True)

def check_datetime_tz(dt): if dt.tzinfo is None: return "Naive" elif dt.tzinfo.utcoffset(dt) is None: return "Naive" else: return "Timezone-aware"

print("\ndf2=",check_datetime_tz(df2.index[0]))

print("df=",check_datetime_tz(df.index[0])) ` Screenshot 2024-08-22 at 19 59 49