Advanced
Python Stock Analysis
Write a Python script to calculate technical indicators for stock data.
📝 Contenu du Prompt
Act as a Quantitative Analyst. Write a Python script using the 'yfinance' and 'pandas' libraries. The script should fetch historical data for Apple (AAPL) over the last year and calculate the 20-day and 50-day Simple Moving Averages (SMA). Add a column to the DataFrame that generates a 'Buy' signal when the short-term SMA crosses above the long-term SMA.