Best Flask open-source libraries and packages

Asset Analyser

A Python application for the analysis and prediction (AI/ML) of market assets, including Cryptocurrencies and Stocks.
Updated 1 year ago

Asset Analyser

A Python application for the analysis and prediction of market assets, including Cryptocurrencies and Stocks.

Developers

CSynodinos

Description

This application is able to analyse any asset data and make predictions on the price of such asset for the next day from the specified date. Predictions are made through the use of ML. Currently, the application supports only 1 model, the Long Short-Term Memory Recurrent Neural Network (LSTM-RNN). Future expansions will include more ML model options. The resulting analysis can either be displayed in a dashboard or in a jupyter notebook using matplotlib. The default behaviour is displaying the dashboard in a localhost instance, which is created using the Dash and Flask frameworks. All the data is stored in sqlite3 databases in the Databases subdirectory.

Installation

Download the repository in your system and install the dependencies.

>>> curl https://raw.githubusercontent.com/CSynodinos/Asset-Analyser

For Windows:
>>> python -m pip install -r requirements.txt

For Linux/Mac:
>>> python3 -m pip install -r requirements.txt

This version of the application supports both tensorflow and tensorflow-gpu. The installer can install tensorflow-gpu by using the -gpu flag. However, you will need to follow Nvidia's instructions for the CUDA toolkit and CUDA Deep Neural Network library installations for Windows/Linux. Otherwise, tensorflow-gpu will not work!

Note: To see all the options available in the application:

For Windows:
>>> python .\lib\installer.py -h

For Linux/Mac:
>>> python3 lib/installer.py -h

Example

>>> asset_analysis.py -test
                                    Asset Analyser

    Connecting to Yahoo Finance...

    Fetching BTC-USD Cryptocurrency data...

    [*********************100%***********************]  1 of 1 completed
    Adding BTC-USD data to YOUR/PATH/TO/*.db database...

    BTC-USD Cryptocurrency data saved!

    Cryptocurrency Database has been successfully updated!

    [*********************100%***********************]  1 of 1 completed
    1/1 [==============================] - 1s 910ms/step
    BTC-USD Cryptocurrency Adj.Close price prediction for 2022-08-23: $23380.16
    BTC-USD Cryptocurrency Volatility = 62.31%
    Dash is running on http://127.0.0.1:8050/

    WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
    * Serving Flask app 'dashboard.app'
    * Debug mode: off
    * Running on http://127.0.0.1:8050 (Press CTRL+C to quit)
    127.0.0.1 - - [22/Aug/2022 11:31:09] "GET / HTTP/1.1" 200 -
    127.0.0.1 - - [22/Aug/2022 11:31:09] "GET /assets/style.css?m=1660504342.4959888 HTTP/1.1" 200 -
    127.0.0.1 - - [22/Aug/2022 11:31:09] "GET /_dash-component-suites/dash/deps/react-dom@16.v2_5_0m1659572569.14.0.min.js HTTP/1.1" 200 -
    127.0.0.1 - - [22/Aug/2022 11:31:09] "GET /_dash-component-suites/dash/deps/prop-types@15.v2_5_0m1659572569.8.1.min.js HTTP/1.1" 200 -
    127.0.0.1 - - [22/Aug/2022 11:31:09] "GET /_dash-component-suites/dash/deps/react@16.v2_5_0m1659572569.14.0.min.js HTTP/1.1" 200 -
    127.0.0.1 - - [22/Aug/2022 11:31:09] "GET /_dash-component-suites/dash/dash-renderer/build/dash_renderer.v2_5_0m1659572568.min.js HTTP/1.1" 200 -
    127.0.0.1 - - [22/Aug/2022 11:31:09] "GET /_dash-layout HTTP/1.1" 200 -
    127.0.0.1 - - [22/Aug/2022 11:31:10] "GET /_dash-dependencies HTTP/1.1" 200 -
    127.0.0.1 - - [22/Aug/2022 11:31:10] "GET /assets/favicon.ico?m=1660494775.9404457 HTTP/1.1" 200 -
    127.0.0.1 - - [22/Aug/2022 11:31:10] "GET / HTTP/1.1" 200 -
    127.0.0.1 - - [22/Aug/2022 11:31:10] "GET /_dash-component-suites/dash/dcc/async-graph.js HTTP/1.1" 304 -
    127.0.0.1 - - [22/Aug/2022 11:31:10] "GET /assets/style.css?m=1660504342.4959888 HTTP/1.1" 304 -
    127.0.0.1 - - [22/Aug/2022 11:31:10] "GET /_dash-component-suites/dash/dcc/async-plotlyjs.js HTTP/1.1" 304 -
    127.0.0.1 - - [22/Aug/2022 11:31:10] "GET /_dash-layout HTTP/1.1" 200 -
    127.0.0.1 - - [22/Aug/2022 11:31:11] "GET /_dash-dependencies HTTP/1.1" 200 -
    127.0.0.1 - - [22/Aug/2022 11:31:11] "GET /_dash-component-suites/dash/dcc/async-markdown.js HTTP/1.1" 304 -
    127.0.0.1 - - [22/Aug/2022 11:31:11] "GET /_dash-component-suites/dash/dcc/async-graph.js HTTP/1.1" 304 -
    127.0.0.1 - - [22/Aug/2022 11:31:11] "GET /_dash-component-suites/dash/dcc/async-plotlyjs.js HTTP/1.1" 304 -
    127.0.0.1 - - [22/Aug/2022 11:31:11] "GET /_dash-component-suites/dash/dcc/async-markdown.js HTTP/1.1" 304 -
    127.0.0.1 - - [22/Aug/2022 11:31:11] "GET /_dash-component-suites/dash/dcc/async-highlight.js HTTP/1.1" 304 -
    127.0.0.1 - - [22/Aug/2022 11:31:11] "GET /_dash-component-suites/dash/dcc/async-highlight.js HTTP/1.1" 304 -

Note: To see all the options available in the application:

>>> asset_analysis.py -h

The resulting dashboard localhost page from running the test profile:

My Image

The graph itself:

My Image

Application Features

✔️ Download data from YahooFinance.

✔️ SQLite3 database integration.

✔️ ML/AI integration, only LSTM-RNN supported currently.

✔️ Matplotlib (seaborn) support.

✔️ Dashboard support using Dash and Flask.

CLI options

Essential:
1. -ast: Market Asset. Needs to be written as: Asset_initials-currency

2. -tp: Asset Type, etc. Cryptocurrency or Stock.

3. -pd: Prediction days used for training. Must be a positive integer.
Optional:
1. -db: SQLite3 Database name. Defaults: asset_name_data.db

2. -d: Start date for data calls. Format: YYYY-MM-DD. Defaults: 2019-11-1.

3. -tdy: End date for data calls is current date. 
    If False, add custom date with -y -m -d parameters. Defaults: True.

4. -p: Port for localhost containing the dashboard. Defaults to 8050.

5. -plt: Display seaborn plots. Useful for jupyter notebooks. Defaults to False.

6. -test: Runs a test profile.

7. -end_y: Year of end date for data calls. Only use when -tdy is set to False.

8. -end_m: Month of end date for data calls. Only use when -tdy is set to False.

9. -end_d: Day of end date for data calls. Only use when -tdy is set to False.

Work-In-Progress Features

🔺 Addition of more AI/ML options. Currently working on adding a Convoluted NN as an option.

🔺 Postgres4 integration. Parallel queries on SQLite3 are very tricky to pull off due to the database's limited capabilities. Postgres4 could be a very good alternative around this issue. For now, SQLite3 is capable of handling the queries.