Good evening everyone,
Small question ... I use Python and in particular the y.finance library (Yahoo Finance) which allows to extract financial data. When using this package, an expected format is predefined. It should be like this: ('year-month-day') I would like to replace the "year" with an "a" variable that the program user can enter a little higher up. However, this sends me an error message telling me that the format ('year-month-day') is not respected, while "a" has entered the year format.
Here is my script:
import yfinance as yf
a=int(input("A partir de quelle année voulez-vous commencer le scraping de données?\n"))
#définir ticker
cac='^FCHI'
#récupération des données
data=yf.Ticker(cac)
#récupération prix
dataDF= data.history(periode='1d', start='a-1-1', end='2022-1-1')
#afficher les données pour le CAC 40
dataDF
Do you have a solution ??
Thank you in advance for your answers !!