The app provides a client to make requests to Deribit API and save the recieved responses into a database. Moreover there is a custom API that reads from the same database and provides three routes.
- /currency-all-info: provides all the historical data of a specific currency that exist in the database. The name of the currency is passed to the route under the parameter 'ticker_name'.
- /currency-price: provides the price of a specific currency. The name of the currency is passed to the route under the parameter 'ticker_name'.
- /currency-by-date: provides all the historical data of a specific currency on a specific date. The name of the currency is passed to the route under the parameter 'ticker_name' and the date is passed under the parameter 'dt', the format of the date argument must be
%Y-%m-%d
.
The last component of the app is a CLI that provides three main commands.
- createdb: creates a database at the very first time starting the app, otherwise it returns that there is a database exists.
- call_deribit: Starts a scheduler that sends requests to Deribit API every minute.
- run_api: Starts the custom API app.
- Clone the repo.
- Install the dependencies, (recommended to be in virtual environment, Python -v 3.9.17)
pip install -r requirements.txt
- Fill in the database credentials in the
.env
file.
The following commands should be run at the root of the app.
- Create a database by running createdb command from the command line as follows:
python main_cli.py createdb
- Populate the database with data from Deribit API, by running
python main_cli.py call-deribit
- Run the custom API by using
python main_cli.py run-api