Code Monkey home page Code Monkey logo

urantialife / deribit-api-clients Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kant2002/deribit-api-clients

1.0 0.0 0.0 5.8 MB

API clients for the Deribit API in various programming languages

Home Page: https://deribit.com

Shell 0.09% JavaScript 2.94% Ruby 6.94% C++ 14.29% Python 7.74% C 2.55% PHP 10.92% Erlang 0.88% Objective-C 4.83% Java 15.01% Scala 2.45% Clojure 0.75% R 3.25% Go 3.79% C# 15.76% Kotlin 2.67% TypeScript 3.54% Swift 1.58% HTML 0.01% QMake 0.01%

deribit-api-clients's Introduction

Deribit API clients

About

Interact with the Deribit API from the comfort of your favorite programming language.
The client libraries are automatically generated and cover the REST endpoints of the API.

These clients interface with the Deribit API v2.
Find the documentation here

Important

The access token is valid for a certain time, read more about the scope of access tokens, their validity time and how to refresh them here.

Currently supported

  • Android
  • ASP.NET Core
  • C
  • Clojure
  • C++ Qt5
  • C++ REST SDK
  • C#
  • Erlang
  • Go
  • Java
  • JavaScript
  • Kotlin
  • Objective-C
  • PHP
  • Python
  • R
  • Ruby
  • Scala (Akka)
  • Swift 4
  • TypeScript

Examples

Following are example code snippets on how to do authentication (using client_credentials) with the Python and PHP client libraries

Python
    # Setup configuration instance
    conf = configuration.Configuration()
    # Setup unauthenticated client
    client = api_client.ApiClient(conf)
    publicApi = public_api.PublicApi(client)
    # Authenticate with API credentials
    response = publicApi.public_auth_get('client_credentials', '', '', 'API_ACCESS_KEY', 'API_SECRET_KEY', '', '', '', scope='session:test wallet:read')
    access_token = response['result']['access_token']

    conf_authed = configuration.Configuration()
    conf_authed.access_token = access_token
    # Use retrieved authentication token to setup private endpoint client
    client_authed = api_client.ApiClient(conf_authed)
    privateApi = private_api.PrivateApi(client_authed)

    response = privateApi.private_get_transfers_get(currency='BTC')
    print(response['result']['data'][0]['amount'])
    response = privateApi.private_get_current_deposit_address_get(currency='BTC')
    print(response['result']['address'])
PHP
  <?php
  $configuration = new Configuration();
  $publicApi = new PublicApi($client = null, $configuration);
  // Authenticate with API credentials
  $authData = $publicApi->publicAuthGet('client_credentials', '', '', 'API_ACCESS_KEY', 'API_SECRET_KEY', '', '', '', null, null, 'session:test wallet:read');
  $authDataParsed = json_decode($authData[0], true);
  $accessToken = $authDataParsed['result']['access_token'];

  // Use retrieved authentication token to setup private endpoint client
  $authedConfig = new Configuration();
  $authedConfig->setAccessToken($accessToken);
  $privateApi = new PrivateApi(null, $authedConfig);

  $accountSummaryBTC = $privateApi->privateGetAccountSummaryGet('BTC');
  var_dump($accountSummaryBTC);
  $currentDepositAddressBTC = $privateApi->privateGetCurrentDepositAddressGet('BTC');
  var_dump($currentDepositAddressBTC);
  $transfersBTC = $privateApi->privateGetTransfersGet('BTC');
  var_dump($transfersBTC);

Found a bug or have a question?

Please open an issue and it will be addressed.

deribit-api-clients's People

Contributors

lacksfish avatar psollberger avatar

Stargazers

Josue Moret Ruiz 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.