Skip to content

Latest commit

 

History

History
1240 lines (885 loc) · 49.3 KB

TradingApi.md

File metadata and controls

1240 lines (885 loc) · 49.3 KB

DeribitApi.TradingApi

All URIs are relative to https://www.deribit.com/api/v2

Method HTTP request Description
privateBuyGet GET /private/buy Places a buy order for an instrument.
privateCancelAllByCurrencyGet GET /private/cancel_all_by_currency Cancels all orders by currency, optionally filtered by instrument kind and/or order type.
privateCancelAllByInstrumentGet GET /private/cancel_all_by_instrument Cancels all orders by instrument, optionally filtered by order type.
privateCancelAllGet GET /private/cancel_all This method cancels all users orders and stop orders within all currencies and instrument kinds.
privateCancelGet GET /private/cancel Cancel an order, specified by order id
privateClosePositionGet GET /private/close_position Makes closing position reduce only order .
privateEditGet GET /private/edit Change price, amount and/or other properties of an order.
privateGetMarginsGet GET /private/get_margins Get margins for given instrument, amount and price.
privateGetOpenOrdersByCurrencyGet GET /private/get_open_orders_by_currency Retrieves list of user's open orders.
privateGetOpenOrdersByInstrumentGet GET /private/get_open_orders_by_instrument Retrieves list of user's open orders within given Instrument.
privateGetOrderHistoryByCurrencyGet GET /private/get_order_history_by_currency Retrieves history of orders that have been partially or fully filled.
privateGetOrderHistoryByInstrumentGet GET /private/get_order_history_by_instrument Retrieves history of orders that have been partially or fully filled.
privateGetOrderMarginByIdsGet GET /private/get_order_margin_by_ids Retrieves initial margins of given orders
privateGetOrderStateGet GET /private/get_order_state Retrieve the current state of an order.
privateGetSettlementHistoryByCurrencyGet GET /private/get_settlement_history_by_currency Retrieves settlement, delivery and bankruptcy events that have affected your account.
privateGetSettlementHistoryByInstrumentGet GET /private/get_settlement_history_by_instrument Retrieves public settlement, delivery and bankruptcy events filtered by instrument name
privateGetUserTradesByCurrencyAndTimeGet GET /private/get_user_trades_by_currency_and_time Retrieve the latest user trades that have occurred for instruments in a specific currency symbol and within given time range.
privateGetUserTradesByCurrencyGet GET /private/get_user_trades_by_currency Retrieve the latest user trades that have occurred for instruments in a specific currency symbol.
privateGetUserTradesByInstrumentAndTimeGet GET /private/get_user_trades_by_instrument_and_time Retrieve the latest user trades that have occurred for a specific instrument and within given time range.
privateGetUserTradesByInstrumentGet GET /private/get_user_trades_by_instrument Retrieve the latest user trades that have occurred for a specific instrument.
privateGetUserTradesByOrderGet GET /private/get_user_trades_by_order Retrieve the list of user trades that was created for given order
privateSellGet GET /private/sell Places a sell order for an instrument.

privateBuyGet

Object privateBuyGet(instrumentName, amount, opts)

Places a buy order for an instrument.

Example

import DeribitApi from 'deribit_api';
let defaultClient = DeribitApi.ApiClient.instance;
// Configure Bearer (Auth. Token) access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new DeribitApi.TradingApi();
let instrumentName = BTC-PERPETUAL; // String | Instrument name
let amount = 3.4; // Number | It represents the requested order size. For perpetual and futures the amount is in USD units, for options it is amount of corresponding cryptocurrency contracts, e.g., BTC or ETH
let opts = {
  'type': "type_example", // String | The order type, default: `\"limit\"`
  'label': "label_example", // String | user defined label for the order (maximum 32 characters)
  'price': 3.4, // Number | <p>The order price in base currency (Only for limit and stop_limit orders)</p> <p>When adding order with advanced=usd, the field price should be the option price value in USD.</p> <p>When adding order with advanced=implv, the field price should be a value of implied volatility in percentages. For example,  price=100, means implied volatility of 100%</p>
  'timeInForce': "'good_til_cancelled'", // String | <p>Specifies how long the order remains in effect. Default `\"good_til_cancelled\"`</p> <ul> <li>`\"good_til_cancelled\"` - unfilled order remains in order book until cancelled</li> <li>`\"fill_or_kill\"` - execute a transaction immediately and completely or not at all</li> <li>`\"immediate_or_cancel\"` - execute a transaction immediately, and any portion of the order that cannot be immediately filled is cancelled</li> </ul>
  'maxShow': 1, // Number | Maximum amount within an order to be shown to other customers, `0` for invisible order
  'postOnly': true, // Boolean | <p>If true, the order is considered post-only. If the new price would cause the order to be filled immediately (as taker), the price will be changed to be just below the bid.</p> <p>Only valid in combination with time_in_force=`\"good_til_cancelled\"`</p>
  'reduceOnly': false, // Boolean | If `true`, the order is considered reduce-only which is intended to only reduce a current position
  'stopPrice': 3.4, // Number | Stop price, required for stop limit orders (Only for stop orders)
  'trigger': "trigger_example", // String | Defines trigger type, required for `\"stop_limit\"` order type
  'advanced': "advanced_example" // String | Advanced option order type. (Only for options)
};
apiInstance.privateBuyGet(instrumentName, amount, opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
instrumentName String Instrument name
amount Number It represents the requested order size. For perpetual and futures the amount is in USD units, for options it is amount of corresponding cryptocurrency contracts, e.g., BTC or ETH
type String The order type, default: `&quot;limit&quot;` [optional]
label String user defined label for the order (maximum 32 characters) [optional]
price Number <p>The order price in base currency (Only for limit and stop_limit orders)</p> <p>When adding order with advanced=usd, the field price should be the option price value in USD.</p> <p>When adding order with advanced=implv, the field price should be a value of implied volatility in percentages. For example, price=100, means implied volatility of 100%</p> [optional]
timeInForce String <p>Specifies how long the order remains in effect. Default `&quot;good_til_cancelled&quot;`</p> <ul> <li>`&quot;good_til_cancelled&quot;` - unfilled order remains in order book until cancelled</li> <li>`&quot;fill_or_kill&quot;` - execute a transaction immediately and completely or not at all</li> <li>`&quot;immediate_or_cancel&quot;` - execute a transaction immediately, and any portion of the order that cannot be immediately filled is cancelled</li> </ul> [optional] [default to 'good_til_cancelled']
maxShow Number Maximum amount within an order to be shown to other customers, `0` for invisible order [optional] [default to 1]
postOnly Boolean <p>If true, the order is considered post-only. If the new price would cause the order to be filled immediately (as taker), the price will be changed to be just below the bid.</p> <p>Only valid in combination with time_in_force=`&quot;good_til_cancelled&quot;`</p> [optional] [default to true]
reduceOnly Boolean If `true`, the order is considered reduce-only which is intended to only reduce a current position [optional] [default to false]
stopPrice Number Stop price, required for stop limit orders (Only for stop orders) [optional]
trigger String Defines trigger type, required for `&quot;stop_limit&quot;` order type [optional]
advanced String Advanced option order type. (Only for options) [optional]

Return type

Object

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

privateCancelAllByCurrencyGet

Object privateCancelAllByCurrencyGet(currency, opts)

Cancels all orders by currency, optionally filtered by instrument kind and/or order type.

Example

import DeribitApi from 'deribit_api';
let defaultClient = DeribitApi.ApiClient.instance;
// Configure Bearer (Auth. Token) access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new DeribitApi.TradingApi();
let currency = "currency_example"; // String | The currency symbol
let opts = {
  'kind': "kind_example", // String | Instrument kind, if not provided instruments of all kinds are considered
  'type': "type_example" // String | Order type - limit, stop or all, default - `all`
};
apiInstance.privateCancelAllByCurrencyGet(currency, opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
currency String The currency symbol
kind String Instrument kind, if not provided instruments of all kinds are considered [optional]
type String Order type - limit, stop or all, default - `all` [optional]

Return type

Object

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

privateCancelAllByInstrumentGet

Object privateCancelAllByInstrumentGet(instrumentName, opts)

Cancels all orders by instrument, optionally filtered by order type.

Example

import DeribitApi from 'deribit_api';
let defaultClient = DeribitApi.ApiClient.instance;
// Configure Bearer (Auth. Token) access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new DeribitApi.TradingApi();
let instrumentName = BTC-PERPETUAL; // String | Instrument name
let opts = {
  'type': "type_example" // String | Order type - limit, stop or all, default - `all`
};
apiInstance.privateCancelAllByInstrumentGet(instrumentName, opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
instrumentName String Instrument name
type String Order type - limit, stop or all, default - `all` [optional]

Return type

Object

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

privateCancelAllGet

Object privateCancelAllGet()

This method cancels all users orders and stop orders within all currencies and instrument kinds.

Example

import DeribitApi from 'deribit_api';
let defaultClient = DeribitApi.ApiClient.instance;
// Configure Bearer (Auth. Token) access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new DeribitApi.TradingApi();
apiInstance.privateCancelAllGet((error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

This endpoint does not need any parameter.

Return type

Object

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

privateCancelGet

Object privateCancelGet(orderId)

Cancel an order, specified by order id

Example

import DeribitApi from 'deribit_api';
let defaultClient = DeribitApi.ApiClient.instance;
// Configure Bearer (Auth. Token) access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new DeribitApi.TradingApi();
let orderId = ETH-100234; // String | The order id
apiInstance.privateCancelGet(orderId, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
orderId String The order id

Return type

Object

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

privateClosePositionGet

Object privateClosePositionGet(instrumentName, type, opts)

Makes closing position reduce only order .

Example

import DeribitApi from 'deribit_api';
let defaultClient = DeribitApi.ApiClient.instance;
// Configure Bearer (Auth. Token) access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new DeribitApi.TradingApi();
let instrumentName = BTC-PERPETUAL; // String | Instrument name
let type = "type_example"; // String | The order type
let opts = {
  'price': 3.4 // Number | Optional price for limit order.
};
apiInstance.privateClosePositionGet(instrumentName, type, opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
instrumentName String Instrument name
type String The order type
price Number Optional price for limit order. [optional]

Return type

Object

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

privateEditGet

Object privateEditGet(orderId, amount, price, opts)

Change price, amount and/or other properties of an order.

Example

import DeribitApi from 'deribit_api';
let defaultClient = DeribitApi.ApiClient.instance;
// Configure Bearer (Auth. Token) access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new DeribitApi.TradingApi();
let orderId = ETH-100234; // String | The order id
let amount = 3.4; // Number | It represents the requested order size. For perpetual and futures the amount is in USD units, for options it is amount of corresponding cryptocurrency contracts, e.g., BTC or ETH
let price = 3.4; // Number | <p>The order price in base currency.</p> <p>When editing an option order with advanced=usd, the field price should be the option price value in USD.</p> <p>When editing an option order with advanced=implv, the field price should be a value of implied volatility in percentages. For example,  price=100, means implied volatility of 100%</p>
let opts = {
  'postOnly': true, // Boolean | <p>If true, the order is considered post-only. If the new price would cause the order to be filled immediately (as taker), the price will be changed to be just below the bid.</p> <p>Only valid in combination with time_in_force=`\"good_til_cancelled\"`</p>
  'advanced': "advanced_example", // String | Advanced option order type. If you have posted an advanced option order, it is necessary to re-supply this parameter when editing it (Only for options)
  'stopPrice': 3.4 // Number | Stop price, required for stop limit orders (Only for stop orders)
};
apiInstance.privateEditGet(orderId, amount, price, opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
orderId String The order id
amount Number It represents the requested order size. For perpetual and futures the amount is in USD units, for options it is amount of corresponding cryptocurrency contracts, e.g., BTC or ETH
price Number <p>The order price in base currency.</p> <p>When editing an option order with advanced=usd, the field price should be the option price value in USD.</p> <p>When editing an option order with advanced=implv, the field price should be a value of implied volatility in percentages. For example, price=100, means implied volatility of 100%</p>
postOnly Boolean <p>If true, the order is considered post-only. If the new price would cause the order to be filled immediately (as taker), the price will be changed to be just below the bid.</p> <p>Only valid in combination with time_in_force=`&quot;good_til_cancelled&quot;`</p> [optional] [default to true]
advanced String Advanced option order type. If you have posted an advanced option order, it is necessary to re-supply this parameter when editing it (Only for options) [optional]
stopPrice Number Stop price, required for stop limit orders (Only for stop orders) [optional]

Return type

Object

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

privateGetMarginsGet

Object privateGetMarginsGet(instrumentName, amount, price)

Get margins for given instrument, amount and price.

Example

import DeribitApi from 'deribit_api';
let defaultClient = DeribitApi.ApiClient.instance;
// Configure Bearer (Auth. Token) access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new DeribitApi.TradingApi();
let instrumentName = BTC-PERPETUAL; // String | Instrument name
let amount = 1; // Number | Amount, integer for future, float for option. For perpetual and futures the amount is in USD units, for options it is amount of corresponding cryptocurrency contracts, e.g., BTC or ETH.
let price = 3.4; // Number | Price
apiInstance.privateGetMarginsGet(instrumentName, amount, price, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
instrumentName String Instrument name
amount Number Amount, integer for future, float for option. For perpetual and futures the amount is in USD units, for options it is amount of corresponding cryptocurrency contracts, e.g., BTC or ETH.
price Number Price

Return type

Object

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

privateGetOpenOrdersByCurrencyGet

Object privateGetOpenOrdersByCurrencyGet(currency, opts)

Retrieves list of user's open orders.

Example

import DeribitApi from 'deribit_api';
let defaultClient = DeribitApi.ApiClient.instance;
// Configure Bearer (Auth. Token) access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new DeribitApi.TradingApi();
let currency = "currency_example"; // String | The currency symbol
let opts = {
  'kind': "kind_example", // String | Instrument kind, if not provided instruments of all kinds are considered
  'type': "type_example" // String | Order type, default - `all`
};
apiInstance.privateGetOpenOrdersByCurrencyGet(currency, opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
currency String The currency symbol
kind String Instrument kind, if not provided instruments of all kinds are considered [optional]
type String Order type, default - `all` [optional]

Return type

Object

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

privateGetOpenOrdersByInstrumentGet

Object privateGetOpenOrdersByInstrumentGet(instrumentName, opts)

Retrieves list of user's open orders within given Instrument.

Example

import DeribitApi from 'deribit_api';
let defaultClient = DeribitApi.ApiClient.instance;
// Configure Bearer (Auth. Token) access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new DeribitApi.TradingApi();
let instrumentName = BTC-PERPETUAL; // String | Instrument name
let opts = {
  'type': "type_example" // String | Order type, default - `all`
};
apiInstance.privateGetOpenOrdersByInstrumentGet(instrumentName, opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
instrumentName String Instrument name
type String Order type, default - `all` [optional]

Return type

Object

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

privateGetOrderHistoryByCurrencyGet

Object privateGetOrderHistoryByCurrencyGet(currency, opts)

Retrieves history of orders that have been partially or fully filled.

Example

import DeribitApi from 'deribit_api';
let defaultClient = DeribitApi.ApiClient.instance;
// Configure Bearer (Auth. Token) access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new DeribitApi.TradingApi();
let currency = "currency_example"; // String | The currency symbol
let opts = {
  'kind': "kind_example", // String | Instrument kind, if not provided instruments of all kinds are considered
  'count': 56, // Number | Number of requested items, default - `20`
  'offset': 10, // Number | The offset for pagination, default - `0`
  'includeOld': false, // Boolean | Include in result orders older than 2 days, default - `false`
  'includeUnfilled': false // Boolean | Include in result fully unfilled closed orders, default - `false`
};
apiInstance.privateGetOrderHistoryByCurrencyGet(currency, opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
currency String The currency symbol
kind String Instrument kind, if not provided instruments of all kinds are considered [optional]
count Number Number of requested items, default - `20` [optional]
offset Number The offset for pagination, default - `0` [optional]
includeOld Boolean Include in result orders older than 2 days, default - `false` [optional]
includeUnfilled Boolean Include in result fully unfilled closed orders, default - `false` [optional]

Return type

Object

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

privateGetOrderHistoryByInstrumentGet

Object privateGetOrderHistoryByInstrumentGet(instrumentName, opts)

Retrieves history of orders that have been partially or fully filled.

Example

import DeribitApi from 'deribit_api';
let defaultClient = DeribitApi.ApiClient.instance;
// Configure Bearer (Auth. Token) access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new DeribitApi.TradingApi();
let instrumentName = BTC-PERPETUAL; // String | Instrument name
let opts = {
  'count': 56, // Number | Number of requested items, default - `20`
  'offset': 10, // Number | The offset for pagination, default - `0`
  'includeOld': false, // Boolean | Include in result orders older than 2 days, default - `false`
  'includeUnfilled': false // Boolean | Include in result fully unfilled closed orders, default - `false`
};
apiInstance.privateGetOrderHistoryByInstrumentGet(instrumentName, opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
instrumentName String Instrument name
count Number Number of requested items, default - `20` [optional]
offset Number The offset for pagination, default - `0` [optional]
includeOld Boolean Include in result orders older than 2 days, default - `false` [optional]
includeUnfilled Boolean Include in result fully unfilled closed orders, default - `false` [optional]

Return type

Object

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

privateGetOrderMarginByIdsGet

Object privateGetOrderMarginByIdsGet(ids)

Retrieves initial margins of given orders

Example

import DeribitApi from 'deribit_api';
let defaultClient = DeribitApi.ApiClient.instance;
// Configure Bearer (Auth. Token) access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new DeribitApi.TradingApi();
let ids = ["123456"]; // [String] | Ids of orders
apiInstance.privateGetOrderMarginByIdsGet(ids, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
ids [String] Ids of orders

Return type

Object

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

privateGetOrderStateGet

Object privateGetOrderStateGet(orderId)

Retrieve the current state of an order.

Example

import DeribitApi from 'deribit_api';
let defaultClient = DeribitApi.ApiClient.instance;
// Configure Bearer (Auth. Token) access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new DeribitApi.TradingApi();
let orderId = ETH-100234; // String | The order id
apiInstance.privateGetOrderStateGet(orderId, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
orderId String The order id

Return type

Object

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

privateGetSettlementHistoryByCurrencyGet

Object privateGetSettlementHistoryByCurrencyGet(currency, opts)

Retrieves settlement, delivery and bankruptcy events that have affected your account.

Example

import DeribitApi from 'deribit_api';
let defaultClient = DeribitApi.ApiClient.instance;
// Configure Bearer (Auth. Token) access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new DeribitApi.TradingApi();
let currency = "currency_example"; // String | The currency symbol
let opts = {
  'type': "type_example", // String | Settlement type
  'count': 56 // Number | Number of requested items, default - `20`
};
apiInstance.privateGetSettlementHistoryByCurrencyGet(currency, opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
currency String The currency symbol
type String Settlement type [optional]
count Number Number of requested items, default - `20` [optional]

Return type

Object

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

privateGetSettlementHistoryByInstrumentGet

Object privateGetSettlementHistoryByInstrumentGet(instrumentName, opts)

Retrieves public settlement, delivery and bankruptcy events filtered by instrument name

Example

import DeribitApi from 'deribit_api';
let defaultClient = DeribitApi.ApiClient.instance;
// Configure Bearer (Auth. Token) access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new DeribitApi.TradingApi();
let instrumentName = BTC-PERPETUAL; // String | Instrument name
let opts = {
  'type': "type_example", // String | Settlement type
  'count': 56 // Number | Number of requested items, default - `20`
};
apiInstance.privateGetSettlementHistoryByInstrumentGet(instrumentName, opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
instrumentName String Instrument name
type String Settlement type [optional]
count Number Number of requested items, default - `20` [optional]

Return type

Object

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

privateGetUserTradesByCurrencyAndTimeGet

Object privateGetUserTradesByCurrencyAndTimeGet(currency, startTimestamp, endTimestamp, opts)

Retrieve the latest user trades that have occurred for instruments in a specific currency symbol and within given time range.

Example

import DeribitApi from 'deribit_api';
let defaultClient = DeribitApi.ApiClient.instance;
// Configure Bearer (Auth. Token) access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new DeribitApi.TradingApi();
let currency = "currency_example"; // String | The currency symbol
let startTimestamp = 1536569522277; // Number | The earliest timestamp to return result for
let endTimestamp = 1536569522277; // Number | The most recent timestamp to return result for
let opts = {
  'kind': "kind_example", // String | Instrument kind, if not provided instruments of all kinds are considered
  'count': 56, // Number | Number of requested items, default - `10`
  'includeOld': true, // Boolean | Include trades older than 7 days, default - `false`
  'sorting': "sorting_example" // String | Direction of results sorting (`default` value means no sorting, results will be returned in order in which they left the database)
};
apiInstance.privateGetUserTradesByCurrencyAndTimeGet(currency, startTimestamp, endTimestamp, opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
currency String The currency symbol
startTimestamp Number The earliest timestamp to return result for
endTimestamp Number The most recent timestamp to return result for
kind String Instrument kind, if not provided instruments of all kinds are considered [optional]
count Number Number of requested items, default - `10` [optional]
includeOld Boolean Include trades older than 7 days, default - `false` [optional]
sorting String Direction of results sorting (`default` value means no sorting, results will be returned in order in which they left the database) [optional]

Return type

Object

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

privateGetUserTradesByCurrencyGet

Object privateGetUserTradesByCurrencyGet(currency, opts)

Retrieve the latest user trades that have occurred for instruments in a specific currency symbol.

Example

import DeribitApi from 'deribit_api';
let defaultClient = DeribitApi.ApiClient.instance;
// Configure Bearer (Auth. Token) access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new DeribitApi.TradingApi();
let currency = "currency_example"; // String | The currency symbol
let opts = {
  'kind': "kind_example", // String | Instrument kind, if not provided instruments of all kinds are considered
  'startId': "startId_example", // String | The ID number of the first trade to be returned
  'endId': "endId_example", // String | The ID number of the last trade to be returned
  'count': 56, // Number | Number of requested items, default - `10`
  'includeOld': true, // Boolean | Include trades older than 7 days, default - `false`
  'sorting': "sorting_example" // String | Direction of results sorting (`default` value means no sorting, results will be returned in order in which they left the database)
};
apiInstance.privateGetUserTradesByCurrencyGet(currency, opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
currency String The currency symbol
kind String Instrument kind, if not provided instruments of all kinds are considered [optional]
startId String The ID number of the first trade to be returned [optional]
endId String The ID number of the last trade to be returned [optional]
count Number Number of requested items, default - `10` [optional]
includeOld Boolean Include trades older than 7 days, default - `false` [optional]
sorting String Direction of results sorting (`default` value means no sorting, results will be returned in order in which they left the database) [optional]

Return type

Object

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

privateGetUserTradesByInstrumentAndTimeGet

Object privateGetUserTradesByInstrumentAndTimeGet(instrumentName, startTimestamp, endTimestamp, opts)

Retrieve the latest user trades that have occurred for a specific instrument and within given time range.

Example

import DeribitApi from 'deribit_api';
let defaultClient = DeribitApi.ApiClient.instance;
// Configure Bearer (Auth. Token) access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new DeribitApi.TradingApi();
let instrumentName = BTC-PERPETUAL; // String | Instrument name
let startTimestamp = 1536569522277; // Number | The earliest timestamp to return result for
let endTimestamp = 1536569522277; // Number | The most recent timestamp to return result for
let opts = {
  'count': 56, // Number | Number of requested items, default - `10`
  'includeOld': true, // Boolean | Include trades older than 7 days, default - `false`
  'sorting': "sorting_example" // String | Direction of results sorting (`default` value means no sorting, results will be returned in order in which they left the database)
};
apiInstance.privateGetUserTradesByInstrumentAndTimeGet(instrumentName, startTimestamp, endTimestamp, opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
instrumentName String Instrument name
startTimestamp Number The earliest timestamp to return result for
endTimestamp Number The most recent timestamp to return result for
count Number Number of requested items, default - `10` [optional]
includeOld Boolean Include trades older than 7 days, default - `false` [optional]
sorting String Direction of results sorting (`default` value means no sorting, results will be returned in order in which they left the database) [optional]

Return type

Object

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

privateGetUserTradesByInstrumentGet

Object privateGetUserTradesByInstrumentGet(instrumentName, opts)

Retrieve the latest user trades that have occurred for a specific instrument.

Example

import DeribitApi from 'deribit_api';
let defaultClient = DeribitApi.ApiClient.instance;
// Configure Bearer (Auth. Token) access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new DeribitApi.TradingApi();
let instrumentName = BTC-PERPETUAL; // String | Instrument name
let opts = {
  'startSeq': 56, // Number | The sequence number of the first trade to be returned
  'endSeq': 56, // Number | The sequence number of the last trade to be returned
  'count': 56, // Number | Number of requested items, default - `10`
  'includeOld': true, // Boolean | Include trades older than 7 days, default - `false`
  'sorting': "sorting_example" // String | Direction of results sorting (`default` value means no sorting, results will be returned in order in which they left the database)
};
apiInstance.privateGetUserTradesByInstrumentGet(instrumentName, opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
instrumentName String Instrument name
startSeq Number The sequence number of the first trade to be returned [optional]
endSeq Number The sequence number of the last trade to be returned [optional]
count Number Number of requested items, default - `10` [optional]
includeOld Boolean Include trades older than 7 days, default - `false` [optional]
sorting String Direction of results sorting (`default` value means no sorting, results will be returned in order in which they left the database) [optional]

Return type

Object

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

privateGetUserTradesByOrderGet

Object privateGetUserTradesByOrderGet(orderId, opts)

Retrieve the list of user trades that was created for given order

Example

import DeribitApi from 'deribit_api';
let defaultClient = DeribitApi.ApiClient.instance;
// Configure Bearer (Auth. Token) access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new DeribitApi.TradingApi();
let orderId = ETH-100234; // String | The order id
let opts = {
  'sorting': "sorting_example" // String | Direction of results sorting (`default` value means no sorting, results will be returned in order in which they left the database)
};
apiInstance.privateGetUserTradesByOrderGet(orderId, opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
orderId String The order id
sorting String Direction of results sorting (`default` value means no sorting, results will be returned in order in which they left the database) [optional]

Return type

Object

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

privateSellGet

Object privateSellGet(instrumentName, amount, opts)

Places a sell order for an instrument.

Example

import DeribitApi from 'deribit_api';
let defaultClient = DeribitApi.ApiClient.instance;
// Configure Bearer (Auth. Token) access token for authorization: bearerAuth
let bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

let apiInstance = new DeribitApi.TradingApi();
let instrumentName = BTC-PERPETUAL; // String | Instrument name
let amount = 3.4; // Number | It represents the requested order size. For perpetual and futures the amount is in USD units, for options it is amount of corresponding cryptocurrency contracts, e.g., BTC or ETH
let opts = {
  'type': "type_example", // String | The order type, default: `\"limit\"`
  'label': "label_example", // String | user defined label for the order (maximum 32 characters)
  'price': 3.4, // Number | <p>The order price in base currency (Only for limit and stop_limit orders)</p> <p>When adding order with advanced=usd, the field price should be the option price value in USD.</p> <p>When adding order with advanced=implv, the field price should be a value of implied volatility in percentages. For example,  price=100, means implied volatility of 100%</p>
  'timeInForce': "'good_til_cancelled'", // String | <p>Specifies how long the order remains in effect. Default `\"good_til_cancelled\"`</p> <ul> <li>`\"good_til_cancelled\"` - unfilled order remains in order book until cancelled</li> <li>`\"fill_or_kill\"` - execute a transaction immediately and completely or not at all</li> <li>`\"immediate_or_cancel\"` - execute a transaction immediately, and any portion of the order that cannot be immediately filled is cancelled</li> </ul>
  'maxShow': 1, // Number | Maximum amount within an order to be shown to other customers, `0` for invisible order
  'postOnly': true, // Boolean | <p>If true, the order is considered post-only. If the new price would cause the order to be filled immediately (as taker), the price will be changed to be just below the bid.</p> <p>Only valid in combination with time_in_force=`\"good_til_cancelled\"`</p>
  'reduceOnly': false, // Boolean | If `true`, the order is considered reduce-only which is intended to only reduce a current position
  'stopPrice': 3.4, // Number | Stop price, required for stop limit orders (Only for stop orders)
  'trigger': "trigger_example", // String | Defines trigger type, required for `\"stop_limit\"` order type
  'advanced': "advanced_example" // String | Advanced option order type. (Only for options)
};
apiInstance.privateSellGet(instrumentName, amount, opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
instrumentName String Instrument name
amount Number It represents the requested order size. For perpetual and futures the amount is in USD units, for options it is amount of corresponding cryptocurrency contracts, e.g., BTC or ETH
type String The order type, default: `&quot;limit&quot;` [optional]
label String user defined label for the order (maximum 32 characters) [optional]
price Number <p>The order price in base currency (Only for limit and stop_limit orders)</p> <p>When adding order with advanced=usd, the field price should be the option price value in USD.</p> <p>When adding order with advanced=implv, the field price should be a value of implied volatility in percentages. For example, price=100, means implied volatility of 100%</p> [optional]
timeInForce String <p>Specifies how long the order remains in effect. Default `&quot;good_til_cancelled&quot;`</p> <ul> <li>`&quot;good_til_cancelled&quot;` - unfilled order remains in order book until cancelled</li> <li>`&quot;fill_or_kill&quot;` - execute a transaction immediately and completely or not at all</li> <li>`&quot;immediate_or_cancel&quot;` - execute a transaction immediately, and any portion of the order that cannot be immediately filled is cancelled</li> </ul> [optional] [default to 'good_til_cancelled']
maxShow Number Maximum amount within an order to be shown to other customers, `0` for invisible order [optional] [default to 1]
postOnly Boolean <p>If true, the order is considered post-only. If the new price would cause the order to be filled immediately (as taker), the price will be changed to be just below the bid.</p> <p>Only valid in combination with time_in_force=`&quot;good_til_cancelled&quot;`</p> [optional] [default to true]
reduceOnly Boolean If `true`, the order is considered reduce-only which is intended to only reduce a current position [optional] [default to false]
stopPrice Number Stop price, required for stop limit orders (Only for stop orders) [optional]
trigger String Defines trigger type, required for `&quot;stop_limit&quot;` order type [optional]
advanced String Advanced option order type. (Only for options) [optional]

Return type

Object

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json