The Rates API provides an interface to fetch the latest and historical exchange rates for various currencies.
These instructions will guide you through setting up and running the Rates API on your local machine for development and testing purposes.
The project uses Makefile to simplify the setup and running of the application. The Makefile contains various commands to build, run, and clean up the project.
The project requires a PostgreSQL database. A Docker Compose file is provided to run the database in a Docker container.
make compose-up
This command will set up a PostgreSQL server based on the configuration specified in database-docker-compose.yml.
Ensure the application configuration, such as database connection settings, are correctly set in the application's configuration file : config.yaml
To compile the project into a binary: make build
This will generate a binary named rates-api in the project directory.
You can then run : ./rates-api --config-path config.yaml
to start the application.
This command utilizes go run
to start the application directly from the source code. Also it will start the application with the configuration file specified in the config.yaml
file and the database container as specified.
To remove generated files and stop the database container: make clean
- Fetch Latest Rates: [GET] /rates/latest
- Fetch Rates by Date: [GET] /rates/{date}
- Analyze Rates: [GET] /rates/analyze
More detailed API documentation is available at open-api.spec.yaml.