Coder Social home page Coder Social logo

toshan-luktuke / stock-market-analyser Goto Github PK

View Code? Open in Web Editor NEW
33.0 4.0 6.0 1.68 MB

This web app uses machine learning to analyse the stock market.

Home Page: stock-market-analyser.vercel.app

JavaScript 94.99% HTML 0.27% CSS 0.01% Python 0.79% Jupyter Notebook 3.93% Procfile 0.01%

stock-market-analyser's Introduction

Stock Photo
Stock Market Analyzer

Stock Market Analyzer - This web app uses machine learning to analyse the stock market.
Inheritance '21 - Team S.T.A.R.

GitHub issues GitHub stars GitHub contributors

Table of Contents

📝Description

A blazing fast web application to analyze the current trends in the stock a user chooses. The app applies a variety of algorithms to make the analysis of the user easier based on historical data from the exchanges. An ML price predictor is also implemented.

The key features of stock market analyzer:
  • Select your desired listed stock
  • Get the analysis of that stock
  • Get future predictions based on the stock's previous history

🔗Links

Frontend (Vercel)

Assets

Backend (Heroku)

While learning🥺

🤖Tech-Stack

Python Numpy pandas scikit-learn matplot Seaborn Tensorflow HTML5 CSS3 Tailwind PostCSS JavaScript Node JS Nodemon ESLint Flask

📈Progress

  • Search any stock and get real-time updates, along with historical data and reviews
  • Autosuggest Searchbar
  • Latest Financial News Section
  • r/WallStreetBets Sentiment Analysis
  • Dark Mode implementation
  • Server-side endpoint
  • API for the linear regression model
  • API for the ANN model
  • Hosting the model
  • Market Dashboard
  • Linking the predictions page through the REST API for the model (has been tested on the localhost)
  • Real-time charts (partially added, dark-mode sync and responsiveness are remaining)

🔮Future Scope

  • Add a portfolio where a user can create an account and pin the stocks of his interest, using MongoDB
  • Improve the searchbar autosuggest performance with a regex-based implementation at the server-side
  • Cache requests at the proxy server for a snappy real-time performance
  • An UpStox-inspired computer application, using ElectronJS

🛠Project Setup

For the web-app

  1. Clone the GitHub repo
    $ git clone https://github.com/toshan-luktuke/stock-market-analyser.git
    
  2. Enter the client directory. Install all the required dependencies. Ensure that remove any globally-installed packages like the React CLI, Tailwind CLI, PostCSS CLI or ESLint are uninstalled before proceeding ahead
    $ cd client
    $ npm install
    
  3. Repeat the same process for the server directory once all the dependencies for the client directory are installed
    $ cd ../server
    $ npm install
    
    Also setup the .env file for storing the environment variables. A demo file for this is as follows:
    PORT = 5000
    API_KEY_AV = your AlphaVantage API key
    API_KEY_YF = your YahooFinance API key
    API_KEY_FMP = your FinancialModellingPrep API key
    
  4. If you are working on Visual Studio Code or WebStorm, it'd be convenient to install the extensions for Prettier and ESLint.

For the model

  1. Create a virtual environment on the anaconda command prompt (Install conda if not installed) and then switch to that virtual environment. Lets say the name of the env is test.
    $ conda create -n test python=3.8 anaconda
    $ conda activate test
    
  2. Enter the Model directory look for requirments.txt and install the packages.
    $ pip install -r requirements.txt
    

For the Flask API

  1. Look for the main.py and test.py files in the Model directory and have them ready. (The packages for flask would already be installed when you run previous command number 2 in the above section)

💻Usage

Once the required setup and installation is completed, you can start developing and running the project.

For the web-app

  1. Backend: Go to the server directory and run the dev script to activate nodemon
    $ cd server
    $ npm run dev
    
    Before pushing any commit, make sure to run the lint script and fix any linting errors
    $ npm run lint
    
    The requests will be listened at the localhost port which was specified in the .env file. For example, if it was specified as 5000, the requests should be made at http://localhost:5000/

    Use the browser or any other API-testing client like Postman or Insomnia to test any newly added routes.

  2. Frontend: Go to the client directory and run the start script to start the React App.
    $ cd client
    $ npm start
    
    The web-app can be viewed at http://localhost:3000/

    If you get an ESLint, Tailwind or PostCSS version conflict error, make a .env file in the client directory with the following contents:
    SKIP_PREFLIGHT_CHECK = true
    

For the model and for the Flask API

  1. Locate to the Model directory. The models for the project are in linear_reg_model.py and ann_model.py files.

  2. Open the command prompt for anaconda and switch to the virtual environment that you created and locate to the Model directory. (example: test)

    $ conda activate test
    
  3. Open another command prompt for anaconda and switch to the virtual environment that you created and locate to the Model directory. (example: test)

    $ conda activate test
    
  4. To initiate the server, type the following in the first command prompt

    $ python main.py
    
  5. To run the linear regression model, type the following in the second prompt while the server is running.

    $ python test.py
    

🔮Future scope

You can follow the below mentioned steps to create a model of your desired stock. You can also refer the video tutorial in the gdrive link It is important to know that these steps must be performed only after setting up the virtual environment

Linear regression models

  1. Pull the ml-dev branch onto your local machine
$ git switch ml-dev
  1. Once inside your text-editor, open the linear_reg_model.py file inside Model folder. At the end of the file call the find_r function
# At the file saving part edit the name of the file path as the code name of the stock.
# example: filename="../Models/Linear regression/stock_name.pkl"
# At the end of the file
find_r(Stock name)
  1. This will create a .pkl file in the Models folder.

  2. Now add the stock name as a string in the array list_stocks in the file main.py

  3. You can now execute the main.py and test.py files on your local machine as stated in the above section

# In the first conda prompt
$ python main.py
# In the second conda prompt
$ python test.py 

Here you can enter the code name of the stock and the prediction will be displayed

ANN models

  1. Switch over to the ml-host-ann branch locally
$ git checkout ml-host-ann
  1. Open the ann_model.py file currently in the Model folder, and call the find function towards the very end
# While saving the file, rename the path of the file as the code name of the particular stock.
# As: "../Models/ANN/stock_name.h5"
# Towards the end, call the find function
# find(Stock_name)

This will create a .h5 file in the Models folder

  1. Once this is done, add the stock name in the array list_stocks in main.py on the same branch

  2. Execute the 2 files main.py & test.py locally as shown above (similar to Step 5 of Linear Regression)

On entering the valid stock name, your prediction will be displayed

👩‍💻Contributors

Team members

👨‍🏫Mentors

stock-market-analyser's People

Contributors

sarvagnya avatar rushabhm03 avatar toshan-luktuke avatar alisha-kamat avatar

Stargazers

Shaunak Bhandare avatar  avatar Berkant ASLAN avatar Veeransh Shah avatar manascb1344 avatar  avatar Avit Shah avatar Suryansh Soni avatar Vaibhav Vudayagiri avatar Suman Kisku avatar Harshil shah  avatar  avatar Smit Sekhadia avatar Nirmay avatar Chaitya Vora avatar  avatar Tushar-04 avatar  avatar Jash Shah avatar Dushant Harinkhede avatar  avatar Dhruv Kunjadiya avatar  avatar Pratham Shah avatar Neel Shah avatar Rishabh Bali avatar Kunal Agarwal avatar Parth Shirole avatar Aryaman Shardul avatar Arnav Zutshi avatar  avatar  avatar  avatar

Watchers

Freddy Castano avatar  avatar  avatar  avatar

stock-market-analyser's Issues

Tasks for Web Devs

  • Make a separate branches called dev and testing for working on the project
  • Create a search bar and a ticker with stock information - @toshan-luktuke
  • Create a chart based on the information of 1-2 stocks using the API - @saRvaGnyA

Tasks for the ML-team

Tasks to be completed are listed below:

  • Create a branch for the ml-development
  • Create a simple linear regression ml model for stock prediction for the following day
  • Research on the flask API
  • Research simple algorithms to be used up for other features of the project

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.