using the following code which gives the daily data. how do i get the monthly data instead.
import datetime
import yfinance as yf
tickers = ['AAPL', 'XOM']
start_date = datetime.date(2000, 1, 1)
end_date = datetime.date(2000, 4, 31)
daily_data = yf.download(tickers, start=start_date, end=end_date) # definere datasættet
daily_data = daily_data['Adj Close'].dropna()
print(daily_data)
Thanks in advance
Try this:
df = yf.download(tickers, start=start_date, end=end_date, interval='1mo')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.