Welcome to the Currency Conversion API! This service provides a convenient way to obtain currency conversion rates and historical conversion data for multiple currencies. The API allows you to access real-time exchange rates and retrieve conversion history for a specified time period.
- Get real-time exchange rates for a variety of currencies.
- Convert an amount from one currency to another.
- Retrieve historical conversion rates for a specific time range.
- Easy integration into your applications and systems.
- API Endpoints
- Get Latest Exchange Rates
- Internationalization, message support in English, Spanish and French.
GET /api/v1/currency
This endpoint returns all available currencies.
GET /api/v1/conversion/<CURRENCY>
This endpoint returns the latest exchange rates for an specific currency.
GET /api/v1/conversion/days/<DAYS>
This endpoint returns all stored currency cunversions for a number of days (maximum 30).
To quickly set up and test the Currency Conversion API, follow these steps:
-
Make sure you have Docker and Docker Compose installed on your system.
-
Clone the repository from GitHub.
-
Navigate to the project directory.
-
Create currency_conversion_api.env file with appropriate environment variables.
-
Build and run the Docker containers using the following command:
docker-compose up -d
or use a custom docker-compose file:
version: '3'
services:
currency-conversion-api:
image: fabbo/currency-conversion-api:latest
container_name: currency-conversion-api
env_file:
- ./currency_conversion_api.env
#volumes:
#- ./certs:/certs:ro # Uncomment for HTTPS
ports:
- "8070:80"
#- "8071:443" # Uncomment for HTTPS
restart: unless-stopped
networks:
- currency-conversion-api-net
networks:
currency-conversion-api-net:
-
Once the containers are up and running, you can access the API at http://localhost:8070/api/v1/currency.
-
Refer to the API documentation at API Documentation for detailed information on available endpoints and their usage.
NAME | DESCRIPTION |
---|---|
ALLOWED_HOSTS | List of strings representing the allowed host/domain names. Default: * |
CORS_HOSTS | CORS allowed hosts (url format). Optional |
CSRF_HOSTS | CSRF allowed hosts (url format). Optional |
RUN_JOBS | Enable jobs execution (true or false). Default: false |
USE_HTTPS | Enable HTTPS (true or false). Default: false |
DATABASE_URL | Databse url |
DEFAULT_API_KEY | Default Api Key. Optional |
CURRENCY_CODES | Currency codes allowed (they have to be valid) |
MAX_STORED_DAYS | Max number of days without removing conversions. Default: 20 |
MAX_NO_UPDATED_MINS | Max number of minutes without saving new conversions. Default: 5 |
CODE | DEFINITION | ENDPOINT |
---|---|---|
1 | Currency code not supported | /conversion/{code} |
2 | Too many days to fetch conversions | /conversion/days/{days} |
- Create API key:
python manage.py apikey --name <NAME> --usage <USAGE>
- Init DB with codes:
python manage.py currency_db_init
- Execute migrations with docker compose
docker-compose run --entrypoint "sh" currency-conversion-api -c "python manage.py migrate"
If you have any questions, concerns, or need assistance, please don't hesitate to reach out. We are here to help you make the most of our Currency Conversion API.
Happy coding!