This repository contains the code for Forex API backend. The application aims to provide information for all currencies, latests and historical time series exchange rates for currency pairs, currency conversion and time weighted rates calculation.
This project has been developed using Django and Django Rest Framework, with Celery as background tasks runner, Postgres as relational database and Redis as cache service.
Code structure implementation follows a Clean Architecture approach, emphasizing on code readability, responsibility decoupling and unit testing.
For API backend endpoints documentation refer to the forex yaml file in the docs directory.
Download source code cloning this repository:
git clone https://github.com/sdediego/django-clean-architecture.git
Get free API Key for the following exchange rate services:
Later update database with each value for the corresponding provider api_key setting using the backend admin panel.
Create docker images and execute the containers for development. From the project directory:
docker-compose -f ./docker/docker-compose.yaml -f ./docker/docker-compose.dev.yaml up
Shutdown the application and remove network and containers gracefully:
docker-compose -f ./docker/docker-compose.yaml -f ./docker/docker-compose.dev.yaml down
- Execute the docker containers with environment variables setup for testing:
docker-compose -f ./docker/docker-compose.yaml -f ./docker/docker-compose.test.yaml up
- Access running api backend forex_api docker container shell:
docker exec -it forex_api bash
- Execute pytest command from project directory:
pytest