This project provides a simple API for converting currencies using FastAPI. It fetches exchange rates from external APIs: APILayer and Etherscan.
- fastAPI - A Python framework to build APIs.
- Dynaconf - A Python library to manage environments
- aioetherscan - Etherscan.io API async Python non-official wrapper.
- httpx - HTTPX is a fully featured HTTP client for Python 3, which provides sync and async APIs, and support for both HTTP/1.1 and HTTP/2.
- Convert between various currencies.
- Use two exchange rate providers to cover more currencies as ETH.
- Built with FastAPI for a performant and scalable solution.
- Dependency management with Poetry for a clean and reproducible environment.
- Dockerized for easy deployment and consistent environments.
- Python: A Python version >= 3.12
- Docker: Install Docker following the official guide for your operating system
- Poetry: Install Poetry
- APILayer API KEY: It can get here: https://apilayer.com/, this value needs to put it in APILAYER_API_KEY on .secrets.toml files or in environment variable.
- ETH API KEY: It can get here: https://etherscan.io/, this value needs to put it in ETH_API_KEY on .secrets.toml files or in environment variable.
Note: Both have free accounts to test.
- Make a fork of this repository (this is made in GitHub)
- Clone your fork
- Move to the project directory
- Create a .secrets.toml or environment variables file with the API KEYs needed to run the project (as said in Prerequisites to Execute)
- Install dependencies with Python Poetry
- Execute the project
- Open the browser and access 127.0.0.1:8000
git clone git@github.com:[YourUser]/vm-exchange.git
cd vm-exchange
export VM_EXCHANGE_APILAYER_API_KEY='YouSuperSecretAPILayerKEY' # Create the envvar of APILayer API Key
export VM_EXCHANGE_ETH_API_KEY='YouSuperSecretETHAPIKEY' # Create the envvar of ETH API Key
poetry install --no-root
poetry run fastapi dev api/main.py
To execute the project locally or on a server you can use Docker. How this project is experimental, and how it is used to Build the image and up the container is a simple way to point out how to do it.
- Build the image
- Up the container
- Open the browser and access 0.0.0.0:8000
docker build -t vm-exchange:0.1.0 .
docker run --rm -p 8000:8000 -e VM_EXCHANGE_APILAYER_API_KEY='YouSuperSecretAPILayerKEY' -e VM_EXCHANGE_ETH_API_KEY='YouSuperSecretETHAPIKEY' vm-exchange:0.1.0
- This project is licensed by GPLv3+.