Currency Rates API is a modern, high-performance API built with FastAPI that delivers real-time currency conversion rates for specific dates. The API first attempts to retrieve conversion rates from a local database. If the requested data is not found, it automatically fetches the required information from an external resource.
- Rate 0.0 is returned if there is no data for a given data and currency pair.
- Conversion rates represent the average rate value for a given date.
- The most recent rate available corresponds to the previous day.
curl -X 'POST' \
'https://currency-rates.servehttp.com/v1/currency-rates/get-rate' \
-H 'accept: application/json' \
-H 'X-API-Key: <key>' \
-H 'Content-Type: application/json' \
-d '{
"fromCur": "USD",
"toCur": "EUR",
"date": "2019-02-01"
}'
{
"from_cur": "USD",
"to_cur": "EUR",
"date": "2019-02-01",
"rate": "0.87161482"
}
- Python 3.12
- FastAPI - a high-performance web framework for building APIs with autogenerated OpenAPI documentation.
- PostgreSQL - an open-source relational database.
- SQLAlchemy - a Python ORM and SQL toolkit for interacting with databases using an object-oriented approach.
- Alembic - a database migration tool for managing schema changes in SQLAlchemy-based projects.
- Pydantic - a data validation and settings management library that ensures type safety in FastAPI applications.
- Uvicorn - a fast ASGI server for running FastAPI applications in production.
- Pytest - a testing package, used alongside testcontainers for containerized database testing.
- CI/CD - Continuous Integration and Continuous Delivery via Github Actions workflow
poetry install
poetry shell
cp .env_example .env
cd src && python main.py
docker compose up --build --force-recreate -d
- David Saidov, [email protected]