Skip to content

Tracks crypto symbols in a personalized view using Dash

Notifications You must be signed in to change notification settings

SalMireles/CryptoTracker

Repository files navigation

MLOps - Crypto Trading

Uses Flask to allow users to follow various cryptocurrency trends. Dash is integrated into the app as a seperate feature to run custom stock analysis and predictions.

Dash Demo

This project was started as a collaborative sprint between multiple developers and eventually I forked it to complete it and put a nice bow on it. See original PR history here: https://github.com/PDXPythonPirates/ppp-project-2

Personal Goals:

  • Learn the ins and outs of Flask for web app developement
  • Containerization using Docker
  • Schema design and working with Databases
  • Deploying and productionizing an app
  • Contiuous Integration
  • Extend the app to run stock analysis
Tech Stack Information
  • Flask Backend
  • Utilized github actions for continuous integration and testing
  • Containerized using docker compose
  • Javascript and Jinja frontend rendering
  • Integrated dash app for quick analysis
  • Utilizes CoinGecko API to gather coin data
  • Added MySQL database for prod deployment
  • pre-commit linting to adhere to black and flake8
  • Added unit tests to verify page functionality

How to boot the app

Note: You need an .env file with credentials to boot the mysql container locally.

Required environment variables
  • DATABASE_URL
  • DB_USER
  • DB_PASSWORD
  • DB_HOST
  • DB_NAME
  • DB_PORT
  • DATABASE_URL_DOCKER
Pre-configuration install Notes for Windows
  • Install choclatey as an administrator (from powershell): https://chocolatey.org/install
  • Use choco to install make (also from the powershel as admin): `choco install make`
  • Install poetry. This can be a pain on Windowns. Use docker containers or another virtual environment.
  • Use WSL to execute make commands on windows. Alternatively, you can run the commands in the make file one by one.
  • With docker compose (recommended for prod)

    1. run make up
      • Runs the docker containers locally and opens on http://localhost:5000 (this also boots a mysql container)
    2. run make down
      • Stops containers and prunes
  • In your local environment (recommended for dev)

    1. run make install
      • Installs dependencies and jump into the virtual env
    2. run flask run
      • Boots the app locally. Make sure you are in the top level directory that has the file "app_run.py"

Working with Docker

  • Install Docker by following the instructions on their site
  • run make stop to stop containers and prune

Working with Poetry

  • Install a new dep/library run poetry add <your_dep> or poetry add <dep> --dev
  • Resolve poetry.lock files. Use 1. to resolve on github or 2. to resolve locally (recommended)
    1. On github click on resolve conflicts and follow this guide
    2. Locally, pull the recent changes. Remove the lock file with the conflict rm poetry.lock. run make install to regenerate the lock file. Push changes and give yourself a high five!

Enable Virtual Environment and Install Packages

Mac

  • Note: make sure poetry is installed and first time setup is complete
  • Take a look at the Makefile to see what shell commands are being executed
    make install

Adding Python Dependencies

  1. we use poetry to track python deps
  2. to install a new dep run poetry add <your_dep> or poetry add <dep> --dev
  3. you can also modify the pyproject.toml directly, then run poetry lock --no-update

First-Time Setup

Mac

  • Install brew
  • Install pyenv
    brew install pyenv
    echo 'eval "$(pyenv init --path)"' >> ~/.zprofile
    echo 'eval "$(pyenv init -)"' >> ~/.zshrc
  • Install zsh
    brew install zsh
  • Install Python 3.8.10
    pyenv install 3.8.10

Troubleshooting

Help with various installation/setup issues:

Mac

  • Error port 5000 already in use. How to free up this port: system preferences > sharing > uncheck airplay receiver.

References

  1. Flask Mega Tutorial - by Miguel Grinberg - 2018

Other References

  1. Testing Markdown - dillinger.io

About

Tracks crypto symbols in a personalized view using Dash

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published