Skip to content

πŸ’± A Prometheus exporter written in Python to collect currency exchange rates and expose them as metrics. This tool provides real-time data on various exchange rates, enabling integration with monitoring systems for financial applications.

License

Notifications You must be signed in to change notification settings

luizbizzio/currency-exporter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Currency Exporter πŸ’±πŸ“ˆ

Overview πŸ“Š

This script collects and exports real-time exchange rates for various currency pairs to Prometheus. Using the AwesomeAPI, it retrieves the latest exchange rates and makes them available for monitoring in Prometheus, which can then be visualized in Grafana.

Metrics

Features 🌟

  • Exchange Rate Collection: Fetches real-time exchange rates from the AwesomeAPI for a configurable list of currency pairs.

  • Prometheus Integration: Provides metrics in a format compatible with Prometheus scraping.

  • Flexible Configuration: Easily configurable to include the currency pairs you are interested in via a config.yaml file.

  • Efficient Performance: Designed to handle multiple currency pairs with minimal resource usage.

Configuration βš™οΈ

  1. API Configuration:

    Update the config.yaml file with the currency pairs you want to monitor. The format used is BASE_CURRENCY-TARGET_CURRENCY, where:

    • BASE_CURRENCY is the currency you are converting from.
    • TARGET_CURRENCY is the currency you are converting to.

    Each currency pair should be separated by a hyphen. For example, to get the exchange rate from US Dollars (USD) to Brazilian Reais (BRL), you would use USD-BRL.

    Example config.yaml:

    currencies:
    - USD-BRL
    - EUR-BRL
    - GBP-BRL

    In this example:

    • USD-BRL retrieves the exchange rate from US Dollars to Brazilian Reais.

    • USD-BRL retrieves the exchange rate from US Dollars to Brazilian Reais.

    • USD-BRL retrieves the exchange rate from US Dollars to Brazilian Reais.

  2. Exporter Port (Optional):

    Set the port for the Prometheus exporter in the script:

    PORT = 7575

Usage πŸš€

  1. Install Dependencies:

    Install the required Python packages:

    pip install requests prometheus_client pyyaml
  2. Run the Script:

    Launch the script to start the Prometheus exporter:

    python currency_exporter.py
  3. Access Metrics:

    http://localhost:7575/metrics
    

Notes πŸ“

  • Currency Pairs: Ensure that the currency pairs in config.yaml follow the format BASE_CURRENCY-TARGET_CURRENCY, where each currency is represented by its standard ISO code. For example, USD-BRL is for US Dollars to Brazilian Reais.

  • API Limitations: Be aware of any rate limits or restrictions imposed by the AwesomeAPI.

License πŸ“„

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

About

πŸ’± A Prometheus exporter written in Python to collect currency exchange rates and expose them as metrics. This tool provides real-time data on various exchange rates, enabling integration with monitoring systems for financial applications.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Languages