How do I use the yahoo finance API to get the day's DJIA open each day? when I use
import yahoo_finance
dji = Share('dji')
DJIA = dji.get_open()
print(DJIA)
it gives error <urlopen error [Errno 11001] getaddrinfo failed>
on the second line
How do I use the yahoo finance API to get the day's DJIA open each day? when I use
import yahoo_finance
dji = Share('dji')
DJIA = dji.get_open()
print(DJIA)
it gives error <urlopen error [Errno 11001] getaddrinfo failed>
on the second line
If you are using the yfinance package, then you can get the last day's open this way.
import yfinance as yf
data = yf.download(tickers = "dji", interval = "1d", period = "1d")
print(data["Open"][0])