Skip to content

zackoch/crypto_tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Crypto Price Tracker

Table of Contents
  1. About
  2. Getting Started
  3. Usage

About

I wanted to start logging various crypto prices on a regular cadence. This tool was created specificaly for me, but could be customized easily for your own use case.

It currently tracks the prices for:

  • Ethereum
  • Polygon

Technologies

Getting Started

To get this running for your own use you'll need to set up a few things.

  • You'll need to know how to set up a database and access to it.
  • Have a modern version of Python installed

Prerequisites

  • MySQL
    • Create a mysql database if you don't want to modify the code.
sudo mysql -p
create database some_database;
create 'some_user'@'%' identified by 'some_password';
grant all privileges on some_database.* TO 'some_user'@'%';

Installation

  1. Clone the repo

    git clone https://github.com/zackoch/crypto_tracker.git
  2. Create a virtual environment

    cd crypto_tracker && python3 -m venv venv
  3. Install required packages via pip

    source venv/bin/activate
    pip install -r requirements.txt
  4. Modify environment variables

    mv sample.env .env
    nano .env

    replace some_user, some_password, host, and some_database to match the database and user you created in the prerequisites

    DB_CON_STRING='mysql+pymysql://some_user:some_password@host/some_database'
  5. Create the tables

    python
    from models import *
    Base.metadata.create_all(engine)
    exit()

Usage

  • You can call the script directly which will insert the data into your db one time (useful to test)
    source venv/bin/activate
    python main.py

OR

  • You can schedule it as a cronjob to run at a specific time / cadence
sudo crontab -e
  • Modify your crontab to include an entry similar to below (runs every minute):
* * * * * cd /home/zac/crypto_tracker && /home/zac/crypto_tracker/venv/bin/python /home/zac/crypto_tracker/main.py

About

πŸ“–->πŸš€->πŸŒ™ Log to the moon...?

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published