Project information

  • Problem: Text Classification
  • ML Areas: Natural Language Processing
  • Learning technique: Supervised Learning
  • Tools: Python, Pytorch, Git, Pandas, NLTK, Spacy
  • Project date: April 2021 - July 2021
  • Project URL: Financial Sentiment Analysis project

Financial Sentiment Analysis

Licence

Libraries:

Pytorch Flask Streamlit Pandas

Programming Language:

Python

Contents


Description

The goal of this project is to give you the chance of looking at the dependence between the news sentiment of a company with respect to its share price. This project is one part of a main project still on its way, which aims to provide a financial analysis platform.

Dataset

News data are taken from the polyglon AIP, using the stocks basic API plan account.

Structure

The project structure is based on a server side, which manages the calls to the sentiment analysis model, and a client side, that show a UI. The server provides a service API for the inference of the model and the extraction of news and stock data, while the client is developed as a platform, generated with streamlit, that allows the user to interact with the server side, searching the interested companies to be analyzed.

Solutions

We developed the sentiment analysis model as a neural network model, based on fine-tuning of an existent pre-trained model. We trained and experimented different models, until we reached the best one. In order to keep our model private, we provide just a pre-trained model as a sentiment analysis model, that is the transformers model taken from hugging face


How to run

  1. Create a new virtual environment
    python -m venv ./venv
    source venv/bin/activate
    pip install --upgrade pip
    
  2. Clone the repository and move to the downloaded directory
    git clone https://github.com/sicilian-scientists/financial-sentiment-analysis
    cd financial-sentiment-analysis
    
  3. Request Polyglon's API key (FREE)
  4. Write the given key in 'files/api_key_polyglon.txt'
    echo API_KEY > files/api_key_polyglon.txt
    
  5. Install the requirements
    pip install requirements.txt
    
  6. Run local server and dashboard
    python api_server.py
    streamlit run main.py
    
  7. You're ready to go!

How to contribute

  1. Fork the repository
  2. Do the desired changes
  3. Make a pull request

Demo (GIF)

Authors

Linkedin Portfolio

Linkedin Portfolio