I am currently trying to scrape BitCoin historical financial data from Yahoo Finance while still being able to choose when I want to start mining the data. My code is as follows, however an error appears telling me "HTTP Error 404: Not Found" ... Can you tell me where this error is coming from and how to fix it?
import time
import datetime
import pandas as pd
period1 = int(time.mktime(datetime.datetime(2020, 1, 1, 23, 59).timetuple()))
period2 = int(time.mktime(datetime.datetime(2022, 1, 1, 23, 59).timetuple()))
basic_url = 'https://fr.finance.yahoo.com/quote/BTC-USD/historyperiod1=1606780800&period2=1609372800&interval=1dk&filter=history&frequency=1wk&includeAdjustedClose=true'
modified_url = 'https://fr.finance.yahoo.com/quote/BTC-USD/history?period1={period1}&period2={period2}&interval=1d&filter=history&frequency=1d&includeAdjustedClose=true'
df=pd.read_csv(modified_url)
df
Thanks in advance !
Thibaut