Dhruv Toshniwal

Applying AI for Sentiment Analysis on Financial News

July 2023

Applying AI for Sentiment Analysis on Financial News

The Importance

In the age of information, staying on top of financial news is crucial. The influx of news articles can greatly influence the financial market, affecting individual stocks and overall market trends.

Artificial Intelligence (AI) offers a powerful solution by not only summarizing articles but also determining their sentiment—whether the tone is positive, negative, or neutral. This can be a valuable tool for predicting market movements and making informed investment decisions.

The Approach

The project involves a Python-based approach with several key steps:

  • Fetching recent articles using the GNews API
  • Generating article summaries with OpenAI GPT-3 API
  • Performing sentiment analysis using Hugging Face Transformers library
  • Visualizing sentiment scores over time with Plotly

The Code

The project workflow includes:

  1. Using GNews API to fetch recent articles about finance, economy, and bitcoin
  2. Summarizing articles with OpenAI GPT-3 API
  3. Applying Hugging Face Transformers for sentiment analysis
  4. Creating an interactive line plot of sentiment scores

The complete project code is available on GitHub: Finance-News-Sentiment-Analysis

The Result

The project successfully demonstrated fetching, summarizing, and analyzing the sentiment of financial news articles. However, it's important to note the limitations:

  • Sentiment scores are based on the Hugging Face Transformers library
  • Analysis is performed on article summaries, not full texts
  • The sentiment analysis may not perfectly reflect the nuanced tone of each article