Giter VIP home page Giter VIP logo

zainulmustafa / stock-prediction-using-news-info-sentiment Goto Github PK

View Code? Open in Web Editor NEW
19.0 0.0 10.0 10.11 MB

Application of LSTM on stock data with integration of news info. It turns out that finance and political news directly relate to the stock prices.

Jupyter Notebook 99.99% Shell 0.01%
keras-tensorflow numpy sklearn requests-html bert-language-model huggingface-transformers news python sentiment-analysis

stock-prediction-using-news-info-sentiment's Introduction

Stock Prediction using News Info Sentiment (LSTM)

Results

How to run?

  1. Step 1: Scrapping the news heading (news_scrapping.ipynb)
  2. Step 2: Performing sentiment analysis on news headings (sentiment_analysis.ipynb)
  3. Step 3: Preparing data for training (data_prep.ipynb)
  4. Step 4: Training on the merged dataset (training.ipynb)

Approach for LSTM

The dataset is structured to feed historical sequences of feature values to the LSTM model, allowing it to learn patterns over time. The LSTM model is then trained to predict the target variable (e.g., the future stock price) based on the historical information. The normalization step ensures that all values are within a consistent range, which can improve the training process for neural networks.

News Integration

Wall Street reports that: Political factors that range from relations with other nations to government policies can affect share prices. If you closely look at the headlines.json: whenever government took any initiative, shares rise. CPEC for an instance has caused alomost doubling up of stock prices in the last five years.

Algorithm

Majority of it is explained by the concept approach but what makes a difference is how to use this news info with the prediction algorithm. NLP is used to analyse the daily news titles calculating the amount of negativity, neutrality, positivity, and compound (a kind of net result).

Logic says that current news and stock data can't directly affect the next day's price as stocks move in random. But current day's news directly effect the current day's stock for example PSX grew 1140 points after Panama Verdict. Though it can be said that current information will have some effect on the next day. If we use this current information and next day's news information, it now seems logical to predict what stock price would be in the end of the day.

stock-prediction-using-news-info-sentiment's People

Contributors

zainulmustafa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.