/stock-trend-predictions

Stock trend prediction based on the news headlines

Primary LanguagePythonApache License 2.0Apache-2.0

stock-trend-predictions

Stock trend prediction based on the news headlines

Introduction

Problem statement:

  • Input: a news headline: a string
  • Output: a predicted stock trend: an integer 0 or 1

Project structure:

.
├── data
│   ├── daily-financial-news
│   └── huge-stock-market
│       ├── Data
│       │   ├── ETFs
│       │   └── Stocks
│       ├── ETFs
│       └── Stocks
├── modules
├── papers
└── weights
    └── 20220314_distilbert

Installation

pip install transformers fastapi torch

DistilBert weights: https://drive.google.com/drive/folders/1KFmdF-8GHaY0viOoHxxu-xG-QE_FdLEM?usp=sharing Download and extract and rename to the same as it is in the project structure above.

Usage

Run in the terminal:

uvicorn api:app --host 0.0.0.0 --port 8000

The easiest way to test is to open a browser, e.g., Google Chrome, and enter:

http://0.0.0.0:8000/docs

Here you can try out some availables API

Progress

  1. Data Preparation (See README in the data folder)
  2. Model training
  • I tried random prediction for the baseline
  • I tried fine-tuning DistilBert for classification task where the target is the up/down trend Open In Colab

Project limited

  • I haven't worked on NLP so that it took me a while to understand some terms and research topics.
  • Only predict the trend, e.g., upward (1) or downward (0). Don't provide the quantity nor the volumne

References