Coder Social home page Coder Social logo

aimirghani / deribit_client_and_api Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 6 KB

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

Python 100.00%
aiohttp deribit fastapi websocket

deribit_client_and_api's Introduction

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

deribit_client_and_api's People

Contributors

aimirghani avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.