thcidale0808 / bitcoinrate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bitcoin Rate Solution

This is the repository of the Bitcoin Rate solution. It contains the following applications:

  • API: Responsible to expose two endpoints:
    • Get the BTC-USD latest rate from a local database.
    • Get the BTC-USD historical rates from a local database.
  • Extractor: Responsible to constantly get the BTC-USD exchange rate from Coinlayer and save to a database.

Development Setup

This section contains the information required to configure and test the local environment

Pre-requisites:

Install Dependencies

make setup

Run the unit tests:

make test

Running locally

This section contains the information to setup and run each component locally

Run Extractor

This will run the Extractor start save rates from Coinlayer Public API

make run-extractor

Run API

This will create a local DB and run the API

make run-api

API will now be available on http://localhost:5000.

API Contract Swagger

API documentation is in OpenAPI 3.0 format. To view the docs:

make docs-view

Docs will now be served on http://localhost:8080

Future Improvements

  • Add security headers
  • Add authentication
  • Add CI configuration
  • Create service and repository layers to abstract database and any other potential low level logic
  • Use async web frameworks like FastAPI to run and wrap the API
  • Add pagination for the historical bitcoin endpoint
  • Add pre-hook commit to validate code format with black.
  • Increase unit test coverage
  • Add functional tests

About


Languages

Language:Python 78.4%Language:Dockerfile 11.1%Language:Makefile 6.4%Language:Mako 2.2%Language:Shell 2.0%