Skip to content
/ Trading Public

Predict whether a company's stock will rise or fall the next day!

Notifications You must be signed in to change notification settings

SasaIA/Trading

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Predict whether a company's stock will rise or fall the next day!

Prediction with LSTM!

View Demo

Table of Contents

About The Project

App Page

This project aims to predict whether a company's stock price will rise or fall the next day to find out whether we can buy a stock or not. We selected three companies and collected data from 1999 to present.

Built With

We coded this project using Python, its packages, a Database and an API :

Getting Started

To get started, you are going to need :

Prerequisites

You need to install Python from here first then download the file get-pip.py. In the terminal, go to the folder where the file was downloaded and type the following command :

python get-pip.py

Installation

Now create a folder, open it on an IDE and follow the instructions :

  1. Get a free API Key at Alpha Vantage

    • Create an apiKey.txt file in the root of the Trading folder and put your API key there.
    • To connect to MongoDB Atlas: Create a mongoKey.txt file at the root of the Trading folder and put in each line your username, password and the rest of the MongoDB Atlas link after the '@'.
  2. Open terminal and clone the repository

git clone https://github.com/SasaIA/Trading.git
  1. Install Python packages using pip
pip install -r requirements.txt
  1. Make sure to install MongoDB on your computer
  2. To launch a file, you must start the terminal and navigate to the folder that contains that file
  3. Open the terminal and type :
python api.py
python lstm.py
  1. Thats it you have the latest stock price for each company and the prediction for tomorrow.
  2. Every night, launch the updatesPrice.py file to update the database with the last stock price.
  3. To launch the app, type in the terminal
streamlit run app.py

Usage

There are different files in this project:

  • The first api.py allows to retrieve the data via the API and to store the data in a JSON file and then to send them to a database.
  • The second lstm.py predicts whether the stock will rise or fall the next day.
  • The third updatesPrice.py, allows us to update our database with the last known stock price.
  • The fourth dataviz.ipynb allows you to analyze data with different graphs.
  • The fifth app.py file is used to launch the application and have a visual on the latest stock prices, to have an overview of the graphs and predictions.

About

Predict whether a company's stock will rise or fall the next day!

Topics

Resources

Stars

Watchers

Forks