Skip to content
This repository has been archived by the owner on Nov 25, 2021. It is now read-only.

Latest commit

 

History

History
453 lines (336 loc) · 16 KB

ConditionalApi.md

File metadata and controls

453 lines (336 loc) · 16 KB

BybitApi.ConditionalApi

All URIs are relative to https://api.bybit.com

Method HTTP request Description
conditionalCancel POST /v2/private/stop-order/cancel Cancel conditional order.
conditionalCancelAll POST /v2/private/stop-order/cancelAll Cancel conditional order.
conditionalGetOrders GET /v2/private/stop-order/list Get my conditional order list.
conditionalNew POST /v2/private/stop-order/create Place a new conditional order.
conditionalQuery GET /v2/private/stop-order Query real-time stop order information.
conditionalReplace POST /v2/private/stop-order/replace Replace conditional order. Only incomplete orders can be modified.

conditionalCancel

Object conditionalCancel(symbol, opts)

Cancel conditional order.

Example

var BybitApi = require('bybit_api');
var defaultClient = BybitApi.ApiClient.instance;

// Configure API key authorization: apiKey
var apiKey = defaultClient.authentications['apiKey'];
apiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.apiKeyPrefix = 'Token';

// Configure API key authorization: apiSignature
var apiSignature = defaultClient.authentications['apiSignature'];
apiSignature.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiSignature.apiKeyPrefix = 'Token';

// Configure API key authorization: timestamp
var timestamp = defaultClient.authentications['timestamp'];
timestamp.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//timestamp.apiKeyPrefix = 'Token';

var apiInstance = new BybitApi.ConditionalApi();

var symbol = "symbol_example"; // String | Contract type.

var opts = { 
  'stopOrderId': "stopOrderId_example", // String | Order ID of conditional order.
  'orderLinkId': "orderLinkId_example" // String | Agency customized order ID.
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.conditionalCancel(symbol, opts, callback);

Parameters

Name Type Description Notes
symbol String Contract type.
stopOrderId String Order ID of conditional order. [optional]
orderLinkId String Agency customized order ID. [optional]

Return type

Object

Authorization

apiKey, apiSignature, timestamp

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded
  • Accept: application/json

conditionalCancelAll

Object conditionalCancelAll(symbol)

Cancel conditional order.

Example

var BybitApi = require('bybit_api');
var defaultClient = BybitApi.ApiClient.instance;

// Configure API key authorization: apiKey
var apiKey = defaultClient.authentications['apiKey'];
apiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.apiKeyPrefix = 'Token';

// Configure API key authorization: apiSignature
var apiSignature = defaultClient.authentications['apiSignature'];
apiSignature.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiSignature.apiKeyPrefix = 'Token';

// Configure API key authorization: timestamp
var timestamp = defaultClient.authentications['timestamp'];
timestamp.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//timestamp.apiKeyPrefix = 'Token';

var apiInstance = new BybitApi.ConditionalApi();

var symbol = "symbol_example"; // String | Contract type.


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.conditionalCancelAll(symbol, callback);

Parameters

Name Type Description Notes
symbol String Contract type.

Return type

Object

Authorization

apiKey, apiSignature, timestamp

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded
  • Accept: application/json

conditionalGetOrders

Object conditionalGetOrders(symbol, opts)

Get my conditional order list.

Example

var BybitApi = require('bybit_api');
var defaultClient = BybitApi.ApiClient.instance;

// Configure API key authorization: apiKey
var apiKey = defaultClient.authentications['apiKey'];
apiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.apiKeyPrefix = 'Token';

// Configure API key authorization: apiSignature
var apiSignature = defaultClient.authentications['apiSignature'];
apiSignature.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiSignature.apiKeyPrefix = 'Token';

// Configure API key authorization: timestamp
var timestamp = defaultClient.authentications['timestamp'];
timestamp.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//timestamp.apiKeyPrefix = 'Token';

var apiInstance = new BybitApi.ConditionalApi();

var symbol = "symbol_example"; // String | Contract type

var opts = { 
  'stopOrderStatus': "stopOrderStatus_example", // String | Stop order status.
  'limit': 8.14, // Number | Limit for data size per page, max size is 50. Default as showing 20 pieces of data per page.
  'direction': "direction_example", // String | Search direction. prev: prev page, next: next page. Defaults to next
  'cursor': "cursor_example" // String | Page turning mark,Use return cursor,Sign use origin data, in request please urlencode
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.conditionalGetOrders(symbol, opts, callback);

Parameters

Name Type Description Notes
symbol String Contract type
stopOrderStatus String Stop order status. [optional]
limit Number Limit for data size per page, max size is 50. Default as showing 20 pieces of data per page. [optional]
direction String Search direction. prev: prev page, next: next page. Defaults to next [optional]
cursor String Page turning mark,Use return cursor,Sign use origin data, in request please urlencode [optional]

Return type

Object

Authorization

apiKey, apiSignature, timestamp

HTTP request headers

  • Content-Type: application/json, application/x-www-form-urlencoded
  • Accept: application/json

conditionalNew

Object conditionalNew(side, symbol, orderType, qty, basePrice, stopPx, timeInForce, opts)

Place a new conditional order.

Example

var BybitApi = require('bybit_api');
var defaultClient = BybitApi.ApiClient.instance;

// Configure API key authorization: apiKey
var apiKey = defaultClient.authentications['apiKey'];
apiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.apiKeyPrefix = 'Token';

// Configure API key authorization: apiSignature
var apiSignature = defaultClient.authentications['apiSignature'];
apiSignature.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiSignature.apiKeyPrefix = 'Token';

// Configure API key authorization: timestamp
var timestamp = defaultClient.authentications['timestamp'];
timestamp.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//timestamp.apiKeyPrefix = 'Token';

var apiInstance = new BybitApi.ConditionalApi();

var side = "side_example"; // String | Side.

var symbol = "symbol_example"; // String | Contract type.

var orderType = "orderType_example"; // String | Conditional order type.

var qty = "qty_example"; // String | Order quantity.

var basePrice = "basePrice_example"; // String | Send current market price. It will be used to compare with the value of 'stop_px', to decide whether your conditional order will be triggered by crossing trigger price from upper side or lower side. Mainly used to identify the expected direction of the current conditional order..

var stopPx = "stopPx_example"; // String | Trigger price.

var timeInForce = "timeInForce_example"; // String | Time in force.

var opts = { 
  'price': "price_example", // String | Execution price for conditional order
  'triggerBy': "triggerBy_example", // String | Trigger price type. Default LastPrice.
  'closeOnTrigger': true, // Boolean | close on trigger.
  'orderLinkId': "orderLinkId_example" // String | Customized order ID, maximum length at 36 characters, and order ID under the same agency has to be unique..
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.conditionalNew(side, symbol, orderType, qty, basePrice, stopPx, timeInForce, opts, callback);

Parameters

Name Type Description Notes
side String Side.
symbol String Contract type.
orderType String Conditional order type.
qty String Order quantity.
basePrice String Send current market price. It will be used to compare with the value of 'stop_px', to decide whether your conditional order will be triggered by crossing trigger price from upper side or lower side. Mainly used to identify the expected direction of the current conditional order..
stopPx String Trigger price.
timeInForce String Time in force.
price String Execution price for conditional order [optional]
triggerBy String Trigger price type. Default LastPrice. [optional]
closeOnTrigger Boolean close on trigger. [optional]
orderLinkId String Customized order ID, maximum length at 36 characters, and order ID under the same agency has to be unique.. [optional]

Return type

Object

Authorization

apiKey, apiSignature, timestamp

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded
  • Accept: application/json

conditionalQuery

Object conditionalQuery(opts)

Query real-time stop order information.

Example

var BybitApi = require('bybit_api');
var defaultClient = BybitApi.ApiClient.instance;

// Configure API key authorization: apiKey
var apiKey = defaultClient.authentications['apiKey'];
apiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.apiKeyPrefix = 'Token';

// Configure API key authorization: apiSignature
var apiSignature = defaultClient.authentications['apiSignature'];
apiSignature.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiSignature.apiKeyPrefix = 'Token';

// Configure API key authorization: timestamp
var timestamp = defaultClient.authentications['timestamp'];
timestamp.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//timestamp.apiKeyPrefix = 'Token';

var apiInstance = new BybitApi.ConditionalApi();

var opts = { 
  'stopOrderId': "stopOrderId_example", // String | Order ID of conditional order.
  'orderLinkId': "orderLinkId_example", // String | Agency customized order ID.
  'symbol': "symbol_example" // String | Contract type.
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.conditionalQuery(opts, callback);

Parameters

Name Type Description Notes
stopOrderId String Order ID of conditional order. [optional]
orderLinkId String Agency customized order ID. [optional]
symbol String Contract type. [optional]

Return type

Object

Authorization

apiKey, apiSignature, timestamp

HTTP request headers

  • Content-Type: application/json, application/x-www-form-urlencoded
  • Accept: application/json

conditionalReplace

Object conditionalReplace(symbol, opts)

Replace conditional order. Only incomplete orders can be modified.

Example

var BybitApi = require('bybit_api');
var defaultClient = BybitApi.ApiClient.instance;

// Configure API key authorization: apiKey
var apiKey = defaultClient.authentications['apiKey'];
apiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.apiKeyPrefix = 'Token';

// Configure API key authorization: apiSignature
var apiSignature = defaultClient.authentications['apiSignature'];
apiSignature.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiSignature.apiKeyPrefix = 'Token';

// Configure API key authorization: timestamp
var timestamp = defaultClient.authentications['timestamp'];
timestamp.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//timestamp.apiKeyPrefix = 'Token';

var apiInstance = new BybitApi.ConditionalApi();

var symbol = "symbol_example"; // String | Contract type.

var opts = { 
  'stopOrderId': "stopOrderId_example", // String | Stop order ID.
  'orderLinkId': "orderLinkId_example", // String | Order Link ID.
  'pRQty': "pRQty_example", // String | Order quantity.
  'pRPrice': "pRPrice_example", // String | Order price.
  'pRTriggerPrice': "pRTriggerPrice_example" // String | Trigger price.
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.conditionalReplace(symbol, opts, callback);

Parameters

Name Type Description Notes
symbol String Contract type.
stopOrderId String Stop order ID. [optional]
orderLinkId String Order Link ID. [optional]
pRQty String Order quantity. [optional]
pRPrice String Order price. [optional]
pRTriggerPrice String Trigger price. [optional]

Return type

Object

Authorization

apiKey, apiSignature, timestamp

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded
  • Accept: application/json