INFO 523 - Fall 2023 - Project Final
Analyze sentiment in news headlines about Apple Inc. stock to assess public perception.
Explore correlation between sentiment analysis results and Apple’s stock performance for investor insights.
How does sentiment analysis of news headlines provide insights into Apple Inc.’s stock price movements, revealing the influence of external factors on its market performance?
What valuable insights can be derived from correlating sentiment analysis of news headlines with Apple’s stock behavior, elucidating the impact of external factors on the broader market context?
Uncover potential correlations between public perception, external factors on Apple Inc.’s stock performance
Understanding how sentiment influences market movements
Package Integration
Data Acquisition
Data Refinement
Sentiment Analysis
Plotted results and Interpretation
The data is retrived from Yahoo-Finance python library in real-time.
NewsAPI url- > https://newsapi.org/
Constructed API for data retrieval-> news_url = f”https://newsapi.org/v2/everything?q={stock_symbol}&apiKey={api_key}&from={from_date}&to={to_date}&language=en”
VADER (Valence Aware Dictionary and sEntiment Reasoner)- is a rule-based sentiment analysis tool designed to assess the sentiment of text. It performs several operations to as piece of text:
- Tokenization- breaks input into words.
- Sentiment Intensity Scoring- sentiment intensity scores to individual words.
- Punctuation Emphasis - effect of punctuation in modifying the intensity of sentiment (e.g., “AMAZING!!!” might have higher intensity than “amazing”).
- Negation Handling - effect of negation words (like “not” or “don’t”) on reversing the polarity.
- Emoticon and Capitalization Awareness - Recognizes and interprets emoticons.
- Sentiment Score Calculation - Aggregates the individual word scores to generate an overall sentiment score for the entire text. The scores typically include positive, negative, neutral, and a compound score
Correlation = -0.15
Correlation = 0.45
- Acquired data from yfinance
and headlines from NewsAPI
- Explored intersection of finance and sentiment analysis focused on Apple stock using vaderSentiment
in Python.
- Plotted sentiment scores against Apple’s stock price, visually highlighting the potential correlations between sentiments shifts and market trends.
- Limitations of newsapi.org
API to fetch real time news but this platform only lets us fetch data for the past 29 days which would stop us from training the model on a wider timescale.Another limitation of this API is that the API was limited to 100 pulls
in 24 hours.
- For the past few months, market sentiment has stayed overtly positive which doesn’t help us in training the model well to fit in the Bear Market Scenario.
- Stock Market Analysis is a wide spectrum and all Investments should be done with caution. This is just a educational project to show the correlation between market sentiment and the stock price. Other factors such as Dollar Index
, , external factors such as trading restrictions on products around the globe and the undergoing wars between different nations. DO NOT take the outcome of this project as financial advice. Please be careful before making any investments.
- Thank you for joining me on this exploration of sentiments in the world of Apple stocks.