Giter Site home page Giter Site logo

gaborvecsei / stocks-pattern-analyzer Goto Github PK

View Code? Open in Web Editor NEW
216.0 12.0 82.0 1.15 MB

This tool should help discover different patterns based on similarity measures in historical (financial) data

License: Other

Python 73.78% CSS 25.25% Dockerfile 0.56% Shell 0.41%
stocks-pattern-analyzer heroku restapi stocks finance stock-price-prediction stock-market stock-data forecasting similarity-search

stocks-pattern-analyzer's Introduction

Stocks Pattern Analyzer

homepage

As I am not a a frontend guy, the client does not look good at all on mobile devices. This is the best I could do. Help is greatly appreciated.

Run it locally

Include ticker symbols with the symbols.txt file - put each symbol here in a new line. Check symbols.txt.example for an example use case.

There are 2 special symbols which you can use as a shortcut

  • $SP500 to include all S&P500 symbols
  • $CURRENCY_PAIRS to include currency pairs where the base currency is EUR

Build & Run with Docker

(Execute these in the root folder of the project)

# Build the image
$ docker build -t stock -f docker/Dockerfile .
# Run it
$ docker run --rm --name stock -v $(pwd):/code -p 8050:8050 stock start.sh

After this you can access it at localhost:8050

Disclaimer: in a proper setup you would create 2 different images, on for the RestAPI and one for the Client App. Then with a docker-compoase.yml you could create the services. But just like with Heroku, this is a toy and local deployment, so I won't do fancy stuff here.

Run directly

  • python rest_api.py
    • Wait until the data creation and search model creation is done (1-2 mins)
  • python dash_app.py
    • The environment variable $REST_API_URL controls the connection with the RestAPI. It should be the base URL
  • Enjoy ๐Ÿ˜Ž

Deployment to Heroku (toy deployment)

First of all, this is a mono-repo which is not ideal, but the deployment is just an example. This is why a multi-buildpack solution is used with heroku-community/multi-procfile.

$ heroku create stock-restapi --remote restapi
$ heroku buildpacks:add -a stock-restapi heroku/python
$ heroku buildpacks:add -a stock-restapi -i 1 heroku-community/multi-procfile
$ heroku config:set -a stock-restapi PROCFILE=Procfile_restapi
$ git push restapi master
$
$ heroku create stock-dash-client --remote dash
$ heroku buildpacks:add -a stock-dash-client heroku/python
$ heroku buildpacks:add -a stock-dash-client -i 1 heroku-community/multi-procfile
$ heroku config:set -a stock-dash-client PROCFILE=Procfile_dash
$ heroku config:set -a stock-dash-client REST_API_URL=https://stock-restapi.herokuapp.com --> this is the URL where we can reach the RestAPI
$ git push dash master

Heroku Files:

  • runtime.txt describes the Python version
  • Procfile_restapi Heroku Procfile for the RestAPI app
  • Procfile_dash Heroku Procfile for the Dash Client app

TODOs

  • Backend
    • Proper logging and getting rid of prints
    • RAM and Speed measurements for the different Search Models
  • Frontend
    • React frontend instead of the dash app

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.