Skip to content

An app that pull data from Deribit API, save it to a database and serve it from the database through a custom API.

Notifications You must be signed in to change notification settings

aimirghani/deribit_client_and_api

Repository files navigation

Deribit Client and a custom API

Overview

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.

  1. /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'.
  2. /currency-price: provides the price of a specific currency. The name of the currency is passed to the route under the parameter 'ticker_name'.
  3. /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.

  1. createdb: creates a database at the very first time starting the app, otherwise it returns that there is a database exists.
  2. call_deribit: Starts a scheduler that sends requests to Deribit API every minute.
  3. run_api: Starts the custom API app.

Installation

  1. Clone the repo.
  2. Install the dependencies, (recommended to be in virtual environment, Python -v 3.9.17)
pip install -r requirements.txt
  1. Fill in the database credentials in the .env file.

Usage

The following commands should be run at the root of the app.

  1. Create a database by running createdb command from the command line as follows:
python main_cli.py createdb
  1. Populate the database with data from Deribit API, by running
python main_cli.py call-deribit
  1. Run the custom API by using
python main_cli.py run-api

About

An app that pull data from Deribit API, save it to a database and serve it from the database through a custom API.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages