Giter Site home page Giter Site logo

deribit-v2-ws's Introduction

deribit-v2-ws

Deribit V2 API WS RPC wrapper.

Docs are here.

Work in progress/not finished!

Features

  • Connect to WS api
  • Authenticate
  • Reconnect on disconnect
  • Resubscribe subscriptions on disconnect

Example usage

See more examples in example.js.

const Deribit = require('deribit-v2-ws');

const key = 'x';
const secret = 'y';

const db = new Deribit({key, secret})
await db.connect();
const position = await db.request(
  'private/get_position',
  {instrument_name: 'BTC-PERPETUAL'}
);

console.log(position);

result:

{
  requestedAt: 1552992953360, // added by this lib
  usIn: 1552992953479560,
  usOut: 1552992953482218,
  receivedAt: 1552992953601, // added by this lib
  jsonrpc: '2.0',
  id: 404,
  result:
   { total_profit_loss: 0,
     size_currency: 0,
     size: 0,
     settlement_price: 3959.67,
     realized_profit_loss: 0,
     open_orders_margin: 0,
     mark_price: 3971.85,
     maintenance_margin: 0,
     kind: 'future',
     instrument_name: 'BTC-PERPETUAL',
     initial_margin: 0,
     index_price: 3972.04,
     floating_profit_loss: 0,
     estimated_liquidation_price: 0,
     direction: 'zero',
     delta: 0,
     average_price: 0 },
  usDiff: 2658,
  testnet: false
}

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.