This Python script fetches stock data using the Alpha Vantage API and news related to a specific company using the News API. If the percentage change in the stock price between yesterday and the day before yesterday is greater than or equal to 5%, it selects a random news article about the company and sends an email with the article's title and description.
-
Requirements: Make sure you have Python installed on your system along with the
requests
library. You can install it using pip:pip install requests
-
Alpha Vantage API Key: Obtain an API key from Alpha Vantage. Replace
Your API KEY
in the script with your actual API key. -
News API Key: Obtain an API key from News API. Replace
Your API KEY
in the script with your actual API key. -
Email Configuration: Replace
your_email
andyour_password
in the script with your actual email credentials. -
Company Name and Stock Symbol: Replace
Select company name
andSelect stock symbol
in the script with your actual company name and stock symbol.
Run the script using Python:
python main.py