Code Monkey home page Code Monkey logo

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

stocks-pattern-analyzer's People

Contributors

gaborvecsei avatar gaborvecseidocler avatar

Stargazers

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

Watchers

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

stocks-pattern-analyzer's Issues

Failed to run the rest_api.py

I created an virtual env. 'venv'(under Windows 10 OS) and installed all packages in the requirements.txt file. After the installation, I run the 'python rest_api.py' and got the following error:
///
(venv) PS G:\gitProjects\stocksearch\Stocks-Pattern-Analyzer> python rest_api.py
Traceback (most recent call last):
File "G:\gitProjects\stocksearch\Stocks-Pattern-Analyzer\venv\lib\site-packages\faiss\loader.py", line 34, in
from .swigfaiss import *
File "G:\gitProjects\stocksearch\Stocks-Pattern-Analyzer\venv\lib\site-packages\faiss\swigfaiss.py", line 13, in
from . import _swigfaiss
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "rest_api.py", line 11, in
import stock_pattern_analyzer as spa
File "G:\gitProjects\stocksearch\Stocks-Pattern-Analyzer\stock_pattern_analyzer_init_.py", line 2, in
from .search_index import MemoryEfficientIndex, cKDTreeIndex, FastIndex
File "G:\gitProjects\stocksearch\Stocks-Pattern-Analyzer\stock_pattern_analyzer\search_index.py", line 5, in
import faiss
File "G:\gitProjects\stocksearch\Stocks-Pattern-Analyzer\venv\lib\site-packages\faiss_init_.py", line 17, in
from .loader import *
File "G:\gitProjects\stocksearch\Stocks-Pattern-Analyzer\venv\lib\site-packages\faiss\loader.py", line 39, in
from .swigfaiss import *
File "G:\gitProjects\stocksearch\Stocks-Pattern-Analyzer\venv\lib\site-packages\faiss\swigfaiss.py", line 13, in
from . import _swigfaiss
ImportError: DLL load failed: The specified module could not be found.
(venv) PS G:\gitProjects\stocksearch\Stocks-Pattern-Analyzer>
///
Any idea? Thank you.

About patterns to match.

Hello guys
I still have a question to ask:
Is there a relationship with Patterns to match (MAX: 10) and this picture below? This value is predicted in the order of this picture? Or is it predicted? Is it possible to predict according to a patterns?

Trading-Patterns-Cheat-Sheet

Can this be tweaked for Indian stock market?

I tried manually with a custom symbols list and made a few more changes for a different wiki link and table header name but didn't seem to work.
Wondering if it can be slightly tweaked to work with NSE/BSE in India?

[Question] How do you refresh data_holder online

I'm now able to run this app and it works alright. One question is that when I download data everyday into local disk, how can I let rest_api to automatically refresh data?
Is there a plan to do so if not implemented yet?

BTW, why react? anything wrong with dash app?

New complementary tool

My name is Luis, I'm a big-data machine-learning developer, I'm a fan of your work, and I usually check your updates.

I was afraid that my savings would be eaten by inflation. I have created a powerful tool that based on past technical patterns (volatility, moving averages, statistics, trends, candlesticks, support and resistance, stock index indicators).
All the ones you know (RSI, MACD, STOCH, Bolinger Bands, SMA, DEMARK, Japanese candlesticks, ichimoku, fibonacci, williansR, balance of power, murrey math, etc) and more than 200 others.

The tool creates prediction models of correct trading points (buy signal and sell signal, every stock is good traded in time and direction).
For this I have used big data tools like pandas python, stock market libraries like: tablib, TAcharts ,pandas_ta... For data collection and calculation.
And powerful machine-learning libraries such as: Sklearn.RandomForest , Sklearn.GradientBoosting, XGBoost, Google TensorFlow and Google TensorFlow LSTM.

With the models trained with the selection of the best technical indicators, the tool is able to predict trading points (where to buy, where to sell) and send real-time alerts to Telegram or Mail. The points are calculated based on the learning of the correct trading points of the last 2 years (including the change to bear market after the rate hike).

I think it could be useful to you, to improve, I would like to share it with you, and if you are interested in improving and collaborating I am also willing, and if not file it in the box.

Add a virtual environment package like Poetry to support off-docker development

The current setup of the app can either run in docker or Heroku without much issues. But if i want to run the app outside docker using "python rest_api.py" and "python dash_app.py" I have to install all the pip requirements to my own virtual env. If we add poetry as a virtual environment it might things more easy and streamlined. Thoughts?

Running process stuck

When I run the command python3 rest_api.py in my command, it got such a message
WARNING clustering 8466 points to 256 centroids: please provide at least 9984 training points
Search tree with size 45 prepared
Search trees are refreshed

And then the process gets stuck. What should I do next or what is the issue with this?
Thanks

About this project for china stock market

Hello,guys
Thank you very much for this project, I have 2 questions:

  1. What is the purpose of the s&p list? If I were to target the Chinese stock market, should this section be replaced by a Chinese version of the list?
  2. Symblos can set my own list individually, do I still need the list mentioned above?

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.