Market Sentiment Analyzer: Magnificent 7 Stocks This Python script is a powerful data-gathering tool designed as the first step in a market sentiment analysis pipeline. Its primary job is to systematically collect recent news headlines for the "Magnificent 7" stocks from Yahoo Finance and organize that data into a clean CSV file. The CSV file is then fed into Gemini via its API where it decides if the headline is positive or negative and provides a number [-2,-1,0,1,2].
Scraper Used newsapi so that we could scrape data from Yahoo Finance and make it into a CSV file. FORMAT [Tesla,2025-06-28,"Down 19% in 2025, What's Next for Tesla Stock?"]
Analyzer We use Gemini's API to prompt the CSV data into Gemini, where it spits out a response of [-2,-1,0,1,2] to represent how positive or negative the headline was. [TSLA, 2025-06-28, 2]
Processing Using the CSV file from our analyzer, the sentiment values for each company are averaged and a summary report is generated which shows the overall sentiment for that specific company over various time frames such as past 24 hours, past 7 days, and past 30 days. [TSLA,Negative,Neutral,Very Negative!]
Front End Using the output from the processer and the streamlit framework, we were able to display the sentiment values as well as the stock prices with their changes over the specific time frame.
Log in or sign up for Devpost to join the conversation.