API for yahoo finance times out and data cannot be fetched

Course Name: Backtesting Trading Strategies, Section No: 3, Unit No: 16, Unit type: Exercise

I have repeatedly tried to execute the code for this exercise and am always thrown the following error, after the API seems to time out after, say 60 seconds or so:
“An error occured while running the code:”

No further details are printed to the console. I am not sure whether this is a temporary issue, or one related to yahoo finance. Can you please let me know whether the code as proposed in the solution works on your side?

Hi Benjamin
Thank you for highlighting this issue. After a recent update, the Yahoo Finance (yfinance) API has been facing intermittent stability and timeout problems, which are likely causing the error you’re encountering.

To avoid further inconvenience to learners, we are removing this exercise from the curriculum. Thank you for your patience, and please feel free to continue with the next module.