The Rate2NG API is a backend service designed to provide real-time currency exchange rates for various currencies against the Nigerian Naira (NGN). It serves as the data source for the Rate2NG application, enabling users to access up-to-date currency conversion information.
The API consists of two main components:
Local Updater (app.py
): This script runs locally and periodically fetches currency exchange rates from Google Finance. It updates the API with the latest rates via a WebSocket connection.
API Server (main.py
): This is the FastAPI-based server that exposes endpoints for retrieving currency data. It also handles WebSocket connections for receiving updates from the local updater.
app.py
) continuously fetches and updates currency rates from Google Finance, ensuring the API always provides the latest data.app.py
) fetches currency rates from Google Finance for predefined currency pairs (e.g., USD-NGN, EUR-NGN).main.py
) via a WebSocket connection./rates
: Retrieves the latest exchange rates. Requires an API key for authentication./
: Returns detailed information about all supported currencies./update/rates/
: Used by the local updater to send real-time rate updates to the API server.To use the API, ensure the local updater (app.py
) is running to keep the rates updated. The API server (main.py
) can be started using Uvicorn:
uvicorn main:app --host 127.0.0.1 --port 8000
For more details, visit the Rate2NG GitHub repository.