Skip to content

Fetch exchange rates and send an email if rate is above defined threshold for the desired currencies.

Notifications You must be signed in to change notification settings

razinj/exchange-rate-notifier

Repository files navigation

Exchange Rate Notifier

A script that fetches the exchange rates (USD base) from OpenExchangeRate and sends an email notification if the rate is above the defined threshold for the given currencies.

The script runs on a defined scheduled GitHub Actions workflow (in theory, but it will never be on the exact defined timing, see here for more information).

Note: This script was tested and used with Python 3.12

Setup

For local usage

  1. Sign up at OpenExchangeRate to get an APP ID (free plan is enough).
  2. Create a .env file based on the sample.
  3. Run the script as specified below in Run step.

For GitHub Actions

  1. Sign up at OpenExchangeRate to get an APP ID (free plan is enough).
  2. Create a GitHub Actions repository secret named ENV_FILE_CONTENT and populate it with the same content as in the sample file (.env.sample).
  3. Create a GitHub Actions repository secret named THRESHOLD_RATE and populate it (only reason why this is separate from the above secret is because it changes quite frequently, you don't have to grab all the other values to adjust the threshold).
  4. Either run manually or wait until scheduled time.

Run

Install dependencies:

poetry install

Run the script:

make run

Development

Format:

make format

Lint:

make lint

About

Fetch exchange rates and send an email if rate is above defined threshold for the desired currencies.

Topics

Resources

Stars

Watchers

Forks