fantomstarterio / crypto-prices-cache

This project fetches cryptocurrency prices (Bitcoin, Ethereum, and DAI) from a public API every hour and commits the data to this repository. It uses GitHub Actions to automate the process.
0 stars 1 forks source link

Crypto Prices Cache

This project fetches cryptocurrency prices (Bitcoin, Ethereum, and DAI) from a public crypto prices API every hour and commits the data to this repository. It uses GitHub Actions to automate the process.

Files

Getting Started

Prerequisites

Setup

  1. Clone the repository:

    git clone git@github.com:fantomstarterio/crypto-prices-cache.git
    cd crypto-prices-cache
  2. Install the required Python packages:

    pip install requests
  3. Run the Python script to fetch the latest cryptocurrency prices:

    python fetch_crypto_prices.py

GitHub Actions

The GitHub Actions workflow is defined in .github/workflows/update_crypto_prices.yml. It is triggered every hour and performs the following steps:

  1. Checks out the repository.
  2. Sets up Python.
  3. Installs the requests library.
  4. Runs the fetch_crypto_prices.py script.
  5. Commits and pushes the crypto_prices.json file to the repository.

If the workflow fails, it will retry after 5 minutes.

Usage

You can use the raw crypto_prices.json file in your application to get the latest cryptocurrency prices without hitting the public API directly. This helps to avoid rate limiting issues.

Customization

If you want to fetch prices for different cryptocurrencies or use a different API, modify the fetch_crypto_prices.py script accordingly.