npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

deribit-api

v1.0.2

Published

Deribit API javascript client library

Downloads

3

Readme

API Client for Deribit API

Description

The Deribit API is available in this package.

Installation

npm install deribit-api

Example

var RestClient = require("deribit-api").RestClient;

var restClient = new RestClient();

restClient.getcurrencies().then((result) => {
  console.log("Currencies: ", result);
});

restClient.index((result) => {
  console.log("Index: ", result)
});

API - REST Client

new RestClient(key, secret, url)

Constructor creates new REST client.

Parameters

| Name | Type | Decription | |----------|----------|-----------------------------------------------------------| | key | string | Optional, Access Key needed to access Private functions | | secret | string | Optional, Access Secret needed to access Private functions| | url | string | Optional, server URL, default: https://www.deribit.com |

Methods

  • getorderbook(instrument, callback) - Doc, public

    Retrieve the orderbook for a given instrument.

    Parameters

    | Name | Type | Decription | |--------------|------------|------------------------------------------------------------| | instrument | string | Required, instrument name | | callback | function | Optional, callback, if not provided method returns promise |

  • index(callback) - Doc, public

    Get price index, BTC-USD rates.

    Parameters

    | Name | Type | Decription | |------------|------------|------------------------------------------------------------| | callback | function | Optional, callback, if not provided method returns promise |

  • getcurrencies(callback) - Doc, public

    Get all supported currencies.

    Parameters

    | Name | Type | Decription | |------------|------------|------------------------------------------------------------| | callback | function | Optional, callback, if not provided method returns promise |

  • getorderbook(instrument, callback) - Doc, public

    Retrieve the orderbook for a given instrument.

    Parameters

    | Name | Type | Decription | |--------------|------------|------------------------------------------------------------| | instrument | string | Required, instrument name | | callback | function | Optional, callback, if not provided method returns promise |

  • getlasttrades(instrument, count, since, callback) - Doc, public

    Retrieve the latest trades that have occured for a specific instrument.

    Parameters

    | Name | Type | Decription | |--------------|------------|-------------------------------------------------------------------------------| | instrument | string | Required, instrument name | | count | integer | Optional, count of trades returned (limitation: max. count is 100) | | since | integer | Optional, “since” trade id, the server returns trades newer than that “since” | | callback | function | Optional, callback, if not provided method returns promise |

  • getsummary(instrument, callback) - Doc, public

    Retrieve the summary info such as Open Interest, 24H Volume etc for a specific instrument.

    Parameters

    | Name | Type | Decription | |--------------|------------|------------------------------------------------------------| | instrument | string | Required, instrument name | | callback | function | Optional, callback, if not provided method returns promise |

  • account(callback) - Doc, Private

    Get user account summary.

    Parameters

    | Name | Type | Decription | |--------------|------------|------------------------------------------------------------| | callback | function | Optional, callback, if not provided method returns promise |

  • buy(instrument, quantity, price, postOnly, label, callback) - Doc, private

    Place a buy order in an instrument.

    Parameters

    | Name | Type | Decription | |--------------|------------|-----------------------------------------------------------------------------------| | instrument | string | Required, instrument name | | quantity | integer | Required, quantity, in contracts ($10 per contract for futures, ฿1 — for options) | | price | float | Required, USD for futures, BTC for options | | postOnly | boolean | Optional, if true then the order will be POST ONLY | | label | string | Optional, user defined maximum 4-char label for the order | | callback | function | Optional, callback, if not provided method returns promise |

  • sell(instrument, quantity, price, postOnly, label, callback) - Doc, private

    Place a sell order in an instrument.

    Parameters

    | Name | Type | Decription | |--------------|------------|-----------------------------------------------------------------------------------| | instrument | string | Required, instrument name | | quantity | integer | Required, quantity, in contracts ($10 per contract for futures, ฿1 — for options) | | price | float | Required, USD for futures, BTC for options | | postOnly | boolean | Optional, if true then the order will be POST ONLY | | label | string | Optional, user defined maximum 4-char label for the order | | callback | function | Optional, callback, if not provided method returns promise |

  • edit(orderId, quantity, price, callback) - Doc

    Edit price and/or quantity of the own order. (Authorization is required).

    Parameters

    | Name | Type | Decription | |--------------|------------|-----------------------------------------------------------------------------------| | orderId | integer | Required, ID of the order returned by "sell" or "buy" request | | quantity | integer | Required, quantity, in contracts ($10 per contract for futures, ฿1 — for options) | | price | float | Required, USD for futures, BTC for options | | callback | function | Optional, callback, if not provided method returns promise |

  • cancel(orderId, callback) - Doc, private

    Cancell own order by id.

    Parameters

    | Name | Type | Decription | |--------------|------------|-----------------------------------------------------------------------------------| | orderId | integer | Required, ID of the order returned by "sell" or "buy" request | | callback | function | Optional, callback, if not provided method returns promise |

  • cancelall(type, callback) - Doc

    Cancel all own futures, or all options, or all.

    Parameters

    | Name | Type | Decription | |--------------|------------|-----------------------------------------------------------------------------------------------| | type | string | Optional, type of instruments to cancel, allowed: "all", "futures", "options", default: "all" | | callback | function | Optional, callback, if not provided method returns promise |

  • getopenorders(instrument, orderId, callback) - Doc, private

    Retrieve open orders.

    Parameters

    | Name | Type | Description | |--------------|------------|-----------------------------------------------------------------------| | instrument | string | Optional, instrument name, use if want orders for specific instrument | | orderId | integer | Optional, order id | | callback | function | Optional, callback, if not provided method returns promise |

  • positions(callback) - Doc, private

    Retreive positions.

    Parameters

    | Name | Type | Decription | |--------------|------------|------------------------------------------------------------| | callback | function | Optional, callback, if not provided method returns promise |

  • orderhistory(count, callback) - Doc, private

    Get history.

    Parameters

    | Name | Type | Description | |------------|------------|------------------------------------------------------------| | count | integer | Optional, number of requested records | | callback | function | Optional, callback, if not provided method returns promise |

  • tradehistory(count, instrument, startTradeId, callback) - Doc, private

    Get private trade history of the account. (Authorization is required). The result is ordered by trade identifiers (trade id-s).

    Parameters

    | Name | Type | Description | |----------------|------------|----------------------------------------------------------------------------------------------------| | count | integer | Optional, number of results to fetch. Default: 20 | | instrument | string | Optional, name of instrument, also aliases “all”, “futures”, “options” are allowed. Default: "all" | | startTradeId | integer | Optional, number of requested records | | callback | function | Optional, callback, if not provided method returns promise |