Pulse API Documentation v2.0
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
Pulse provides developers with three distinct interfaces to access its API:
JSON-RPC over Websocket: This interface offers real-time communication capabilities. JSON-RPC over HTTP: This interface is suitable for traditional HTTP requests. In addition to the production environment, Pulse offers dedicated development (dev.pulsegateway.devucc.name) and staging (stg.pulsegateway.devucc.name) environments for testing purposes. All examples within this documentation utilize these testing environments.
Separate Accounts and Credentials:
It's important to note that the development and staging environments operate independently and require separate accounts and credentials (API keys) for authentication using private methods. The Pulse team will provide test credentials for these environments.
Accessing Pulse API Endpoints:
REST API: All REST API URL endpoints are accessible from the following base URL: http://dev.pulsegateway.devucc.name/api/v2. The primary distinction between GET and POST requests lies in how parameters are passed. POST requests utilize the request body, while GET requests utilize query parameters. Websocket Endpoints: Websocket endpoints are accessible from wss://dev.pulsegateway.devucc.name/ws/api/v2. Currently, only websockets support subscription endpoints. API Documentation Structure:
This API documentation is organized into the following sections:
- Authentication: This section details the authentication process for accessing private methods.
- Market Data: This section describes functionalities related to market data retrieval.
- Trading: This section covers functionalities related to trading activities.
- Wallet: This section details functionalities related to user wallets.
- Subscription Management: This section outlines functionalities for managing subscriptions.
Authentication
/public/auth
Code samples
# You can also use wget
curl -X GET /api/v2/public/auth?grant_type=string&client_id=string&client_secret=string&refresh_token=string&signature=string×tamp=0&nonce=string&data=string \
-H 'Accept: application/json'
const headers = {
'Accept':'application/json'
};
fetch('/api/v2/public/auth?grant_type=string&client_id=string&client_secret=string&refresh_token=string&signature=string×tamp=0&nonce=string&data=string',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get '/api/v2/public/auth',
params: {
'grant_type' => 'string',
'client_id' => 'string',
'client_secret' => 'string',
'refresh_token' => 'string',
'signature' => 'string',
'timestamp' => 'integer',
'nonce' => 'string',
'data' => 'string'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('/api/v2/public/auth', params={
'grant_type': 'string', 'client_id': 'string', 'client_secret': 'string', 'refresh_token': 'string', 'signature': 'string', 'timestamp': '0', 'nonce': 'string', 'data': 'string'
}, headers = headers)
print(r.json())
GET /api/v2/public/auth
Retrieve an Oauth access token, to be used for authentication of 'private' requests.
Three methods of authentication are supported:
client_credentials - using the client id and client secret that can be found on the API page on the website
client_signature - using the client id that can be found on the API page on the website and user generated signature. The signature is calculated using some fields provided in the request, using formula described here Deribit signature credentials
refresh_token - using a refresh token that was received from an earlier invocation
The response will contain an access token, expiration period (number of seconds that the token is valid) and a refresh token that can be used to get a new set of tokens.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| grant_type | query | string | true | Method of authentication (client_credentials, client_signature, refresh_token) |
| client_id | query | string | true | client_id Required for grant type client_credentials and client_signature |
| client_secret | query | string | true | client_secret Required for grant type client_credentials |
| refresh_token | query | string | true | Required for grant type refresh_token |
| signature | query | string | true | Required for grant type client_signature; it's a cryptographic signature calculated over provided fields using user secret key. The signature should be calculated as an HMAC (Hash-based Message Authentication Code) with SHA256 hash algorithm |
| timestamp | query | integer | true | Required for grant type client_signature, provides time when request has been generated (milliseconds since the UNIX epoch) |
| nonce | query | string | true | Optional for grant type client_signature; delivers user generated initialization vector for the server token |
| data | query | string | true | Optional for grant type client_signature; contains any user specific value |
Example responses
200 Response
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
"expires_in": 1516239022,
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
"scope": "connection mainaccount",
"token_type": "bearer"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | services.LoginResponse |
/private/logout
Code samples
# You can also use wget
curl -X POST /ws/api/v2/private/logout?invalidate_token=true \
-H 'Authorization: string'
const headers = {
'Authorization':'string'
};
fetch('/ws/api/v2/private/logout?invalidate_token=true',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Authorization' => 'string'
}
result = RestClient.post '/ws/api/v2/private/logout',
params: {
'invalidate_token' => 'boolean'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Authorization': 'string'
}
r = requests.post('/ws/api/v2/private/logout', params={
'invalidate_token': 'true'
}, headers = headers)
print(r.json())
POST /ws/api/v2/private/logout
Gracefully close websocket connection, when COD (Cancel On Disconnect) is enabled orders are not cancelled
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| invalidate_token | query | boolean | true | Invalidate token |
| Authorization | header | string | true | Authorization |
Responses
| Status | Meaning | Description | Schema |
|---|
Market Data
/private/get_instruments
Code samples
# You can also use wget
curl -X POST /api/v2/private/get_instruments \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: string'
const inputBody = '{
"currency": "BTC",
"expired": true,
"kind": "option"
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'string'
};
fetch('/api/v2/private/get_instruments',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'string'
}
result = RestClient.post '/api/v2/private/get_instruments',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'string'
}
r = requests.post('/api/v2/private/get_instruments', headers = headers)
print(r.json())
POST /api/v2/private/get_instruments
Retrieves available trading instruments. This method can be used to see which instruments are available for trading, or which instruments have recently expired.
Body parameter
{
"currency": "BTC",
"expired": true,
"kind": "option"
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| Authorization | header | string | true | Authorization |
| body | body | models.GetInstruments | true | GetInstruments model |
| » currency | body | string | true | The currency symbol |
| » expired | body | boolean | false | Set to true to show recently expired instruments instead of active ones |
| » kind | body | string | false | Instrument kind, if not provided instruments of all kinds are considered |
Example responses
200 Response
[
{
"base_currency": "USD",
"contract_size": 1,
"expiration_timestamp": 1673596800000,
"instrument_name": "BTC-31JUN23-50000-C",
"is_active": true,
"kind": "option",
"option_type": "put",
"price_index": "btc_usd",
"quote_currency": "BTC",
"settlement_currency": "USD",
"strike": 50000
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | Inline |
| 400 | Bad Request | Bad Request | connection.Message |
Response Schema
Status Code 200
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | [models.GetInstrumentResponse] | false | none | none |
| » base_currency | string | false | none | The underlying currency being traded |
| » contract_size | integer | false | none | Contract size for instrument |
| » expiration_timestamp | integer | false | none | The time when the instrument will expire |
| » instrument_name | string | false | none | Unique instrument identifier |
| » is_active | boolean | false | none | Indicates if the instrument can currently be traded |
| » kind | string | false | none | Instrument kind |
| » option_type | string | false | none | Option only |
| » price_index | string | false | none | Name of price index that is used for this instrument |
| » quote_currency | string | false | none | The currency in which the instrument prices are quoted |
| » settlement_currency | string | false | none | Settlement currency for the instrument. |
| » strike | number | false | none | The strike value |
/private/get_tradingview_chart_data
Code samples
# You can also use wget
curl -X POST /api/v2/private/get_tradingview_chart_data \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: string'
const inputBody = '{
"end_timestamp": 1550757626706,
"instrument_name": "BTC-31JUN23-50000-C",
"resolution": "1",
"start_timestamp": 1550757626706
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'string'
};
fetch('/api/v2/private/get_tradingview_chart_data',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'string'
}
result = RestClient.post '/api/v2/private/get_tradingview_chart_data',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'string'
}
r = requests.post('/api/v2/private/get_tradingview_chart_data', headers = headers)
print(r.json())
POST /api/v2/private/get_tradingview_chart_data
Publicly available market data used to generate a TradingView candle chart.
Body parameter
{
"end_timestamp": 1550757626706,
"instrument_name": "BTC-31JUN23-50000-C",
"resolution": "1",
"start_timestamp": 1550757626706
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| Authorization | header | string | true | Authorization |
| body | body | models.GetTradingviewChartDataRequest | true | GetTradingviewChartDataRequest model |
| » end_timestamp | body | integer | true | The most recent timestamp to return result from |
| » instrument_name | body | string | true | Instrument name |
| » resolution | body | string | true | Chart bars resolution given in full minutes or keyword 1D |
| » start_timestamp | body | integer | true | The earliest timestamp to return result from |
Example responses
200 Response
{
"close": [
19.007942601,
20.095877981
],
"cost": [
19.007942601,
20.095877981
],
"high": [
19.007942601,
20.095877981
],
"low": [
19.007942601,
20.095877981
],
"open": [
19.007942601,
20.095877981
],
"status": "ok",
"ticks": [
1554373800000,
1554375600000
],
"volume": [
19.007942601,
20.095877981
]
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | models.GetTradingviewChartDataResponse |
| 400 | Bad Request | Bad Request | connection.Message |
/public/get_delivery_prices
Code samples
# You can also use wget
curl -X POST /api/v2/public/get_delivery_prices \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
const inputBody = '{
"count": 10,
"index_name": "btc_usd",
"offset": 0
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json'
};
fetch('/api/v2/public/get_delivery_prices',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
}
result = RestClient.post '/api/v2/public/get_delivery_prices',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
r = requests.post('/api/v2/public/get_delivery_prices', headers = headers)
print(r.json())
POST /api/v2/public/get_delivery_prices
Get delivery prices
Body parameter
{
"count": 10,
"index_name": "btc_usd",
"offset": 0
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | models.GetDeliveryPrices | true | GetDeliveryPrices model |
| » count | body | integer | false | Number of requested items, default - 10 |
| » index_name | body | string | true | Index identifier, matches (base) cryptocurrency with quote currency |
| » offset | body | integer | false | The offset for pagination, default - 0 |
Example responses
200 Response
[
{
"date": "2020-01-02",
"delivery_price": 7131.214606410254
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | Inline |
| 400 | Bad Request | Bad Request | connection.Message |
Response Schema
Status Code 200
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | [models.GetDeliveryPricesResponse] | false | none | none |
| » date | string | false | none | The event date with year, month and day |
| » delivery_price | number | false | none | The settlement price for the instrument. |
/public/get_funding_chart_data
Code samples
# You can also use wget
curl -X POST /api/v2/public/get_funding_chart_data \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
const inputBody = '{
"instrument_name": "BTC_USD-PERPETUAL",
"length": "8h"
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json'
};
fetch('/api/v2/public/get_funding_chart_data',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
}
result = RestClient.post '/api/v2/public/get_funding_chart_data',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
r = requests.post('/api/v2/public/get_funding_chart_data', headers = headers)
print(r.json())
POST /api/v2/public/get_funding_chart_data
This method returns the funding chart data.
Body parameter
{
"instrument_name": "BTC_USD-PERPETUAL",
"length": "8h"
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | models.GetFundingChartDataRequest | true | GetFundingChartDataRequest model |
| » instrument_name | body | string | true | Instrument name |
| » length | body | string | true | Specifies time period. 8h - 8 hours, 24h - 24 hours, 1m - 1 month |
Example responses
200 Response
{
"current_payment": 1e-8,
"funding_payments": [
{
"payment": 0,
"range_end": 0,
"range_start": 0,
"timestamp": 0
}
],
"funding_prices": [
{
"perp_close": 50500,
"perp_high": 51000,
"perp_low": 49000,
"perp_open": 50000,
"spot_close": 50500,
"spot_high": 51000,
"spot_low": 49000,
"spot_open": 50000,
"timestamp": 1612137600
}
]
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | models.GetFundingChartDataResponse |
| 400 | Bad Request | Bad Request | connection.Message |
/public/get_funding_rate_history
Code samples
# You can also use wget
curl -X POST /api/v2/public/get_funding_rate_history \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
const inputBody = '{
"end_timestamp": 1612137600,
"instrument_name": "BTC_USD-PERPETUAL",
"start_timestamp": 1609459200
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json'
};
fetch('/api/v2/public/get_funding_rate_history',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
}
result = RestClient.post '/api/v2/public/get_funding_rate_history',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
r = requests.post('/api/v2/public/get_funding_rate_history', headers = headers)
print(r.json())
POST /api/v2/public/get_funding_rate_history
This method returns the funding rate history.
Body parameter
{
"end_timestamp": 1612137600,
"instrument_name": "BTC_USD-PERPETUAL",
"start_timestamp": 1609459200
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | models.GetFundingRateHistoryRequest | true | GetFundingRateHistoryRequest model |
| » end_timestamp | body | integer | false | End timestamp |
| » instrument_name | body | string | false | Instrument name |
| » start_timestamp | body | integer | false | Start timestamp |
Example responses
200 Response
[
{
"current_payment": 6122.334,
"funding_payments": [
{
"payment": 0,
"range_end": 0,
"range_start": 0,
"timestamp": 0
}
],
"funding_prices": [
{
"perp_close": 50500,
"perp_high": 51000,
"perp_low": 49000,
"perp_open": 50000,
"spot_close": 50500,
"spot_high": 51000,
"spot_low": 49000,
"spot_open": 50000,
"timestamp": 1612137600
}
]
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | Inline |
| 400 | Bad Request | Bad Request | connection.Message |
Response Schema
Status Code 200
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | [models.GetFundingRateHistoryResponse] | false | none | none |
| » current_payment | number | false | none | Current payment |
| » funding_payments | [models.FundingPaymentArray] | false | none | Funding payments |
| »» payment | number | false | none | none |
| »» range_end | integer | false | none | none |
| »» range_start | integer | false | none | none |
| »» timestamp | integer | false | none | none |
| » funding_prices | [models.FundingPriceArray] | false | none | Funding prices |
| »» perp_close | number | false | none | Perpetual contract close price |
| »» perp_high | number | false | none | Perpetual contract high price |
| »» perp_low | number | false | none | Perpetual contract low price |
| »» perp_open | number | false | none | Perpetual contract open price |
| »» spot_close | number | false | none | Spot market close price |
| »» spot_high | number | false | none | Spot market high price |
| »» spot_low | number | false | none | Spot market low price |
| »» spot_open | number | false | none | Spot market open price |
| »» timestamp | integer | false | none | Timestamp of the price data |
/public/get_index_price
Code samples
# You can also use wget
curl -X POST /api/v2/public/get_index_price \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
const inputBody = '{
"index_name": "btc_usd"
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json'
};
fetch('/api/v2/public/get_index_price',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
}
result = RestClient.post '/api/v2/public/get_index_price',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
r = requests.post('/api/v2/public/get_index_price', headers = headers)
print(r.json())
POST /api/v2/public/get_index_price
This method returns the index price.
Body parameter
{
"index_name": "btc_usd"
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | models.GetIndexPrice | true | GetIndexPrice model |
| » index_name | body | string | true | Index identifier |
Example responses
200 Response
0
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | IndexPrice | number |
| 400 | Bad Request | Bad Request | connection.Message |
/public/last_trades_by_instrument
Code samples
# You can also use wget
curl -X POST /api/v2/public/last_trades_by_instrument \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
const inputBody = '{
"count": 10,
"end_seq": 1966042,
"end_timestamp": 1590480724473,
"instrument_name": "BTC-31JUN23-50000-C",
"sorting": "asc",
"start_seq": 1966042,
"start_timestamp": 1590480724473
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json'
};
fetch('/api/v2/public/last_trades_by_instrument',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
}
result = RestClient.post '/api/v2/public/last_trades_by_instrument',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
r = requests.post('/api/v2/public/last_trades_by_instrument', headers = headers)
print(r.json())
POST /api/v2/public/last_trades_by_instrument
This method returns the last trades by instrument.
Body parameter
{
"count": 10,
"end_seq": 1966042,
"end_timestamp": 1590480724473,
"instrument_name": "BTC-31JUN23-50000-C",
"sorting": "asc",
"start_seq": 1966042,
"start_timestamp": 1590480724473
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | models.GetLastTradesByInstrument | true | GetLastTradesByInstrument model |
| » count | body | integer | false | Number of requested items |
| » end_seq | body | integer | false | The sequence number of the last trade to be returned |
| » end_timestamp | body | integer | false | The most recent timestamp to return result from, milliseconds since the UNIX epoch |
| » instrument_name | body | string | false | Unique instrument identifier |
| » sorting | body | string | false | Direction of results sorting (asc,desc,default) |
| » start_seq | body | integer | false | The sequence number of the first trade to be returned |
| » start_timestamp | body | integer | false | The earliest timestamp to return result from, milliseconds since the UNIX epoch |
Example responses
200 Response
[
{
"amount": 10,
"api": true,
"direction": "buy",
"index_price": 50000,
"instrument_name": "BTC-31JUN23-50000-C",
"mark_iv": 0.5,
"mark_price": 49500,
"price": 50000,
"tick_direction": 0,
"timestamp": 1612137600,
"trade_id": "66fa560b912a3148d07efacf",
"trade_seq": 1
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | TradeResponse | Inline |
| 400 | Bad Request | Bad Request | connection.Message |
Response Schema
Status Code 200
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | [models.TradesResponse] | false | none | none |
| » amount | number | false | none | Trade amount |
| » api | boolean | false | none | API |
| » direction | string | false | none | Direction |
| » index_price | number | false | none | Index price |
| » instrument_name | string | false | none | Unique instrument identifier |
| » mark_iv | number | false | none | Mark IV |
| » mark_price | number | false | none | Mark price |
| » price | number | false | none | Price |
| » tick_direction | integer | false | none | Tick direction |
| » timestamp | integer | false | none | Trade timestamp |
| » trade_id | string | false | none | Trade ID |
| » trade_seq | integer | false | none | Trade sequence |
/public/disable_heartbeat
Code samples
# You can also use wget
curl -X POST /ws/api/v2/public/disable_heartbeat \
-H 'Accept: application/json'
const headers = {
'Accept':'application/json'
};
fetch('/ws/api/v2/public/disable_heartbeat',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.post '/ws/api/v2/public/disable_heartbeat',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.post('/ws/api/v2/public/disable_heartbeat', headers = headers)
print(r.json())
POST /ws/api/v2/public/disable_heartbeat
This method disables the heartbeat subscription.
Example responses
200 Response
{
"description": "ok",
"response": null,
"status": 200
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | Message | connection.Message |
| 400 | Bad Request | Bad Request | connection.Message |
/public/set_heartbeat
Code samples
# You can also use wget
curl -X POST /ws/api/v2/public/set_heartbeat?interval=0 \
-H 'Accept: application/json'
const headers = {
'Accept':'application/json'
};
fetch('/ws/api/v2/public/set_heartbeat?interval=0',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.post '/ws/api/v2/public/set_heartbeat',
params: {
'interval' => 'integer'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.post('/ws/api/v2/public/set_heartbeat', params={
'interval': '0'
}, headers = headers)
print(r.json())
POST /ws/api/v2/public/set_heartbeat
This method sets the heartbeat subscription.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| interval | query | integer | true | Interval in seconds |
Example responses
200 Response
{
"description": "ok",
"response": null,
"status": 200
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | Message | connection.Message |
Trading
/private/buy
Code samples
# You can also use wget
curl -X POST /api/v2/private/buy \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: string'
const inputBody = '{
"id": 1,
"jsonrpc": "2.0",
"method": "Method Name",
"params": {
"amount": 10,
"instrument_name": "BTC-31JUN23-50000-C",
"label": "label_example",
"linked_order_type": "one_triggers_one_cancels_other",
"max_show": 40,
"mmp": true,
"otoco_config": [
{
"amount": 10,
"direction": "buy",
"price": 62000,
"time_in_force": "good_til_cancelled",
"trigger": "index_price",
"trigger_price": 63000,
"type": "limit"
}
],
"post_only": false,
"price": 60000,
"reduce_only": false,
"time_in_force": "good_til_cancelled",
"trigger": "index_price",
"trigger_fill_condition": "incremental",
"trigger_price": 65000,
"type": "limit"
}
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'string'
};
fetch('/api/v2/private/buy',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'string'
}
result = RestClient.post '/api/v2/private/buy',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'string'
}
r = requests.post('/api/v2/private/buy', headers = headers)
print(r.json())
POST /api/v2/private/buy
Places a buy order for an instrument.
Body parameter
{
"id": 1,
"jsonrpc": "2.0",
"method": "Method Name",
"params": {
"amount": 10,
"instrument_name": "BTC-31JUN23-50000-C",
"label": "label_example",
"linked_order_type": "one_triggers_one_cancels_other",
"max_show": 40,
"mmp": true,
"otoco_config": [
{
"amount": 10,
"direction": "buy",
"price": 62000,
"time_in_force": "good_til_cancelled",
"trigger": "index_price",
"trigger_price": 63000,
"type": "limit"
}
],
"post_only": false,
"price": 60000,
"reduce_only": false,
"time_in_force": "good_til_cancelled",
"trigger": "index_price",
"trigger_fill_condition": "incremental",
"trigger_price": 65000,
"type": "limit"
}
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| Authorization | header | string | true | Authorization |
| body | body | models.Request-models_BuySell | true | BuySell model |
| » id | body | integer | false | Request ID |
| » jsonrpc | body | string | false | jsonRPC version |
| » method | body | string | false | Method Name |
| » params | body | models.BuySell | false | none |
| »» amount | body | number | true | It represents the requested order size. For perpetual and inverse futures, the amount is in USD units. For linear futures, it is the underlying base currency coin. For options, it is the amount of corresponding cryptocurrency contracts, e.g., BTC or ETH. |
| »» instrument_name | body | string | false | Instrument name |
| »» label | body | string | false | user defined label for the order |
| »» linked_order_type | body | types.LinkedOrderType | false | The type of the linked order. |
| »» max_show | body | number | false | Maximum amount within an order to be shown to other customers, 0 for invisible order |
| »» mmp | body | boolean | false | none |
| »» otoco_config | body | [models.OtocoConfig] | false | List of trades to create or cancel when this order is filled. |
| »»» amount | body | number | false | It represents the requested order size. For perpetual and inverse futures, the amount is in USD units. For linear futures, it is the underlying base currency coin. For options, it is the amount of corresponding cryptocurrency contracts, e.g., BTC or ETH. |
| »»» direction | body | types.Side | false | Direction: buy, or sell |
| »»» price | body | number | false | The order price in the base currency (Only for limit and stop_limit orders). When adding an order with advanced=usd, the field price should be the option price value in USD. When adding an 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%. |
| »»» time_in_force | body | types.TimeInForce | false | Specifies how long the order remains in effect. Default "good_til_cancelled". - "good_til_cancelled" unfilled order remains in order book until cancelled. - "good_til_day" unfilled order remains in order book till the end of the trading session. - "fill_or_kill" execute a transaction immediately and completely or not at all. - "immediate_or_cancel" execute a transaction immediately, and any portion of the order that cannot be immediately filled is cancelled |
| »»» trigger | body | types.Trigger | false | Defines the trigger type. Required for "Stop-Loss", "Take-Profit" and "Trailing" trigger orders |
| »»» trigger_price | body | number | false | Trigger price, required for trigger orders only (Stop-loss or Take-profit orders) |
| »»» type | body | types.Type | false | the order type include limit, market, stop_limit, stop_market, take_limit, take_market |
| »» post_only | body | boolean | false | 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 spread. Only valid in combination with time_in_force="good_til_cancelled" |
| »» price | body | number | false | The order price in the base currency (Only for limit and stop_limit orders). When adding an order with advanced=usd, the field price should be the option price value in USD. When adding an 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%. |
| »» reduce_only | body | boolean | false | If true, the order is considered reduce-only which is intended to only reduce a current position |
| »» time_in_force | body | types.TimeInForce | false | Specifies how long the order remains in effect. Default "good_til_cancelled". - "good_til_cancelled" unfilled order remains in order book until cancelled. - "good_til_day" unfilled order remains in order book till the end of the trading session. - "fill_or_kill" execute a transaction immediately and completely or not at all. - "immediate_or_cancel" execute a transaction immediately, and any portion of the order that cannot be immediately filled is cancelled |
| »» trigger | body | string | false | Defines the trigger type. Required for "Stop-Loss", "Take-Profit" and "Trailing" trigger orders |
| »» trigger_fill_condition | body | types.TriggerFillCondition | false | The fill condition of the linked order (Only for linked order types), default: first_hit. |
| »» trigger_price | body | number | false | Trigger price, required for trigger orders only (Stop-loss or Take-profit orders) |
| »» type | body | types.Type | false | The order type |
Enumerated Values
| Parameter | Value |
|---|---|
| »» linked_order_type | one_triggers_other |
| »» linked_order_type | one_triggers_one_cancels_other |
| »»» direction | buy |
| »»» direction | sell |
| »»» direction | edit |
| »»» direction | edit_leverage |
| »»» direction | cancel |
| »»» direction | cancel_all |
| »»» direction | cancel_all_by_instrument |
| »»» direction | cancel_all_by_connection_id |
| »»» time_in_force | good_til_cancelled |
| »»» time_in_force | good_til_day |
| »»» time_in_force | fill_or_kill |
| »»» time_in_force | immediate_or_cancel |
| »»» trigger | index_price |
| »»» trigger | last_price |
| »»» type | all |
| »»» type | limit |
| »»» type | stop_limit |
| »»» type | take_limit |
| »»» type | market |
| »»» type | stop_market |
| »»» type | take_market |
| »»» type | trigger_all |
| »» time_in_force | good_til_cancelled |
| »» time_in_force | good_til_day |
| »» time_in_force | fill_or_kill |
| »» time_in_force | immediate_or_cancel |
| »» trigger_fill_condition | first_hit |
| »» trigger_fill_condition | complete_fill |
| »» trigger_fill_condition | incremental |
| »» type | all |
| »» type | limit |
| »» type | stop_limit |
| »» type | take_limit |
| »» type | market |
| »» type | stop_market |
| »» type | take_market |
| »» type | trigger_all |
Example responses
200 Response
{
"order": {
"amount": 10,
"api": true,
"average_price": 50000,
"cancel_reason": "user_request",
"creation_timestamp": 1612137600,
"direction": "buy",
"filled_amount": 10,
"instrument_name": "BTC-31JUN23-50000-C",
"is_primary_otoco": true,
"is_secondary_oto": true,
"label": "my_order",
"last_update_timestamp": 1612137600,
"linked_order_type": "one_triggers_one_cancels_other",
"max_show": 0,
"mmp": true,
"order_id": "60c72b2f9b1e8a001c8e4d5a",
"order_state": "open",
"order_type": "limit",
"oto_order_ids": [
"60c72b2f9b1e8a001c8e4d5b"
],
"post_only": true,
"price": 50000,
"primary_order_id": "60c72b2f9b1e8a001c8e4d5c",
"reduce_only": true,
"replaced": false,
"status_otoco": "active",
"time_in_force": "good_til_cancelled",
"trigger": "index_price",
"trigger_fill_condition": "incremental",
"trigger_price": 63000,
"usd": 1000
},
"trades": [
{
"advanced": "usd",
"amount": 10,
"api": true,
"direction": "buy",
"index_price": 50000,
"instrument_name": "BTC-31JUN23-50000-C",
"label": "my_trade",
"mark_price": 49500,
"order_id": "60c72b2f9b1e8a001c8e4d5a",
"order_type": "limit",
"price": 50000,
"state": "filled",
"tick_direction": 0,
"timestamp": 1612137600,
"trade_id": "66fa560b912a3148d07efacf",
"trade_seq": 1,
"underlying_index": "BTCUSD",
"underlying_price": 49000
}
]
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | models.BuySellResponse |
| 400 | Bad Request | Bad Request | connection.Message |
/private/cancel
Code samples
# You can also use wget
curl -X POST /api/v2/private/cancel \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: string'
const inputBody = '{
"id": 1,
"jsonrpc": "2.0",
"method": "Method Name",
"params": {
"order_id": "646f0ae259c5e9efdb83c564"
}
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'string'
};
fetch('/api/v2/private/cancel',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'string'
}
result = RestClient.post '/api/v2/private/cancel',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'string'
}
r = requests.post('/api/v2/private/cancel', headers = headers)
print(r.json())
POST /api/v2/private/cancel
Cancel an order, specified by order id
Body parameter
{
"id": 1,
"jsonrpc": "2.0",
"method": "Method Name",
"params": {
"order_id": "646f0ae259c5e9efdb83c564"
}
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| Authorization | header | string | true | Authorization |
| body | body | models.Request-models_Cancel | true | cancel model |
| » id | body | integer | false | Request ID |
| » jsonrpc | body | string | false | jsonRPC version |
| » method | body | string | false | Method Name |
| » params | body | models.Cancel | false | none |
| »» order_id | body | string | true | The order id |
Example responses
200 Response
{
"amount": 10,
"api": true,
"average_price": 50000,
"cancel_reason": "user_request",
"creation_timestamp": 1612137600,
"direction": "buy",
"filled_amount": 10,
"instrument_name": "BTC-31JUN23-50000-C",
"is_primary_otoco": true,
"is_secondary_oto": true,
"label": "my_order",
"last_update_timestamp": 1612137600,
"linked_order_type": "one_triggers_one_cancels_other",
"max_show": 0,
"mmp": true,
"order_id": "60c72b2f9b1e8a001c8e4d5a",
"order_state": "open",
"order_type": "limit",
"oto_order_ids": [
"60c72b2f9b1e8a001c8e4d5b"
],
"post_only": true,
"price": 50000,
"primary_order_id": "60c72b2f9b1e8a001c8e4d5c",
"reduce_only": true,
"replaced": false,
"status_otoco": "active",
"time_in_force": "good_til_cancelled",
"trigger": "index_price",
"trigger_fill_condition": "incremental",
"trigger_price": 63000,
"usd": 1000
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | models.OrderConfirmation |
| 400 | Bad Request | Bad Request | connection.Message |
/private/cancel_all
Code samples
# You can also use wget
curl -X POST /api/v2/private/cancel_all \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: string'
const inputBody = '{
"id": 1,
"jsonrpc": "2.0",
"method": "Method Name",
"params": {
"detailed": true
}
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'string'
};
fetch('/api/v2/private/cancel_all',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'string'
}
result = RestClient.post '/api/v2/private/cancel_all',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'string'
}
r = requests.post('/api/v2/private/cancel_all', headers = headers)
print(r.json())
POST /api/v2/private/cancel_all
This method cancels all users orders and trigger orders within all currencies and instrument kinds.
Body parameter
{
"id": 1,
"jsonrpc": "2.0",
"method": "Method Name",
"params": {
"detailed": true
}
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| Authorization | header | string | true | Authorization |
| body | body | models.Request-models_CancelAll | true | cancel all model |
| » id | body | integer | false | Request ID |
| » jsonrpc | body | string | false | jsonRPC version |
| » method | body | string | false | Method Name |
| » params | body | models.CancelAll | false | none |
| »» detailed | body | boolean | false | When detailed is set to true output format is changed. See description. Default: false |
Example responses
200 Response
[
{
"amount": 10,
"api": true,
"average_price": 50000,
"cancel_reason": "user_request",
"creation_timestamp": 1612137600,
"direction": "buy",
"filled_amount": 10,
"instrument_name": "BTC-31JUN23-50000-C",
"is_primary_otoco": true,
"is_secondary_oto": true,
"label": "my_order",
"last_update_timestamp": 1612137600,
"linked_order_type": "one_triggers_one_cancels_other",
"max_show": 0,
"mmp": true,
"order_id": "60c72b2f9b1e8a001c8e4d5a",
"order_state": "open",
"order_type": "limit",
"oto_order_ids": [
"60c72b2f9b1e8a001c8e4d5b"
],
"post_only": true,
"price": 50000,
"primary_order_id": "60c72b2f9b1e8a001c8e4d5c",
"reduce_only": true,
"replaced": false,
"status_otoco": "active",
"time_in_force": "good_til_cancelled",
"trigger": "index_price",
"trigger_fill_condition": "incremental",
"trigger_price": 63000,
"usd": 1000
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | Inline |
| 400 | Bad Request | Bad Request | connection.Message |
Response Schema
Status Code 200
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | [models.OrderConfirmation] | false | none | none |
| » amount | number | false | none | Order size |
| » api | boolean | false | none | API |
| » average_price | number | false | none | Average price |
| » cancel_reason | string | false | none | Cancel reason |
| » creation_timestamp | integer | false | none | Creation timestamp |
| » direction | types.Side | false | none | Direction |
| » filled_amount | number | false | none | Filled amount |
| » instrument_name | string | false | none | Unique instrument identifier |
| » is_primary_otoco | boolean | false | none | Primary OTOCO |
| » is_secondary_oto | boolean | false | none | Secondary OTO |
| » label | string | false | none | User defined label |
| » last_update_timestamp | integer | false | none | Last update timestamp |
| » linked_order_type | types.LinkedOrderType | false | none | Linked order type |
| » max_show | number | false | none | Max show |
| » mmp | boolean | false | none | Market maker protection |
| » order_id | string | false | none | Unique order identifier |
| » order_state | types.OrderStatus | false | none | Order state |
| » order_type | types.Type | false | none | Order type |
| » oto_order_ids | [string] | false | none | OTO order IDs |
| » post_only | boolean | false | none | Post-only |
| » price | number | false | none | Price |
| » primary_order_id | string | false | none | Primary order ID |
| » reduce_only | boolean | false | none | Reduce-only |
| » replaced | boolean | false | none | Replaced |
| » status_otoco | types.StatusOtoco | false | none | Status of the OTCO order |
| » time_in_force | types.TimeInForce | false | none | Time in force |
| » trigger | types.Trigger | false | none | Trigger type |
| » trigger_fill_condition | types.TriggerFillCondition | false | none | Trigger fill condition |
| » trigger_price | number | false | none | Trigger price |
| » usd | number | false | none | Option price in USD |
Enumerated Values
| Property | Value |
|---|---|
| direction | buy |
| direction | sell |
| direction | edit |
| direction | edit_leverage |
| direction | cancel |
| direction | cancel_all |
| direction | cancel_all_by_instrument |
| direction | cancel_all_by_connection_id |
| linked_order_type | one_triggers_other |
| linked_order_type | one_triggers_one_cancels_other |
| order_state | open |
| order_state | partially_filled |
| order_state | filled |
| order_state | cancelled |
| order_state | untriggered |
| order_state | rejected |
| order_type | all |
| order_type | limit |
| order_type | stop_limit |
| order_type | take_limit |
| order_type | market |
| order_type | stop_market |
| order_type | take_market |
| order_type | trigger_all |
| status_otoco | active |
| status_otoco | draft |
| time_in_force | good_til_cancelled |
| time_in_force | good_til_day |
| time_in_force | fill_or_kill |
| time_in_force | immediate_or_cancel |
| trigger | index_price |
| trigger | last_price |
| trigger_fill_condition | first_hit |
| trigger_fill_condition | complete_fill |
| trigger_fill_condition | incremental |
/private/cancel_all_by_instrument
Code samples
# You can also use wget
curl -X POST /api/v2/private/cancel_all_by_instrument \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: string'
const inputBody = '{
"id": 1,
"jsonrpc": "2.0",
"method": "Method Name",
"params": {
"detailed": true,
"instrument_name": "BTC-31JUN23-50000-C",
"type": "limit"
}
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'string'
};
fetch('/api/v2/private/cancel_all_by_instrument',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'string'
}
result = RestClient.post '/api/v2/private/cancel_all_by_instrument',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'string'
}
r = requests.post('/api/v2/private/cancel_all_by_instrument', headers = headers)
print(r.json())
POST /api/v2/private/cancel_all_by_instrument
This method cancels all users orders and trigger orders within all currencies and instrument kinds.
Body parameter
{
"id": 1,
"jsonrpc": "2.0",
"method": "Method Name",
"params": {
"detailed": true,
"instrument_name": "BTC-31JUN23-50000-C",
"type": "limit"
}
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| Authorization | header | string | true | Authorization |
| body | body | models.Request-models_CancelAllByInstrument | true | cancel all by instrument model |
| » id | body | integer | false | Request ID |
| » jsonrpc | body | string | false | jsonRPC version |
| » method | body | string | false | Method Name |
| » params | body | models.CancelAllByInstrument | false | none |
| »» detailed | body | boolean | false | none |
| »» instrument_name | body | string | true | Instrument name |
| »» type | body | types.Type | false | Order type |
Enumerated Values
| Parameter | Value |
|---|---|
| »» type | all |
| »» type | limit |
| »» type | stop_limit |
| »» type | take_limit |
| »» type | market |
| »» type | stop_market |
| »» type | take_market |
| »» type | trigger_all |
Example responses
200 Response
[
{
"amount": 10,
"api": true,
"average_price": 50000,
"cancel_reason": "user_request",
"creation_timestamp": 1612137600,
"direction": "buy",
"filled_amount": 10,
"instrument_name": "BTC-31JUN23-50000-C",
"is_primary_otoco": true,
"is_secondary_oto": true,
"label": "my_order",
"last_update_timestamp": 1612137600,
"linked_order_type": "one_triggers_one_cancels_other",
"max_show": 0,
"mmp": true,
"order_id": "60c72b2f9b1e8a001c8e4d5a",
"order_state": "open",
"order_type": "limit",
"oto_order_ids": [
"60c72b2f9b1e8a001c8e4d5b"
],
"post_only": true,
"price": 50000,
"primary_order_id": "60c72b2f9b1e8a001c8e4d5c",
"reduce_only": true,
"replaced": false,
"status_otoco": "active",
"time_in_force": "good_til_cancelled",
"trigger": "index_price",
"trigger_fill_condition": "incremental",
"trigger_price": 63000,
"usd": 1000
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | Inline |
| 400 | Bad Request | Bad Request | connection.Message |
Response Schema
Status Code 200
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | [models.OrderConfirmation] | false | none | none |
| » amount | number | false | none | Order size |
| » api | boolean | false | none | API |
| » average_price | number | false | none | Average price |
| » cancel_reason | string | false | none | Cancel reason |
| » creation_timestamp | integer | false | none | Creation timestamp |
| » direction | types.Side | false | none | Direction |
| » filled_amount | number | false | none | Filled amount |
| » instrument_name | string | false | none | Unique instrument identifier |
| » is_primary_otoco | boolean | false | none | Primary OTOCO |
| » is_secondary_oto | boolean | false | none | Secondary OTO |
| » label | string | false | none | User defined label |
| » last_update_timestamp | integer | false | none | Last update timestamp |
| » linked_order_type | types.LinkedOrderType | false | none | Linked order type |
| » max_show | number | false | none | Max show |
| » mmp | boolean | false | none | Market maker protection |
| » order_id | string | false | none | Unique order identifier |
| » order_state | types.OrderStatus | false | none | Order state |
| » order_type | types.Type | false | none | Order type |
| » oto_order_ids | [string] | false | none | OTO order IDs |
| » post_only | boolean | false | none | Post-only |
| » price | number | false | none | Price |
| » primary_order_id | string | false | none | Primary order ID |
| » reduce_only | boolean | false | none | Reduce-only |
| » replaced | boolean | false | none | Replaced |
| » status_otoco | types.StatusOtoco | false | none | Status of the OTCO order |
| » time_in_force | types.TimeInForce | false | none | Time in force |
| » trigger | types.Trigger | false | none | Trigger type |
| » trigger_fill_condition | types.TriggerFillCondition | false | none | Trigger fill condition |
| » trigger_price | number | false | none | Trigger price |
| » usd | number | false | none | Option price in USD |
Enumerated Values
| Property | Value |
|---|---|
| direction | buy |
| direction | sell |
| direction | edit |
| direction | edit_leverage |
| direction | cancel |
| direction | cancel_all |
| direction | cancel_all_by_instrument |
| direction | cancel_all_by_connection_id |
| linked_order_type | one_triggers_other |
| linked_order_type | one_triggers_one_cancels_other |
| order_state | open |
| order_state | partially_filled |
| order_state | filled |
| order_state | cancelled |
| order_state | untriggered |
| order_state | rejected |
| order_type | all |
| order_type | limit |
| order_type | stop_limit |
| order_type | take_limit |
| order_type | market |
| order_type | stop_market |
| order_type | take_market |
| order_type | trigger_all |
| status_otoco | active |
| status_otoco | draft |
| time_in_force | good_til_cancelled |
| time_in_force | good_til_day |
| time_in_force | fill_or_kill |
| time_in_force | immediate_or_cancel |
| trigger | index_price |
| trigger | last_price |
| trigger_fill_condition | first_hit |
| trigger_fill_condition | complete_fill |
| trigger_fill_condition | incremental |
/private/disable_cancel_on_disconnect
Code samples
# You can also use wget
curl -X POST /api/v2/private/disable_cancel_on_disconnect \
-H 'Authorization: string'
const headers = {
'Authorization':'string'
};
fetch('/api/v2/private/disable_cancel_on_disconnect',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Authorization' => 'string'
}
result = RestClient.post '/api/v2/private/disable_cancel_on_disconnect',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Authorization': 'string'
}
r = requests.post('/api/v2/private/disable_cancel_on_disconnect', headers = headers)
print(r.json())
POST /api/v2/private/disable_cancel_on_disconnect
This method disables cancel on disconnect for the current session.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| Authorization | header | string | true | Authorization |
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | None |
/private/edit
Code samples
# You can also use wget
curl -X POST /api/v2/private/edit \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: string'
const inputBody = '{
"id": 1,
"jsonrpc": "2.0",
"method": "Method Name",
"params": {
"amount": 10,
"order_id": "646f0ae259c5e9efdb83c564",
"price": 50000,
"trigger_price": 54000
}
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'string'
};
fetch('/api/v2/private/edit',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'string'
}
result = RestClient.post '/api/v2/private/edit',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'string'
}
r = requests.post('/api/v2/private/edit', headers = headers)
print(r.json())
POST /api/v2/private/edit
This method edits an order.
Body parameter
{
"id": 1,
"jsonrpc": "2.0",
"method": "Method Name",
"params": {
"amount": 10,
"order_id": "646f0ae259c5e9efdb83c564",
"price": 50000,
"trigger_price": 54000
}
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| Authorization | header | string | true | Authorization |
| body | body | models.Request-models_Edit | true | edit model |
| » id | body | integer | false | Request ID |
| » jsonrpc | body | string | false | jsonRPC version |
| » method | body | string | false | Method Name |
| » params | body | models.Edit | false | none |
| »» amount | body | number | true | Optional amount for limit order |
| »» order_id | body | string | true | The order id |
| »» price | body | number | false | Optional price for limit order |
| »» trigger_price | body | number | false | Optional trigger price for limit order |
Example responses
200 Response
{
"order": {
"amount": 10,
"api": true,
"average_price": 50000,
"cancel_reason": "user_request",
"creation_timestamp": 1612137600,
"direction": "buy",
"filled_amount": 10,
"instrument_name": "BTC-31JUN23-50000-C",
"is_primary_otoco": true,
"is_secondary_oto": true,
"label": "my_order",
"last_update_timestamp": 1612137600,
"linked_order_type": "one_triggers_one_cancels_other",
"max_show": 0,
"mmp": true,
"order_id": "60c72b2f9b1e8a001c8e4d5a",
"order_state": "open",
"order_type": "limit",
"oto_order_ids": [
"60c72b2f9b1e8a001c8e4d5b"
],
"post_only": true,
"price": 50000,
"primary_order_id": "60c72b2f9b1e8a001c8e4d5c",
"reduce_only": true,
"replaced": false,
"status_otoco": "active",
"time_in_force": "good_til_cancelled",
"trigger": "index_price",
"trigger_fill_condition": "incremental",
"trigger_price": 63000,
"usd": 1000
},
"trades": [
{
"advanced": "usd",
"amount": 10,
"api": true,
"direction": "buy",
"index_price": 50000,
"instrument_name": "BTC-31JUN23-50000-C",
"label": "my_trade",
"mark_price": 49500,
"order_id": "60c72b2f9b1e8a001c8e4d5a",
"order_type": "limit",
"price": 50000,
"state": "filled",
"tick_direction": 0,
"timestamp": 1612137600,
"trade_id": "66fa560b912a3148d07efacf",
"trade_seq": 1,
"underlying_index": "BTCUSD",
"underlying_price": 49000
}
]
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | models.BuySellResponse |
| 400 | Bad Request | Bad Request | connection.Message |
/private/enable_cancel_on_disconnect
Code samples
# You can also use wget
curl -X POST /api/v2/private/enable_cancel_on_disconnect \
-H 'Authorization: string'
const headers = {
'Authorization':'string'
};
fetch('/api/v2/private/enable_cancel_on_disconnect',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Authorization' => 'string'
}
result = RestClient.post '/api/v2/private/enable_cancel_on_disconnect',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Authorization': 'string'
}
r = requests.post('/api/v2/private/enable_cancel_on_disconnect', headers = headers)
print(r.json())
POST /api/v2/private/enable_cancel_on_disconnect
This method enables cancel on disconnect for the current session.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| Authorization | header | string | true | Authorization |
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | None |
/private/get_mmp_config
Code samples
# You can also use wget
curl -X POST /api/v2/private/get_mmp_config \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: string'
const inputBody = '{
"index_name": "btc_usd"
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'string'
};
fetch('/api/v2/private/get_mmp_config',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'string'
}
result = RestClient.post '/api/v2/private/get_mmp_config',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'string'
}
r = requests.post('/api/v2/private/get_mmp_config', headers = headers)
print(r.json())
POST /api/v2/private/get_mmp_config
Get config for MMP
Body parameter
{
"index_name": "btc_usd"
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| Authorization | header | string | true | Authorization |
| body | body | models.GetMMPConfig | true | GetMMPConfig model |
| » index_name | body | string | false | Index name |
Example responses
200 Response
{
"frozen_time": 10,
"index_name": "btc_usd",
"interval": 10,
"quantity_limit": 10
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | models.SetMMPConfig |
| 400 | Bad Request | Bad Request | connection.Message |
/private/get_open_orders_by_instrument
Code samples
# You can also use wget
curl -X POST /api/v2/private/get_open_orders_by_instrument \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: string'
const inputBody = '{
"count": 10,
"instrument_name": "BTC-31JUN23-50000-C",
"type": "all"
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'string'
};
fetch('/api/v2/private/get_open_orders_by_instrument',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'string'
}
result = RestClient.post '/api/v2/private/get_open_orders_by_instrument',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'string'
}
r = requests.post('/api/v2/private/get_open_orders_by_instrument', headers = headers)
print(r.json())
POST /api/v2/private/get_open_orders_by_instrument
This method returns the open orders of the user by instrument.
Body parameter
{
"count": 10,
"instrument_name": "BTC-31JUN23-50000-C",
"type": "all"
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| Authorization | header | string | true | Authorization |
| body | body | models.GetOpenOrdersByInstrument | true | GetOpenOrdersByInstrument model |
| » count | body | integer | false | Number of requested items |
| » instrument_name | body | string | true | Instrument name |
| » type | body | string | false | Order type |
Example responses
200 Response
[
{
"amount": 10,
"api": true,
"average_price": 50000,
"cancel_reason": "user_request",
"creation_timestamp": 1612137600,
"direction": "buy",
"filled_amount": 10,
"instrument_name": "BTC-31JUN23-50000-C",
"is_primary_otoco": true,
"is_secondary_oto": true,
"label": "my_order",
"last_update_timestamp": 1612137600,
"linked_order_type": "one_triggers_one_cancels_other",
"max_show": 0,
"mmp": true,
"order_id": "60c72b2f9b1e8a001c8e4d5a",
"order_state": "open",
"order_type": "limit",
"oto_order_ids": [
"60c72b2f9b1e8a001c8e4d5b"
],
"post_only": true,
"price": 50000,
"primary_order_id": "60c72b2f9b1e8a001c8e4d5c",
"reduce_only": true,
"replaced": false,
"status_otoco": "active",
"time_in_force": "good_til_cancelled",
"trigger": "index_price",
"trigger_fill_condition": "incremental",
"trigger_price": 63000,
"usd": 1000
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | Inline |
| 400 | Bad Request | Bad Request | connection.Message |
Response Schema
Status Code 200
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | [models.OrderConfirmation] | false | none | none |
| » amount | number | false | none | Order size |
| » api | boolean | false | none | API |
| » average_price | number | false | none | Average price |
| » cancel_reason | string | false | none | Cancel reason |
| » creation_timestamp | integer | false | none | Creation timestamp |
| » direction | types.Side | false | none | Direction |
| » filled_amount | number | false | none | Filled amount |
| » instrument_name | string | false | none | Unique instrument identifier |
| » is_primary_otoco | boolean | false | none | Primary OTOCO |
| » is_secondary_oto | boolean | false | none | Secondary OTO |
| » label | string | false | none | User defined label |
| » last_update_timestamp | integer | false | none | Last update timestamp |
| » linked_order_type | types.LinkedOrderType | false | none | Linked order type |
| » max_show | number | false | none | Max show |
| » mmp | boolean | false | none | Market maker protection |
| » order_id | string | false | none | Unique order identifier |
| » order_state | types.OrderStatus | false | none | Order state |
| » order_type | types.Type | false | none | Order type |
| » oto_order_ids | [string] | false | none | OTO order IDs |
| » post_only | boolean | false | none | Post-only |
| » price | number | false | none | Price |
| » primary_order_id | string | false | none | Primary order ID |
| » reduce_only | boolean | false | none | Reduce-only |
| » replaced | boolean | false | none | Replaced |
| » status_otoco | types.StatusOtoco | false | none | Status of the OTCO order |
| » time_in_force | types.TimeInForce | false | none | Time in force |
| » trigger | types.Trigger | false | none | Trigger type |
| » trigger_fill_condition | types.TriggerFillCondition | false | none | Trigger fill condition |
| » trigger_price | number | false | none | Trigger price |
| » usd | number | false | none | Option price in USD |
Enumerated Values
| Property | Value |
|---|---|
| direction | buy |
| direction | sell |
| direction | edit |
| direction | edit_leverage |
| direction | cancel |
| direction | cancel_all |
| direction | cancel_all_by_instrument |
| direction | cancel_all_by_connection_id |
| linked_order_type | one_triggers_other |
| linked_order_type | one_triggers_one_cancels_other |
| order_state | open |
| order_state | partially_filled |
| order_state | filled |
| order_state | cancelled |
| order_state | untriggered |
| order_state | rejected |
| order_type | all |
| order_type | limit |
| order_type | stop_limit |
| order_type | take_limit |
| order_type | market |
| order_type | stop_market |
| order_type | take_market |
| order_type | trigger_all |
| status_otoco | active |
| status_otoco | draft |
| time_in_force | good_til_cancelled |
| time_in_force | good_til_day |
| time_in_force | fill_or_kill |
| time_in_force | immediate_or_cancel |
| trigger | index_price |
| trigger | last_price |
| trigger_fill_condition | first_hit |
| trigger_fill_condition | complete_fill |
| trigger_fill_condition | incremental |
/private/get_order_book
Code samples
# You can also use wget
curl -X POST /api/v2/private/get_order_book \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: string'
const inputBody = '{
"depth": 1,
"instrument_name": "BTC-31JUN23-50000-C"
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'string'
};
fetch('/api/v2/private/get_order_book',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'string'
}
result = RestClient.post '/api/v2/private/get_order_book',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'string'
}
r = requests.post('/api/v2/private/get_order_book', headers = headers)
print(r.json())
POST /api/v2/private/get_order_book
Retrieves the order book, along with other market values for a given instrument
Body parameter
{
"depth": 1,
"instrument_name": "BTC-31JUN23-50000-C"
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| Authorization | header | string | true | Authorization |
| body | body | models.GetOrderBook | true | GetOrderBook model |
| » depth | body | integer | false | The number of entries to return for bids and asks |
| » instrument_name | body | string | true | Instrument name |
Example responses
200 Response
{
"ask_iv": 3955.75,
"asks": [
[
null
]
],
"best_ask_amount": 3955.75,
"best_ask_price": 3955.75,
"best_bid_amount": 3955.75,
"best_bid_price": 3955.75,
"bid_iv": 3955.75,
"bids": [
[
null
]
],
"greeks": {
"delta": 1.223,
"gamma": 5.323,
"rho": 5.443,
"theta": 2.344,
"vega": 4.223
},
"index_price": 3910.46,
"instrument_name": "BTC_USD-PERPETUAL",
"last_price": 3955.75,
"settlement_price": 3925.85,
"state": "open",
"stats": {
"high": 3976.25,
"low": 3940.75,
"price_change": 0.6913,
"volume": 3.35589552
},
"timestamp": 1550757626706,
"underlying_index": "index_price",
"underlying_price": 3910.46
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | models.GetOrderBookResponse |
| 400 | Bad Request | Bad Request | connection.Message |
/private/get_order_history_by_instrument
Code samples
# You can also use wget
curl -X POST /api/v2/private/get_order_history_by_instrument \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: string'
const inputBody = '{
"count": 20,
"include_old": true,
"include_unfilled": true,
"instrument_name": "BTC-31JUN23-50000-C",
"offset": 0
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'string'
};
fetch('/api/v2/private/get_order_history_by_instrument',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'string'
}
result = RestClient.post '/api/v2/private/get_order_history_by_instrument',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'string'
}
r = requests.post('/api/v2/private/get_order_history_by_instrument', headers = headers)
print(r.json())
POST /api/v2/private/get_order_history_by_instrument
Retrieves list of user's open orders within a given Instrument.
Body parameter
{
"count": 20,
"include_old": true,
"include_unfilled": true,
"instrument_name": "BTC-31JUN23-50000-C",
"offset": 0
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| Authorization | header | string | true | Authorization |
| body | body | models.GetOrderHistoryByInstrument | true | GetOrderHistoryByInstrument model |
| » count | body | integer | false | Number of requested items |
| » include_old | body | boolean | false | Include in result orders older than 2 days |
| » include_unfilled | body | boolean | false | Include in result fully unfilled closed orders |
| » instrument_name | body | string | true | Instrument name |
| » offset | body | integer | false | The offset for pagination |
Example responses
200 Response
[
{
"amount": 10,
"api": true,
"average_price": 50000,
"cancel_reason": "user_request",
"creation_timestamp": 1612137600,
"direction": "buy",
"filled_amount": 10,
"instrument_name": "BTC-31JUN23-50000-C",
"is_primary_otoco": true,
"is_secondary_oto": true,
"label": "my_order",
"last_update_timestamp": 1612137600,
"linked_order_type": "one_triggers_one_cancels_other",
"max_show": 0,
"mmp": true,
"order_id": "60c72b2f9b1e8a001c8e4d5a",
"order_state": "open",
"order_type": "limit",
"oto_order_ids": [
"60c72b2f9b1e8a001c8e4d5b"
],
"post_only": true,
"price": 50000,
"primary_order_id": "60c72b2f9b1e8a001c8e4d5c",
"reduce_only": true,
"replaced": false,
"status_otoco": "active",
"time_in_force": "good_til_cancelled",
"trigger": "index_price",
"trigger_fill_condition": "incremental",
"trigger_price": 63000,
"usd": 1000
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | Inline |
| 400 | Bad Request | Bad Request | connection.Message |
Response Schema
Status Code 200
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | [models.OrderConfirmation] | false | none | none |
| » amount | number | false | none | Order size |
| » api | boolean | false | none | API |
| » average_price | number | false | none | Average price |
| » cancel_reason | string | false | none | Cancel reason |
| » creation_timestamp | integer | false | none | Creation timestamp |
| » direction | types.Side | false | none | Direction |
| » filled_amount | number | false | none | Filled amount |
| » instrument_name | string | false | none | Unique instrument identifier |
| » is_primary_otoco | boolean | false | none | Primary OTOCO |
| » is_secondary_oto | boolean | false | none | Secondary OTO |
| » label | string | false | none | User defined label |
| » last_update_timestamp | integer | false | none | Last update timestamp |
| » linked_order_type | types.LinkedOrderType | false | none | Linked order type |
| » max_show | number | false | none | Max show |
| » mmp | boolean | false | none | Market maker protection |
| » order_id | string | false | none | Unique order identifier |
| » order_state | types.OrderStatus | false | none | Order state |
| » order_type | types.Type | false | none | Order type |
| » oto_order_ids | [string] | false | none | OTO order IDs |
| » post_only | boolean | false | none | Post-only |
| » price | number | false | none | Price |
| » primary_order_id | string | false | none | Primary order ID |
| » reduce_only | boolean | false | none | Reduce-only |
| » replaced | boolean | false | none | Replaced |
| » status_otoco | types.StatusOtoco | false | none | Status of the OTCO order |
| » time_in_force | types.TimeInForce | false | none | Time in force |
| » trigger | types.Trigger | false | none | Trigger type |
| » trigger_fill_condition | types.TriggerFillCondition | false | none | Trigger fill condition |
| » trigger_price | number | false | none | Trigger price |
| » usd | number | false | none | Option price in USD |
Enumerated Values
| Property | Value |
|---|---|
| direction | buy |
| direction | sell |
| direction | edit |
| direction | edit_leverage |
| direction | cancel |
| direction | cancel_all |
| direction | cancel_all_by_instrument |
| direction | cancel_all_by_connection_id |
| linked_order_type | one_triggers_other |
| linked_order_type | one_triggers_one_cancels_other |
| order_state | open |
| order_state | partially_filled |
| order_state | filled |
| order_state | cancelled |
| order_state | untriggered |
| order_state | rejected |
| order_type | all |
| order_type | limit |
| order_type | stop_limit |
| order_type | take_limit |
| order_type | market |
| order_type | stop_market |
| order_type | take_market |
| order_type | trigger_all |
| status_otoco | active |
| status_otoco | draft |
| time_in_force | good_til_cancelled |
| time_in_force | good_til_day |
| time_in_force | fill_or_kill |
| time_in_force | immediate_or_cancel |
| trigger | index_price |
| trigger | last_price |
| trigger_fill_condition | first_hit |
| trigger_fill_condition | complete_fill |
| trigger_fill_condition | incremental |
/private/get_order_state
Code samples
# You can also use wget
curl -X POST /api/v2/private/get_order_state \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: string'
const inputBody = '{
"order_id": "646f0ae259c5e9efdb83c564"
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'string'
};
fetch('/api/v2/private/get_order_state',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'string'
}
result = RestClient.post '/api/v2/private/get_order_state',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'string'
}
r = requests.post('/api/v2/private/get_order_state', headers = headers)
print(r.json())
POST /api/v2/private/get_order_state
Retrieves the state of a specific order.
Body parameter
{
"order_id": "646f0ae259c5e9efdb83c564"
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| Authorization | header | string | true | Authorization |
| body | body | models.GetOrderState | true | GetOrderState model |
| » order_id | body | string | true | The order id |
Example responses
200 Response
[
{
"amount": 10,
"api": true,
"average_price": 50000,
"cancel_reason": "user_request",
"creation_timestamp": 1612137600,
"direction": "buy",
"filled_amount": 10,
"instrument_name": "BTC-31JUN23-50000-C",
"is_primary_otoco": true,
"is_secondary_oto": true,
"label": "my_order",
"last_update_timestamp": 1612137600,
"linked_order_type": "one_triggers_one_cancels_other",
"max_show": 0,
"mmp": true,
"order_id": "60c72b2f9b1e8a001c8e4d5a",
"order_state": "open",
"order_type": "limit",
"oto_order_ids": [
"60c72b2f9b1e8a001c8e4d5b"
],
"post_only": true,
"price": 50000,
"primary_order_id": "60c72b2f9b1e8a001c8e4d5c",
"reduce_only": true,
"replaced": false,
"status_otoco": "active",
"time_in_force": "good_til_cancelled",
"trigger": "index_price",
"trigger_fill_condition": "incremental",
"trigger_price": 63000,
"usd": 1000
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | Inline |
| 400 | Bad Request | Bad Request | connection.Message |
Response Schema
Status Code 200
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | [models.OrderConfirmation] | false | none | none |
| » amount | number | false | none | Order size |
| » api | boolean | false | none | API |
| » average_price | number | false | none | Average price |
| » cancel_reason | string | false | none | Cancel reason |
| » creation_timestamp | integer | false | none | Creation timestamp |
| » direction | types.Side | false | none | Direction |
| » filled_amount | number | false | none | Filled amount |
| » instrument_name | string | false | none | Unique instrument identifier |
| » is_primary_otoco | boolean | false | none | Primary OTOCO |
| » is_secondary_oto | boolean | false | none | Secondary OTO |
| » label | string | false | none | User defined label |
| » last_update_timestamp | integer | false | none | Last update timestamp |
| » linked_order_type | types.LinkedOrderType | false | none | Linked order type |
| » max_show | number | false | none | Max show |
| » mmp | boolean | false | none | Market maker protection |
| » order_id | string | false | none | Unique order identifier |
| » order_state | types.OrderStatus | false | none | Order state |
| » order_type | types.Type | false | none | Order type |
| » oto_order_ids | [string] | false | none | OTO order IDs |
| » post_only | boolean | false | none | Post-only |
| » price | number | false | none | Price |
| » primary_order_id | string | false | none | Primary order ID |
| » reduce_only | boolean | false | none | Reduce-only |
| » replaced | boolean | false | none | Replaced |
| » status_otoco | types.StatusOtoco | false | none | Status of the OTCO order |
| » time_in_force | types.TimeInForce | false | none | Time in force |
| » trigger | types.Trigger | false | none | Trigger type |
| » trigger_fill_condition | types.TriggerFillCondition | false | none | Trigger fill condition |
| » trigger_price | number | false | none | Trigger price |
| » usd | number | false | none | Option price in USD |
Enumerated Values
| Property | Value |
|---|---|
| direction | buy |
| direction | sell |
| direction | edit |
| direction | edit_leverage |
| direction | cancel |
| direction | cancel_all |
| direction | cancel_all_by_instrument |
| direction | cancel_all_by_connection_id |
| linked_order_type | one_triggers_other |
| linked_order_type | one_triggers_one_cancels_other |
| order_state | open |
| order_state | partially_filled |
| order_state | filled |
| order_state | cancelled |
| order_state | untriggered |
| order_state | rejected |
| order_type | all |
| order_type | limit |
| order_type | stop_limit |
| order_type | take_limit |
| order_type | market |
| order_type | stop_market |
| order_type | take_market |
| order_type | trigger_all |
| status_otoco | active |
| status_otoco | draft |
| time_in_force | good_til_cancelled |
| time_in_force | good_til_day |
| time_in_force | fill_or_kill |
| time_in_force | immediate_or_cancel |
| trigger | index_price |
| trigger | last_price |
| trigger_fill_condition | first_hit |
| trigger_fill_condition | complete_fill |
| trigger_fill_condition | incremental |
/private/get_order_state_by_label
Code samples
# You can also use wget
curl -X POST /api/v2/private/get_order_state_by_label \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: string'
const inputBody = '{
"count": 10,
"currency": "USD",
"label": "user label",
"offset": 0
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'string'
};
fetch('/api/v2/private/get_order_state_by_label',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'string'
}
result = RestClient.post '/api/v2/private/get_order_state_by_label',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'string'
}
r = requests.post('/api/v2/private/get_order_state_by_label', headers = headers)
print(r.json())
POST /api/v2/private/get_order_state_by_label
Retrieves the state of a specific order by label.
Body parameter
{
"count": 10,
"currency": "USD",
"label": "user label",
"offset": 0
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| Authorization | header | string | true | Authorization |
| body | body | models.GetOrderStateByLabel | true | GetOrderStateByLabel model |
| » count | body | integer | false | Number of requested items |
| » currency | body | string | true | The currency symbol |
| » label | body | string | false | User defined label for the order |
| » offset | body | integer | false | The offset for pagination |
Example responses
200 Response
[
{
"amount": 10,
"api": true,
"average_price": 50000,
"cancel_reason": "user_request",
"creation_timestamp": 1612137600,
"direction": "buy",
"filled_amount": 10,
"instrument_name": "BTC-31JUN23-50000-C",
"is_primary_otoco": true,
"is_secondary_oto": true,
"label": "my_order",
"last_update_timestamp": 1612137600,
"linked_order_type": "one_triggers_one_cancels_other",
"max_show": 0,
"mmp": true,
"order_id": "60c72b2f9b1e8a001c8e4d5a",
"order_state": "open",
"order_type": "limit",
"oto_order_ids": [
"60c72b2f9b1e8a001c8e4d5b"
],
"post_only": true,
"price": 50000,
"primary_order_id": "60c72b2f9b1e8a001c8e4d5c",
"reduce_only": true,
"replaced": false,
"status_otoco": "active",
"time_in_force": "good_til_cancelled",
"trigger": "index_price",
"trigger_fill_condition": "incremental",
"trigger_price": 63000,
"usd": 1000
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | Inline |
| 400 | Bad Request | Bad Request | connection.Message |
Response Schema
Status Code 200
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | [models.OrderConfirmation] | false | none | none |
| » amount | number | false | none | Order size |
| » api | boolean | false | none | API |
| » average_price | number | false | none | Average price |
| » cancel_reason | string | false | none | Cancel reason |
| » creation_timestamp | integer | false | none | Creation timestamp |
| » direction | types.Side | false | none | Direction |
| » filled_amount | number | false | none | Filled amount |
| » instrument_name | string | false | none | Unique instrument identifier |
| » is_primary_otoco | boolean | false | none | Primary OTOCO |
| » is_secondary_oto | boolean | false | none | Secondary OTO |
| » label | string | false | none | User defined label |
| » last_update_timestamp | integer | false | none | Last update timestamp |
| » linked_order_type | types.LinkedOrderType | false | none | Linked order type |
| » max_show | number | false | none | Max show |
| » mmp | boolean | false | none | Market maker protection |
| » order_id | string | false | none | Unique order identifier |
| » order_state | types.OrderStatus | false | none | Order state |
| » order_type | types.Type | false | none | Order type |
| » oto_order_ids | [string] | false | none | OTO order IDs |
| » post_only | boolean | false | none | Post-only |
| » price | number | false | none | Price |
| » primary_order_id | string | false | none | Primary order ID |
| » reduce_only | boolean | false | none | Reduce-only |
| » replaced | boolean | false | none | Replaced |
| » status_otoco | types.StatusOtoco | false | none | Status of the OTCO order |
| » time_in_force | types.TimeInForce | false | none | Time in force |
| » trigger | types.Trigger | false | none | Trigger type |
| » trigger_fill_condition | types.TriggerFillCondition | false | none | Trigger fill condition |
| » trigger_price | number | false | none | Trigger price |
| » usd | number | false | none | Option price in USD |
Enumerated Values
| Property | Value |
|---|---|
| direction | buy |
| direction | sell |
| direction | edit |
| direction | edit_leverage |
| direction | cancel |
| direction | cancel_all |
| direction | cancel_all_by_instrument |
| direction | cancel_all_by_connection_id |
| linked_order_type | one_triggers_other |
| linked_order_type | one_triggers_one_cancels_other |
| order_state | open |
| order_state | partially_filled |
| order_state | filled |
| order_state | cancelled |
| order_state | untriggered |
| order_state | rejected |
| order_type | all |
| order_type | limit |
| order_type | stop_limit |
| order_type | take_limit |
| order_type | market |
| order_type | stop_market |
| order_type | take_market |
| order_type | trigger_all |
| status_otoco | active |
| status_otoco | draft |
| time_in_force | good_til_cancelled |
| time_in_force | good_til_day |
| time_in_force | fill_or_kill |
| time_in_force | immediate_or_cancel |
| trigger | index_price |
| trigger | last_price |
| trigger_fill_condition | first_hit |
| trigger_fill_condition | complete_fill |
| trigger_fill_condition | incremental |
/private/get_settlement_history_by_currency
Code samples
# You can also use wget
curl -X POST /api/v2/private/get_settlement_history_by_currency \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: string'
const inputBody = '{
"count": 20,
"currency": "BTC",
"search_start_timestamp": 1550475692526,
"type": "settlement"
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'string'
};
fetch('/api/v2/private/get_settlement_history_by_currency',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'string'
}
result = RestClient.post '/api/v2/private/get_settlement_history_by_currency',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'string'
}
r = requests.post('/api/v2/private/get_settlement_history_by_currency', headers = headers)
print(r.json())
POST /api/v2/private/get_settlement_history_by_currency
Retrieves list of user's settlement history within a given Currency.
Body parameter
{
"count": 20,
"currency": "BTC",
"search_start_timestamp": 1550475692526,
"type": "settlement"
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| Authorization | header | string | true | Authorization |
| body | body | models.GetSettlementHistoryByCurrency | true | GetSettlementHistoryByCurrency model |
| » count | body | integer | false | Number of requested items |
| » currency | body | string | false | The currency symbol |
| » search_start_timestamp | body | integer | false | none |
| » type | body | string | true | Settlement type contains "settlement" |
Example responses
200 Response
[
{
"index_price": "50000.0",
"instrument_name": "BTC-31JUN23-50000-C",
"position": "long",
"profit_loss": "1000.0",
"timestamp": 1612137600,
"type": "settlement"
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | Inline |
| 400 | Bad Request | Bad Request | connection.Message |
Response Schema
Status Code 200
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | [models.SettlementConfirmation] | false | none | none |
| » index_price | string | false | none | Index price |
| » instrument_name | string | false | none | Instrument name |
| » position | string | false | none | Position |
| » profit_loss | string | false | none | Profit and loss |
| » timestamp | integer | false | none | Timestamp |
| » type | string | false | none | Settlement type |
/private/get_settlement_history_by_instrument
Code samples
# You can also use wget
curl -X POST /api/v2/private/get_settlement_history_by_instrument \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: string'
const inputBody = '{
"count": 20,
"instrument_name": "BTC-31JUN23-50000-C",
"search_start_timestamp": 1550475692526,
"type": "settlement"
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'string'
};
fetch('/api/v2/private/get_settlement_history_by_instrument',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'string'
}
result = RestClient.post '/api/v2/private/get_settlement_history_by_instrument',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'string'
}
r = requests.post('/api/v2/private/get_settlement_history_by_instrument', headers = headers)
print(r.json())
POST /api/v2/private/get_settlement_history_by_instrument
Retrieves list of user's settlement history within a given Instrument.
Body parameter
{
"count": 20,
"instrument_name": "BTC-31JUN23-50000-C",
"search_start_timestamp": 1550475692526,
"type": "settlement"
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| Authorization | header | string | true | Authorization |
| body | body | models.GetSettlementHistoryByInstrument | true | GetSettlementHistoryByInstrument model |
| » count | body | integer | false | Number of requested items |
| » instrument_name | body | string | false | Instrument name |
| » search_start_timestamp | body | integer | false | The earliest timestamp to return result from |
| » type | body | string | true | Settlement type |
Example responses
200 Response
[
{
"index_price": "50000.0",
"instrument_name": "BTC-31JUN23-50000-C",
"position": "long",
"profit_loss": "1000.0",
"timestamp": 1612137600,
"type": "settlement"
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | Inline |
| 400 | Bad Request | Bad Request | connection.Message |
Response Schema
Status Code 200
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | [models.SettlementConfirmation] | false | none | none |
| » index_price | string | false | none | Index price |
| » instrument_name | string | false | none | Instrument name |
| » position | string | false | none | Position |
| » profit_loss | string | false | none | Profit and loss |
| » timestamp | integer | false | none | Timestamp |
| » type | string | false | none | Settlement type |
/private/get_user_trades_by_instrument
Code samples
# You can also use wget
curl -X POST /api/v2/private/get_user_trades_by_instrument \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: string'
const inputBody = '{
"count": 20,
"end_timestamp": 1590480712800,
"instrument_name": "BTC-31JUN23-50000-C",
"sorting": "asc",
"start_timestamp": 1590480712800
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'string'
};
fetch('/api/v2/private/get_user_trades_by_instrument',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'string'
}
result = RestClient.post '/api/v2/private/get_user_trades_by_instrument',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'string'
}
r = requests.post('/api/v2/private/get_user_trades_by_instrument', headers = headers)
print(r.json())
POST /api/v2/private/get_user_trades_by_instrument
Retrieve the latest user trades that have occurred for a specific instrument.
Body parameter
{
"count": 20,
"end_timestamp": 1590480712800,
"instrument_name": "BTC-31JUN23-50000-C",
"sorting": "asc",
"start_timestamp": 1590480712800
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| Authorization | header | string | true | Authorization |
| body | body | models.GetUserTradesByInstrument | true | GetUserTradesByInstrument model |
| » count | body | integer | false | Number of requested items |
| » end_timestamp | body | integer | false | The most recent timestamp to return result from |
| » instrument_name | body | string | true | Instrument name |
| » sorting | body | string | false | Direction of results sorting |
| » start_timestamp | body | integer | false | The earliest timestamp to return result from |
Example responses
200 Response
[
{
"amount": 10,
"api": true,
"direction": "buy",
"index_price": 50000,
"instrument_name": "BTC-31JUN23-50000-C",
"mark_iv": 0.5,
"mark_price": 49500,
"price": 50000,
"tick_direction": 0,
"timestamp": 1612137600,
"trade_id": "66fa560b912a3148d07efacf",
"trade_seq": 1
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | Inline |
| 400 | Bad Request | Bad Request | connection.Message |
Response Schema
Status Code 200
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | [models.TradesResponse] | false | none | none |
| » amount | number | false | none | Trade amount |
| » api | boolean | false | none | API |
| » direction | string | false | none | Direction |
| » index_price | number | false | none | Index price |
| » instrument_name | string | false | none | Unique instrument identifier |
| » mark_iv | number | false | none | Mark IV |
| » mark_price | number | false | none | Mark price |
| » price | number | false | none | Price |
| » tick_direction | integer | false | none | Tick direction |
| » timestamp | integer | false | none | Trade timestamp |
| » trade_id | string | false | none | Trade ID |
| » trade_seq | integer | false | none | Trade sequence |
/private/get_user_trades_by_order
Code samples
# You can also use wget
curl -X POST /api/v2/private/get_user_trades_by_order \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: string'
const inputBody = '{
"count": 0,
"order_id": "646f0ae259c5e9efdb83c564",
"sorting": "asc"
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'string'
};
fetch('/api/v2/private/get_user_trades_by_order',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'string'
}
result = RestClient.post '/api/v2/private/get_user_trades_by_order',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'string'
}
r = requests.post('/api/v2/private/get_user_trades_by_order', headers = headers)
print(r.json())
POST /api/v2/private/get_user_trades_by_order
Retrieve the list of user trades that was created for given order
Body parameter
{
"count": 0,
"order_id": "646f0ae259c5e9efdb83c564",
"sorting": "asc"
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| Authorization | header | string | true | Authorization |
| body | body | models.GetUserTradesByOrder | true | GetUserTradesByOrder model |
| » count | body | integer | false | none |
| » order_id | body | string | true | The order id |
| » sorting | body | string | false | Direction of results sorting (default value means no sorting, results will be returned in order in which they left the database) |
Example responses
200 Response
[
{
"amount": 10,
"api": true,
"direction": "buy",
"index_price": 50000,
"instrument_name": "BTC-31JUN23-50000-C",
"mark_iv": 0.5,
"mark_price": 49500,
"price": 50000,
"tick_direction": 0,
"timestamp": 1612137600,
"trade_id": "66fa560b912a3148d07efacf",
"trade_seq": 1
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | Inline |
| 400 | Bad Request | Bad Request | connection.Message |
Response Schema
Status Code 200
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | [models.TradesResponse] | false | none | none |
| » amount | number | false | none | Trade amount |
| » api | boolean | false | none | API |
| » direction | string | false | none | Direction |
| » index_price | number | false | none | Index price |
| » instrument_name | string | false | none | Unique instrument identifier |
| » mark_iv | number | false | none | Mark IV |
| » mark_price | number | false | none | Mark price |
| » price | number | false | none | Price |
| » tick_direction | integer | false | none | Tick direction |
| » timestamp | integer | false | none | Trade timestamp |
| » trade_id | string | false | none | Trade ID |
| » trade_seq | integer | false | none | Trade sequence |
/private/sell
Code samples
# You can also use wget
curl -X POST /api/v2/private/sell \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: string'
const inputBody = '{
"id": 1,
"jsonrpc": "2.0",
"method": "Method Name",
"params": {
"amount": 10,
"instrument_name": "BTC-31JUN23-50000-C",
"label": "label_example",
"linked_order_type": "one_triggers_one_cancels_other",
"max_show": 40,
"mmp": true,
"otoco_config": [
{
"amount": 10,
"direction": "buy",
"price": 62000,
"time_in_force": "good_til_cancelled",
"trigger": "index_price",
"trigger_price": 63000,
"type": "limit"
}
],
"post_only": false,
"price": 60000,
"reduce_only": false,
"time_in_force": "good_til_cancelled",
"trigger": "index_price",
"trigger_fill_condition": "incremental",
"trigger_price": 65000,
"type": "limit"
}
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'string'
};
fetch('/api/v2/private/sell',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'string'
}
result = RestClient.post '/api/v2/private/sell',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'string'
}
r = requests.post('/api/v2/private/sell', headers = headers)
print(r.json())
POST /api/v2/private/sell
Places a sell order for an instrument.
Body parameter
{
"id": 1,
"jsonrpc": "2.0",
"method": "Method Name",
"params": {
"amount": 10,
"instrument_name": "BTC-31JUN23-50000-C",
"label": "label_example",
"linked_order_type": "one_triggers_one_cancels_other",
"max_show": 40,
"mmp": true,
"otoco_config": [
{
"amount": 10,
"direction": "buy",
"price": 62000,
"time_in_force": "good_til_cancelled",
"trigger": "index_price",
"trigger_price": 63000,
"type": "limit"
}
],
"post_only": false,
"price": 60000,
"reduce_only": false,
"time_in_force": "good_til_cancelled",
"trigger": "index_price",
"trigger_fill_condition": "incremental",
"trigger_price": 65000,
"type": "limit"
}
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| Authorization | header | string | true | Authorization |
| body | body | models.Request-models_BuySell | true | BuySell model |
| » id | body | integer | false | Request ID |
| » jsonrpc | body | string | false | jsonRPC version |
| » method | body | string | false | Method Name |
| » params | body | models.BuySell | false | none |
| »» amount | body | number | true | It represents the requested order size. For perpetual and inverse futures, the amount is in USD units. For linear futures, it is the underlying base currency coin. For options, it is the amount of corresponding cryptocurrency contracts, e.g., BTC or ETH. |
| »» instrument_name | body | string | false | Instrument name |
| »» label | body | string | false | user defined label for the order |
| »» linked_order_type | body | types.LinkedOrderType | false | The type of the linked order. |
| »» max_show | body | number | false | Maximum amount within an order to be shown to other customers, 0 for invisible order |
| »» mmp | body | boolean | false | none |
| »» otoco_config | body | [models.OtocoConfig] | false | List of trades to create or cancel when this order is filled. |
| »»» amount | body | number | false | It represents the requested order size. For perpetual and inverse futures, the amount is in USD units. For linear futures, it is the underlying base currency coin. For options, it is the amount of corresponding cryptocurrency contracts, e.g., BTC or ETH. |
| »»» direction | body | types.Side | false | Direction: buy, or sell |
| »»» price | body | number | false | The order price in the base currency (Only for limit and stop_limit orders). When adding an order with advanced=usd, the field price should be the option price value in USD. When adding an 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%. |
| »»» time_in_force | body | types.TimeInForce | false | Specifies how long the order remains in effect. Default "good_til_cancelled". - "good_til_cancelled" unfilled order remains in order book until cancelled. - "good_til_day" unfilled order remains in order book till the end of the trading session. - "fill_or_kill" execute a transaction immediately and completely or not at all. - "immediate_or_cancel" execute a transaction immediately, and any portion of the order that cannot be immediately filled is cancelled |
| »»» trigger | body | types.Trigger | false | Defines the trigger type. Required for "Stop-Loss", "Take-Profit" and "Trailing" trigger orders |
| »»» trigger_price | body | number | false | Trigger price, required for trigger orders only (Stop-loss or Take-profit orders) |
| »»» type | body | types.Type | false | the order type include limit, market, stop_limit, stop_market, take_limit, take_market |
| »» post_only | body | boolean | false | 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 spread. Only valid in combination with time_in_force="good_til_cancelled" |
| »» price | body | number | false | The order price in the base currency (Only for limit and stop_limit orders). When adding an order with advanced=usd, the field price should be the option price value in USD. When adding an 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%. |
| »» reduce_only | body | boolean | false | If true, the order is considered reduce-only which is intended to only reduce a current position |
| »» time_in_force | body | types.TimeInForce | false | Specifies how long the order remains in effect. Default "good_til_cancelled". - "good_til_cancelled" unfilled order remains in order book until cancelled. - "good_til_day" unfilled order remains in order book till the end of the trading session. - "fill_or_kill" execute a transaction immediately and completely or not at all. - "immediate_or_cancel" execute a transaction immediately, and any portion of the order that cannot be immediately filled is cancelled |
| »» trigger | body | string | false | Defines the trigger type. Required for "Stop-Loss", "Take-Profit" and "Trailing" trigger orders |
| »» trigger_fill_condition | body | types.TriggerFillCondition | false | The fill condition of the linked order (Only for linked order types), default: first_hit. |
| »» trigger_price | body | number | false | Trigger price, required for trigger orders only (Stop-loss or Take-profit orders) |
| »» type | body | types.Type | false | The order type |
Enumerated Values
| Parameter | Value |
|---|---|
| »» linked_order_type | one_triggers_other |
| »» linked_order_type | one_triggers_one_cancels_other |
| »»» direction | buy |
| »»» direction | sell |
| »»» direction | edit |
| »»» direction | edit_leverage |
| »»» direction | cancel |
| »»» direction | cancel_all |
| »»» direction | cancel_all_by_instrument |
| »»» direction | cancel_all_by_connection_id |
| »»» time_in_force | good_til_cancelled |
| »»» time_in_force | good_til_day |
| »»» time_in_force | fill_or_kill |
| »»» time_in_force | immediate_or_cancel |
| »»» trigger | index_price |
| »»» trigger | last_price |
| »»» type | all |
| »»» type | limit |
| »»» type | stop_limit |
| »»» type | take_limit |
| »»» type | market |
| »»» type | stop_market |
| »»» type | take_market |
| »»» type | trigger_all |
| »» time_in_force | good_til_cancelled |
| »» time_in_force | good_til_day |
| »» time_in_force | fill_or_kill |
| »» time_in_force | immediate_or_cancel |
| »» trigger_fill_condition | first_hit |
| »» trigger_fill_condition | complete_fill |
| »» trigger_fill_condition | incremental |
| »» type | all |
| »» type | limit |
| »» type | stop_limit |
| »» type | take_limit |
| »» type | market |
| »» type | stop_market |
| »» type | take_market |
| »» type | trigger_all |
Example responses
200 Response
{
"order": {
"amount": 10,
"api": true,
"average_price": 50000,
"cancel_reason": "user_request",
"creation_timestamp": 1612137600,
"direction": "buy",
"filled_amount": 10,
"instrument_name": "BTC-31JUN23-50000-C",
"is_primary_otoco": true,
"is_secondary_oto": true,
"label": "my_order",
"last_update_timestamp": 1612137600,
"linked_order_type": "one_triggers_one_cancels_other",
"max_show": 0,
"mmp": true,
"order_id": "60c72b2f9b1e8a001c8e4d5a",
"order_state": "open",
"order_type": "limit",
"oto_order_ids": [
"60c72b2f9b1e8a001c8e4d5b"
],
"post_only": true,
"price": 50000,
"primary_order_id": "60c72b2f9b1e8a001c8e4d5c",
"reduce_only": true,
"replaced": false,
"status_otoco": "active",
"time_in_force": "good_til_cancelled",
"trigger": "index_price",
"trigger_fill_condition": "incremental",
"trigger_price": 63000,
"usd": 1000
},
"trades": [
{
"advanced": "usd",
"amount": 10,
"api": true,
"direction": "buy",
"index_price": 50000,
"instrument_name": "BTC-31JUN23-50000-C",
"label": "my_trade",
"mark_price": 49500,
"order_id": "60c72b2f9b1e8a001c8e4d5a",
"order_type": "limit",
"price": 50000,
"state": "filled",
"tick_direction": 0,
"timestamp": 1612137600,
"trade_id": "66fa560b912a3148d07efacf",
"trade_seq": 1,
"underlying_index": "BTCUSD",
"underlying_price": 49000
}
]
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | models.BuySellResponse |
| 400 | Bad Request | Bad Request | connection.Message |
/private/set_mmp_config
Code samples
# You can also use wget
curl -X POST /api/v2/private/set_mmp_config \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: string'
const inputBody = '{
"frozen_time": 10,
"index_name": "btc_usd",
"interval": 10,
"quantity_limit": 10
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'string'
};
fetch('/api/v2/private/set_mmp_config',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'string'
}
result = RestClient.post '/api/v2/private/set_mmp_config',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'string'
}
r = requests.post('/api/v2/private/set_mmp_config', headers = headers)
print(r.json())
POST /api/v2/private/set_mmp_config
Set config for MMP - triggers MMP reset
Body parameter
{
"frozen_time": 10,
"index_name": "btc_usd",
"interval": 10,
"quantity_limit": 10
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| Authorization | header | string | true | Authorization |
| body | body | models.SetMMPConfig | true | SetMMPConfig model |
| » frozen_time | body | number | false | The frozen time in seconds |
| » index_name | body | string | false | Index name |
| » interval | body | number | false | The interval in seconds |
| » quantity_limit | body | number | false | The quantity limit |
Example responses
200 Response
{
"frozen_time": 10,
"index_name": "btc_usd",
"interval": 10,
"quantity_limit": 10
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | models.SetMMPConfig |
| 400 | Bad Request | Bad Request | connection.Message |
/private/get_cancel_on_disconnect
Code samples
# You can also use wget
curl -X POST /ws/api/v2/private/get_cancel_on_disconnect \
-H 'Accept: application/json' \
-H 'Authorization: string'
const headers = {
'Accept':'application/json',
'Authorization':'string'
};
fetch('/ws/api/v2/private/get_cancel_on_disconnect',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'string'
}
result = RestClient.post '/ws/api/v2/private/get_cancel_on_disconnect',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'string'
}
r = requests.post('/ws/api/v2/private/get_cancel_on_disconnect', headers = headers)
print(r.json())
POST /ws/api/v2/private/get_cancel_on_disconnect
This method returns the current state of cancel on disconnect for the current session.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| Authorization | header | string | true | Authorization |
Example responses
200 Response
true
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | true/false | boolean |
| 400 | Bad Request | Bad Request | connection.Message |
Wallet
/private/get_account_summary
Code samples
# You can also use wget
curl -X POST /api/v2/private/get_account_summary \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: string'
const inputBody = '{
"id": 1,
"jsonrpc": "2.0",
"method": "Method Name",
"params": {
"currency": "USD"
}
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'string'
};
fetch('/api/v2/private/get_account_summary',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'string'
}
result = RestClient.post '/api/v2/private/get_account_summary',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'string'
}
r = requests.post('/api/v2/private/get_account_summary', headers = headers)
print(r.json())
POST /api/v2/private/get_account_summary
This method returns the account summary of the user.
Body parameter
{
"id": 1,
"jsonrpc": "2.0",
"method": "Method Name",
"params": {
"currency": "USD"
}
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| Authorization | header | string | true | Authorization |
| body | body | models.Request-models_GetAccountSummary | true | GetAccountSummary model |
| » id | body | integer | false | Request ID |
| » jsonrpc | body | string | false | jsonRPC version |
| » method | body | string | false | Method Name |
| » params | body | models.GetAccountSummary | false | none |
| »» currency | body | string | false | The currency symbol |
Example responses
200 Response
{
"balance": 302.60065765,
"creation_timestamp": 1687352432143,
"currency": "USD",
"email": "john@doe.com",
"equity": 302.61869214,
"futures_session_rpl": 0.05921555,
"futures_session_upl": 0.05921555,
"id": "66fa44883ea1ba9966db6dd3",
"initial_margin": 1.24669592,
"maintenance_margin": 0.8857841,
"margin_balance": 302.62729214,
"options_session_rpl": 0.05921555,
"options_session_upl": 0.05921555,
"session_rpl": -0.03258105,
"session_upl": -0.03258123,
"total_pl": 0.1273612345
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | models.GetAccountSummaryResponse |
| 400 | Bad Request | Bad Request | connection.Message |
/private/get_deposits
Code samples
# You can also use wget
curl -X POST /api/v2/private/get_deposits \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: string'
const inputBody = '{
"id": 1,
"jsonrpc": "2.0",
"method": "Method Name",
"params": {
"count": 20,
"currency": "USD",
"offset": 0
}
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'string'
};
fetch('/api/v2/private/get_deposits',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'string'
}
result = RestClient.post '/api/v2/private/get_deposits',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'string'
}
r = requests.post('/api/v2/private/get_deposits', headers = headers)
print(r.json())
POST /api/v2/private/get_deposits
This method returns the deposits of the user.
Body parameter
{
"id": 1,
"jsonrpc": "2.0",
"method": "Method Name",
"params": {
"count": 20,
"currency": "USD",
"offset": 0
}
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| Authorization | header | string | true | Authorization |
| body | body | models.Request-models_GetDeposits | true | GetDeposits model |
| » id | body | integer | false | Request ID |
| » jsonrpc | body | string | false | jsonRPC version |
| » method | body | string | false | Method Name |
| » params | body | models.GetDeposits | false | none |
| »» count | body | integer | false | Number of requested items |
| »» currency | body | string | false | The currency symbol |
| »» offset | body | integer | false | The offset for pagination |
Example responses
200 Response
[
{
"amount": 100,
"currency": "USD",
"received_timestamp": 1550757626706,
"state": "completed",
"transaction_id": "66fa47c9d5b0f038e844bf85"
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | Inline |
| 400 | Bad Request | Bad Request | connection.Message |
Response Schema
Status Code 200
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | [models.DepositWithdrawalConfirmation] | false | none | none |
| » amount | number | false | none | Amount |
| » currency | string | false | none | Currency |
| » received_timestamp | integer | false | none | Received timestamp |
| » state | string | false | none | State of the transaction |
| » transaction_id | string | false | none | Transaction ID |
/private/get_positions
Code samples
# You can also use wget
curl -X POST /api/v2/private/get_positions \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: string'
const inputBody = '{
"currency": "USD",
"kind": "option"
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'string'
};
fetch('/api/v2/private/get_positions',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'string'
}
result = RestClient.post '/api/v2/private/get_positions',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'string'
}
r = requests.post('/api/v2/private/get_positions', headers = headers)
print(r.json())
POST /api/v2/private/get_positions
Retrieves list of user's positions.
Body parameter
{
"currency": "USD",
"kind": "option"
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| Authorization | header | string | true | Authorization |
| body | body | models.GetPositions | true | GetPositions model |
| » currency | body | string | false | The currency symbol |
| » kind | body | string | false | Instrument kind, if not provided instruments of all kinds are considered |
Example responses
200 Response
[
{
"average_price": 50000,
"delta": 0.5,
"direction": "buy",
"estimated_liquidation_price": 45000,
"floating_profit_loss": 1000,
"index_price": 49000,
"initial_margin": 5000,
"instrument_name": "BTC-25JUN21-40000-C",
"interest_value": 50,
"kind": "future",
"leverage": 10,
"maintenance_margin": 3000,
"mark_price": 49500,
"open_orders_margin": 2000,
"realized_profit_loss": 500,
"settlement_price": 48000,
"size": 1,
"size_currency": 1,
"size_out": 0.5,
"total_profit_loss": 1500
}
]
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | Inline |
| 400 | Bad Request | Bad Request | connection.Message |
Response Schema
Status Code 200
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | [models.PositionConfirmation] | false | none | none |
| » average_price | number | false | none | Average price of trades that built this position |
| » delta | number | false | none | Delta parameter |
| » direction | string | false | none | Direction: buy, sell |
| » estimated_liquidation_price | number | false | none | Estimated liquidation price, added only for futures, for non portfolio margining users |
| » floating_profit_loss | number | false | none | Floating profit or loss |
| » index_price | number | false | none | Current index price |
| » initial_margin | number | false | none | Initial margin |
| » instrument_name | string | false | none | Unique instrument identifier |
| » interest_value | number | false | none | Value used to calculate realized_funding (perpetual only) |
| » kind | string | false | none | Instrument kind: "future", "option" |
| » leverage | integer | false | none | Current available leverage for future position |
| » maintenance_margin | number | false | none | Maintenance margin |
| » mark_price | number | false | none | Current mark price for position's instrument |
| » open_orders_margin | number | false | none | Open orders margin |
| » realized_profit_loss | number | false | none | Realized profit or loss |
| » settlement_price | number | false | none | Optional (not added for spot). Last settlement price for position's instrument 0 if instrument wasn't settled yet |
| » size | number | false | none | Position size for futures size in quote currency |
| » size_currency | integer | false | none | Only for futures, position size in base currency |
| » size_out | number | false | none | Size out |
| » total_profit_loss | number | false | none | Profit or loss from position |
Subscription management
/private/subscribe
Code samples
# You can also use wget
curl -X POST /ws/api/v2/private/subscribe?channels=string \
-H 'Accept: application/json'
const headers = {
'Accept':'application/json'
};
fetch('/ws/api/v2/private/subscribe?channels=string',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.post '/ws/api/v2/private/subscribe',
params: {
'channels' => 'array[string]'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.post('/ws/api/v2/private/subscribe', params={
'channels': [
"string"
]
}, headers = headers)
print(r.json())
POST /ws/api/v2/private/subscribe
Subscribe to one or more channels, and it can only be used for 'private' channels.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| channels | query | array[string] | true | A list of channels to subscribe to |
Example responses
200 Response
"string"
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | ok | string |
/private/unsubscribe_all
Code samples
# You can also use wget
curl -X POST /ws/api/v2/private/unsubscribe_all \
-H 'Accept: application/json'
const headers = {
'Accept':'application/json'
};
fetch('/ws/api/v2/private/unsubscribe_all',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.post '/ws/api/v2/private/unsubscribe_all',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.post('/ws/api/v2/private/unsubscribe_all', headers = headers)
print(r.json())
POST /ws/api/v2/private/unsubscribe_all
Unsubscribe from all the channels subscribed so far.
Example responses
200 Response
{
"description": "ok",
"response": null,
"status": 200
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | Message | connection.Message |
/public/subscribe
Code samples
# You can also use wget
curl -X POST /ws/api/v2/public/subscribe?channels=string \
-H 'Accept: application/json'
const headers = {
'Accept':'application/json'
};
fetch('/ws/api/v2/public/subscribe?channels=string',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.post '/ws/api/v2/public/subscribe',
params: {
'channels' => 'array[string]'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.post('/ws/api/v2/public/subscribe', params={
'channels': [
"string"
]
}, headers = headers)
print(r.json())
POST /ws/api/v2/public/subscribe
Subscribe to one or more channels, and it can only be used for 'public' channels.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| channels | query | array[string] | true | A list of channels to subscribe to |
Example responses
200 Response
"string"
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | ok | string |
/public/unsubscribe_all
Code samples
# You can also use wget
curl -X POST /ws/api/v2/public/unsubscribe_all \
-H 'Accept: application/json'
const headers = {
'Accept':'application/json'
};
fetch('/ws/api/v2/public/unsubscribe_all',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.post '/ws/api/v2/public/unsubscribe_all',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.post('/ws/api/v2/public/unsubscribe_all', headers = headers)
print(r.json())
POST /ws/api/v2/public/unsubscribe_all
Unsubscribe from all the channels subscribed so far.
Example responses
200 Response
{
"description": "ok",
"response": null,
"status": 200
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | Message | connection.Message |
Subscription
book.{instrument_name}.{interval}
Code samples
# You can also use wget
curl -X POST /book.{instrument_name}.{interval}?instrument_name=string&interval=string \
-H 'Accept: application/json'
const headers = {
'Accept':'application/json'
};
fetch('/book.{instrument_name}.{interval}?instrument_name=string&interval=string',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.post '/book.{instrument_name}.{interval}',
params: {
'instrument_name' => 'string',
'interval' => 'string'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.post('/book.{instrument_name}.{interval}', params={
'instrument_name': 'string', 'interval': 'string'
}, headers = headers)
print(r.json())
POST /book.{instrument_name}.{interval}
Get notifications about the instrument's order book.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| instrument_name | query | string | true | instrument name |
| interval | query | string | true | value is raw |
Example responses
200 Response
{
"asks": [
[
null
]
],
"bids": [
[
null
]
],
"change_id": 1,
"instrument_name": "BTC_USD-PERPETUAL",
"prev_change_id": 0,
"timestamp": 1687352432143,
"type": "snapshot"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | models.BookNotification |
deribit_price_index.{index_name}
Code samples
# You can also use wget
curl -X POST /deribit_price_index.{index_name}?index_name=string \
-H 'Accept: application/json'
const headers = {
'Accept':'application/json'
};
fetch('/deribit_price_index.{index_name}?index_name=string',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.post '/deribit_price_index.{index_name}',
params: {
'index_name' => 'string'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.post('/deribit_price_index.{index_name}', params={
'index_name': 'string'
}, headers = headers)
print(r.json())
POST /deribit_price_index.{index_name}
Provides information about current value (price) for Deribit Index.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| index_name | query | string | true | Btc_usd or eth_usd |
Example responses
200 Response
{
"index_name": "BTC_USD-PERPETUAL",
"price": 50000,
"timestamp": 1612137600
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | models.PriceNotification |
funding_payments.{instrument_name}
Code samples
# You can also use wget
curl -X POST /funding_payments.{instrument_name}?instrument_name=string \
-H 'Accept: application/json'
const headers = {
'Accept':'application/json'
};
fetch('/funding_payments.{instrument_name}?instrument_name=string',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.post '/funding_payments.{instrument_name}',
params: {
'instrument_name' => 'string'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.post('/funding_payments.{instrument_name}', params={
'instrument_name': 'string'
}, headers = headers)
print(r.json())
POST /funding_payments.{instrument_name}
Get notifications about the instrument's funding payments.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| instrument_name | query | string | true | instrument name |
Example responses
200 Response
{
"amount": "50.0",
"instrument_name": "BTC_USD-PERPETUAL",
"volume": "1000.0"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | models.FundingPaymentNotification |
funding_prices.{instrument_name}
Code samples
# You can also use wget
curl -X POST /funding_prices.{instrument_name}?instrument_name=string \
-H 'Accept: application/json'
const headers = {
'Accept':'application/json'
};
fetch('/funding_prices.{instrument_name}?instrument_name=string',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.post '/funding_prices.{instrument_name}',
params: {
'instrument_name' => 'string'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.post('/funding_prices.{instrument_name}', params={
'instrument_name': 'string'
}, headers = headers)
print(r.json())
POST /funding_prices.{instrument_name}
Provides information about the funding price for the instrument.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| instrument_name | query | string | true | instrument name |
Example responses
200 Response
{
"instrument_name": "BTC_USD-PERPETUAL",
"metadata": {
"type": "twap",
"version": "1.0"
},
"perpetual_price": {
"close": "50000.0",
"high": "50000.0",
"low": "50000.0",
"open": "50000.0"
},
"range_end": "2023-06-30T15:04:05Z",
"range_start": "2023-06-30T14:04:05Z",
"spot_price": {
"close": "50000.0",
"high": "50000.0",
"low": "50000.0",
"open": "50000.0"
},
"timestamp": 1612137600
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | models.FundingPriceNotification |
funding_rates.{instrument_name}
Code samples
# You can also use wget
curl -X POST /funding_rates.{instrument_name}?instrument_name=string \
-H 'Accept: application/json'
const headers = {
'Accept':'application/json'
};
fetch('/funding_rates.{instrument_name}?instrument_name=string',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.post '/funding_rates.{instrument_name}',
params: {
'instrument_name' => 'string'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.post('/funding_rates.{instrument_name}', params={
'instrument_name': 'string'
}, headers = headers)
print(r.json())
POST /funding_rates.{instrument_name}
Get notifications about the instrument's funding rates.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| instrument_name | query | string | true | instrument name |
Example responses
200 Response
{
"instrument_name": "BTC_USD-PERPETUAL",
"range_end": 1612141200,
"range_start": 1612137600,
"rate": "0.01"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | models.FundingRateNotification |
heartbeat_trade
Code samples
# You can also use wget
curl -X POST /heartbeat_trade \
-H 'Accept: application/json'
const headers = {
'Accept':'application/json'
};
fetch('/heartbeat_trade',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.post '/heartbeat_trade',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.post('/heartbeat_trade', headers = headers)
print(r.json())
POST /heartbeat_trade
This notification contains information about trade status, such as "active" or "inactive".
Example responses
200 Response
{
"status_trade": "active"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | user.HeartbeatTrade |
quote.{instrument_name}
Code samples
# You can also use wget
curl -X POST /quote.{instrument_name}?instrument_name=string \
-H 'Accept: application/json'
const headers = {
'Accept':'application/json'
};
fetch('/quote.{instrument_name}?instrument_name=string',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.post '/quote.{instrument_name}',
params: {
'instrument_name' => 'string'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.post('/quote.{instrument_name}', params={
'instrument_name': 'string'
}, headers = headers)
print(r.json())
POST /quote.{instrument_name}
Get notifications about the instrument's quote.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| instrument_name | query | string | true | instrument name |
Example responses
200 Response
{
"best_ask_amount": 1.5,
"best_ask_price": 50000,
"best_bid_amount": 1,
"best_bid_price": 49900,
"instrument_name": "BTC_USD-PERPETUAL",
"timestamp": 1612137600
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | models.QuoteNotification |
settlement_prices.{index_name}
Code samples
# You can also use wget
curl -X POST /settlement_prices.{index_name}?index_name=string \
-H 'Accept: application/json'
const headers = {
'Accept':'application/json'
};
fetch('/settlement_prices.{index_name}?index_name=string',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.post '/settlement_prices.{index_name}',
params: {
'index_name' => 'string'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.post('/settlement_prices.{index_name}', params={
'index_name': 'string'
}, headers = headers)
print(r.json())
POST /settlement_prices.{index_name}
Provides information about the settlement price for the index.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| index_name | query | string | true | Btc_usd or eth_usd |
Example responses
200 Response
{
"index_name": "BTC_USD-PERPETUAL",
"price": 50000,
"timestamp": 1612137600
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | models.PriceNotification |
user.changes.{instrument_name}.{interval}
Code samples
# You can also use wget
curl -X POST /user.changes.{instrument_name}.{interval}?instrument_name=string&interval=string \
-H 'Accept: application/json'
const headers = {
'Accept':'application/json'
};
fetch('/user.changes.{instrument_name}.{interval}?instrument_name=string&interval=string',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.post '/user.changes.{instrument_name}.{interval}',
params: {
'instrument_name' => 'string',
'interval' => 'string'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.post('/user.changes.{instrument_name}.{interval}', params={
'instrument_name': 'string', 'interval': 'string'
}, headers = headers)
print(r.json())
POST /user.changes.{instrument_name}.{interval}
Get notifications about the user's updates related to order, trades in an instrument
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| instrument_name | query | string | true | instrument name |
| interval | query | string | true | value is raw |
Example responses
200 Response
{
"orders": [
{
"amount": 10,
"api": true,
"average_price": 50000,
"cancel_reason": "user_request",
"creation_timestamp": 1612137600,
"direction": "buy",
"filled_amount": 10,
"instrument_name": "BTC-31JUN23-50000-C",
"is_primary_otoco": true,
"is_secondary_oto": true,
"label": "my_order",
"last_update_timestamp": 1612137600,
"linked_order_type": "one_triggers_one_cancels_other",
"max_show": 0,
"mmp": true,
"order_id": "60c72b2f9b1e8a001c8e4d5a",
"order_state": "open",
"order_type": "limit",
"oto_order_ids": [
"60c72b2f9b1e8a001c8e4d5b"
],
"post_only": true,
"price": 50000,
"primary_order_id": "60c72b2f9b1e8a001c8e4d5c",
"reduce_only": true,
"replaced": false,
"status_otoco": "active",
"time_in_force": "good_til_cancelled",
"trigger": "index_price",
"trigger_fill_condition": "incremental",
"trigger_price": 63000,
"usd": 1000
}
],
"trades": [
{
"amount": 10,
"api": true,
"direction": "buy",
"index_price": 50000,
"instrument_name": "BTC-31JUN23-50000-C",
"mark_iv": 0.5,
"mark_price": 49500,
"price": 50000,
"tick_direction": 0,
"timestamp": 1612137600,
"trade_id": "66fa560b912a3148d07efacf",
"trade_seq": 1
}
]
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | models.UserChangesNotification |
user.mmp_trigger.{index_name}
Code samples
# You can also use wget
curl -X POST /user.mmp_trigger.{index_name}?index_name=string \
-H 'Accept: application/json'
const headers = {
'Accept':'application/json'
};
fetch('/user.mmp_trigger.{index_name}?index_name=string',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.post '/user.mmp_trigger.{index_name}',
params: {
'index_name' => 'string'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.post('/user.mmp_trigger.{index_name}', params={
'index_name': 'string'
}, headers = headers)
print(r.json())
POST /user.mmp_trigger.{index_name}
Triggered when one of mmp limits is crossed.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| index_name | query | string | true | Btc_usd or eth_usd |
Example responses
200 Response
{
"frozen_until": 1640995200,
"index_name": "btc_usd"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | models.MMPNotification |
user.orders.{instrument_name}.raw
Code samples
# You can also use wget
curl -X POST /user.orders.{instrument_name}.{interval}?instrument_name=string&interval=string \
-H 'Accept: application/json'
const headers = {
'Accept':'application/json'
};
fetch('/user.orders.{instrument_name}.{interval}?instrument_name=string&interval=string',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.post '/user.orders.{instrument_name}.{interval}',
params: {
'instrument_name' => 'string',
'interval' => 'string'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.post('/user.orders.{instrument_name}.{interval}', params={
'instrument_name': 'string', 'interval': 'string'
}, headers = headers)
print(r.json())
POST /user.orders.{instrument_name}.{interval}
Get notifications about the user's orders in an instrument.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| instrument_name | query | string | true | instrument name |
| interval | query | string | true | value is raw |
Example responses
200 Response
{
"amount": 10,
"api": true,
"average_price": 50000,
"cancel_reason": "user_request",
"creation_timestamp": 1612137600,
"direction": "buy",
"filled_amount": 10,
"instrument_name": "BTC-31JUN23-50000-C",
"is_primary_otoco": true,
"is_secondary_oto": true,
"label": "my_order",
"last_update_timestamp": 1612137600,
"linked_order_type": "one_triggers_one_cancels_other",
"max_show": 0,
"mmp": true,
"order_id": "60c72b2f9b1e8a001c8e4d5a",
"order_state": "open",
"order_type": "limit",
"oto_order_ids": [
"60c72b2f9b1e8a001c8e4d5b"
],
"post_only": true,
"price": 50000,
"primary_order_id": "60c72b2f9b1e8a001c8e4d5c",
"reduce_only": true,
"replaced": false,
"status_otoco": "active",
"time_in_force": "good_til_cancelled",
"trigger": "index_price",
"trigger_fill_condition": "incremental",
"trigger_price": 63000,
"usd": 1000
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | models.OrderConfirmation |
user.trades.{instrument_name}.raw
Code samples
# You can also use wget
curl -X POST /user.trades.{instrument_name}.{interval}?instrument_name=string&interval=string \
-H 'Accept: application/json'
const headers = {
'Accept':'application/json'
};
fetch('/user.trades.{instrument_name}.{interval}?instrument_name=string&interval=string',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.post '/user.trades.{instrument_name}.{interval}',
params: {
'instrument_name' => 'string',
'interval' => 'string'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.post('/user.trades.{instrument_name}.{interval}', params={
'instrument_name': 'string', 'interval': 'string'
}, headers = headers)
print(r.json())
POST /user.trades.{instrument_name}.{interval}
Get notifications about the user's trades in an instrument
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| instrument_name | query | string | true | instrument name |
| interval | query | string | true | value is raw |
Example responses
200 Response
{
"amount": 10,
"api": true,
"direction": "buy",
"index_price": 50000,
"instrument_name": "BTC-31JUN23-50000-C",
"mark_iv": 0.5,
"mark_price": 49500,
"price": 50000,
"tick_direction": 0,
"timestamp": 1612137600,
"trade_id": "66fa560b912a3148d07efacf",
"trade_seq": 1
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | models.TradesResponse |
user_fee
Code samples
# You can also use wget
curl -X POST /user_fee \
-H 'Accept: application/json'
const headers = {
'Accept':'application/json'
};
fetch('/user_fee',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.post '/user_fee',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.post('/user_fee', headers = headers)
print(r.json())
POST /user_fee
Get notifications about the user's fee.
Example responses
200 Response
{
"future": {
"percentage": 0,
"volume": 0
},
"option": {
"percentage": 0,
"volume": 0
},
"perpetual": {
"percentage": 0,
"volume": 0
},
"user_id": "66fa6630cc40f0ef42ecbb47"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | user.PublishFee |
Schemas
connection.Message
{
"description": "ok",
"response": null,
"status": 200
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| description | string | false | none | none |
| response | any | false | none | none |
| status | return_codes.CommonCodes | false | none | none |
funding.Metadata
{
"type": "twap",
"version": "1.0"
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| type | types.MetadataFundingType | false | none | Type of metadata |
| version | string | false | none | Version of metadata |
funding.Prices
{
"close": "50000.0",
"high": "50000.0",
"low": "50000.0",
"open": "50000.0"
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| close | string | false | none | Close price |
| high | string | false | none | High price |
| low | string | false | none | Low price |
| open | string | false | none | Open price |
models.BookNotification
{
"asks": [
[
null
]
],
"bids": [
[
null
]
],
"change_id": 1,
"instrument_name": "BTC_USD-PERPETUAL",
"prev_change_id": 0,
"timestamp": 1687352432143,
"type": "snapshot"
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| asks | [array] | false | none | none |
| bids | [array] | false | none | none |
| change_id | integer | false | none | The change id |
| instrument_name | string | false | none | The instrument name |
| prev_change_id | integer | false | none | The previous change id |
| timestamp | integer | false | none | The timestamp |
| type | string | false | none | The type contains "snapshot" or "change" |
models.BuySell
{
"amount": 10,
"instrument_name": "BTC-31JUN23-50000-C",
"label": "label_example",
"linked_order_type": "one_triggers_one_cancels_other",
"max_show": 40,
"mmp": true,
"otoco_config": [
{
"amount": 10,
"direction": "buy",
"price": 62000,
"time_in_force": "good_til_cancelled",
"trigger": "index_price",
"trigger_price": 63000,
"type": "limit"
}
],
"post_only": false,
"price": 60000,
"reduce_only": false,
"time_in_force": "good_til_cancelled",
"trigger": "index_price",
"trigger_fill_condition": "incremental",
"trigger_price": 65000,
"type": "limit"
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| amount | number | true | none | It represents the requested order size. For perpetual and inverse futures, the amount is in USD units. For linear futures, it is the underlying base currency coin. For options, it is the amount of corresponding cryptocurrency contracts, e.g., BTC or ETH. |
| instrument_name | string | false | none | Instrument name |
| label | string | false | none | user defined label for the order |
| linked_order_type | types.LinkedOrderType | false | none | The type of the linked order. |
| max_show | number | false | none | Maximum amount within an order to be shown to other customers, 0 for invisible order |
| mmp | boolean | false | none | none |
| otoco_config | [models.OtocoConfig] | false | none | List of trades to create or cancel when this order is filled. |
| post_only | boolean | false | none | 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 spread. Only valid in combination with time_in_force="good_til_cancelled" |
| price | number | false | none | The order price in the base currency (Only for limit and stop_limit orders). When adding an order with advanced=usd, the field price should be the option price value in USD. When adding an 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%. |
| reduce_only | boolean | false | none | If true, the order is considered reduce-only which is intended to only reduce a current position |
| time_in_force | types.TimeInForce | false | none | Specifies how long the order remains in effect. Default "good_til_cancelled". - "good_til_cancelled" unfilled order remains in order book until cancelled. - "good_til_day" unfilled order remains in order book till the end of the trading session. - "fill_or_kill" execute a transaction immediately and completely or not at all. - "immediate_or_cancel" execute a transaction immediately, and any portion of the order that cannot be immediately filled is cancelled |
| trigger | string | false | none | Defines the trigger type. Required for "Stop-Loss", "Take-Profit" and "Trailing" trigger orders |
| trigger_fill_condition | types.TriggerFillCondition | false | none | The fill condition of the linked order (Only for linked order types), default: first_hit. |
| trigger_price | number | false | none | Trigger price, required for trigger orders only (Stop-loss or Take-profit orders) |
| type | types.Type | false | none | The order type |
models.BuySellResponse
{
"order": {
"amount": 10,
"api": true,
"average_price": 50000,
"cancel_reason": "user_request",
"creation_timestamp": 1612137600,
"direction": "buy",
"filled_amount": 10,
"instrument_name": "BTC-31JUN23-50000-C",
"is_primary_otoco": true,
"is_secondary_oto": true,
"label": "my_order",
"last_update_timestamp": 1612137600,
"linked_order_type": "one_triggers_one_cancels_other",
"max_show": 0,
"mmp": true,
"order_id": "60c72b2f9b1e8a001c8e4d5a",
"order_state": "open",
"order_type": "limit",
"oto_order_ids": [
"60c72b2f9b1e8a001c8e4d5b"
],
"post_only": true,
"price": 50000,
"primary_order_id": "60c72b2f9b1e8a001c8e4d5c",
"reduce_only": true,
"replaced": false,
"status_otoco": "active",
"time_in_force": "good_til_cancelled",
"trigger": "index_price",
"trigger_fill_condition": "incremental",
"trigger_price": 63000,
"usd": 1000
},
"trades": [
{
"advanced": "usd",
"amount": 10,
"api": true,
"direction": "buy",
"index_price": 50000,
"instrument_name": "BTC-31JUN23-50000-C",
"label": "my_trade",
"mark_price": 49500,
"order_id": "60c72b2f9b1e8a001c8e4d5a",
"order_type": "limit",
"price": 50000,
"state": "filled",
"tick_direction": 0,
"timestamp": 1612137600,
"trade_id": "66fa560b912a3148d07efacf",
"trade_seq": 1,
"underlying_index": "BTCUSD",
"underlying_price": 49000
}
]
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| order | models.OrderConfirmation | false | none | order response |
| trades | [models.TradeConfirmation] | false | none | array of object |
models.Cancel
{
"order_id": "646f0ae259c5e9efdb83c564"
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| order_id | string | true | none | The order id |
models.CancelAll
{
"detailed": true
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| detailed | boolean | false | none | When detailed is set to true output format is changed. See description. Default: false |
models.CancelAllByInstrument
{
"detailed": true,
"instrument_name": "BTC-31JUN23-50000-C",
"type": "limit"
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| detailed | boolean | false | none | none |
| instrument_name | string | true | none | Instrument name |
| type | types.Type | false | none | Order type |
models.DepositWithdrawalConfirmation
{
"amount": 100,
"currency": "USD",
"received_timestamp": 1550757626706,
"state": "completed",
"transaction_id": "66fa47c9d5b0f038e844bf85"
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| amount | number | false | none | Amount |
| currency | string | false | none | Currency |
| received_timestamp | integer | false | none | Received timestamp |
| state | string | false | none | State of the transaction |
| transaction_id | string | false | none | Transaction ID |
models.Edit
{
"amount": 10,
"order_id": "646f0ae259c5e9efdb83c564",
"price": 50000,
"trigger_price": 54000
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| amount | number | true | none | Optional amount for limit order |
| order_id | string | true | none | The order id |
| price | number | false | none | Optional price for limit order |
| trigger_price | number | false | none | Optional trigger price for limit order |
models.FundingPaymentArray
{
"payment": 0,
"range_end": 0,
"range_start": 0,
"timestamp": 0
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| payment | number | false | none | none |
| range_end | integer | false | none | none |
| range_start | integer | false | none | none |
| timestamp | integer | false | none | none |
models.FundingPaymentNotification
{
"amount": "50.0",
"instrument_name": "BTC_USD-PERPETUAL",
"volume": "1000.0"
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| amount | string | false | none | Amount |
| instrument_name | string | false | none | Instrument name |
| volume | string | false | none | Volume |
models.FundingPriceArray
{
"perp_close": 50500,
"perp_high": 51000,
"perp_low": 49000,
"perp_open": 50000,
"spot_close": 50500,
"spot_high": 51000,
"spot_low": 49000,
"spot_open": 50000,
"timestamp": 1612137600
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| perp_close | number | false | none | Perpetual contract close price |
| perp_high | number | false | none | Perpetual contract high price |
| perp_low | number | false | none | Perpetual contract low price |
| perp_open | number | false | none | Perpetual contract open price |
| spot_close | number | false | none | Spot market close price |
| spot_high | number | false | none | Spot market high price |
| spot_low | number | false | none | Spot market low price |
| spot_open | number | false | none | Spot market open price |
| timestamp | integer | false | none | Timestamp of the price data |
models.FundingPriceNotification
{
"instrument_name": "BTC_USD-PERPETUAL",
"metadata": {
"type": "twap",
"version": "1.0"
},
"perpetual_price": {
"close": "50000.0",
"high": "50000.0",
"low": "50000.0",
"open": "50000.0"
},
"range_end": "2023-06-30T15:04:05Z",
"range_start": "2023-06-30T14:04:05Z",
"spot_price": {
"close": "50000.0",
"high": "50000.0",
"low": "50000.0",
"open": "50000.0"
},
"timestamp": 1612137600
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| instrument_name | string | false | none | Instrument name |
| metadata | funding.Metadata | false | none | Metadata |
| perpetual_price | funding.Prices | false | none | Perpetual price |
| range_end | string | false | none | Range end |
| range_start | string | false | none | Range start |
| spot_price | funding.Prices | false | none | Spot price |
| timestamp | integer | false | none | Timestamp |
models.FundingRateNotification
{
"instrument_name": "BTC_USD-PERPETUAL",
"range_end": 1612141200,
"range_start": 1612137600,
"rate": "0.01"
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| instrument_name | string | false | none | Instrument name |
| range_end | integer | false | none | Range end |
| range_start | integer | false | none | Range start |
| rate | string | false | none | Rate |
models.GetAccountSummary
{
"currency": "USD"
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| currency | string | false | none | The currency symbol |
models.GetAccountSummaryResponse
{
"balance": 302.60065765,
"creation_timestamp": 1687352432143,
"currency": "USD",
"email": "john@doe.com",
"equity": 302.61869214,
"futures_session_rpl": 0.05921555,
"futures_session_upl": 0.05921555,
"id": "66fa44883ea1ba9966db6dd3",
"initial_margin": 1.24669592,
"maintenance_margin": 0.8857841,
"margin_balance": 302.62729214,
"options_session_rpl": 0.05921555,
"options_session_upl": 0.05921555,
"session_rpl": -0.03258105,
"session_upl": -0.03258123,
"total_pl": 0.1273612345
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| balance | number | false | none | The account's balance |
| creation_timestamp | integer | false | none | Time at which the account was created |
| currency | string | false | none | The selected currency |
| string | false | none | User email | |
| equity | number | false | none | The account's current equity. |
| futures_session_rpl | number | false | none | Futures session realized profit and Loss. |
| futures_session_upl | number | false | none | Futures session unrealized profit and Loss. |
| id | string | false | none | Account id |
| initial_margin | number | false | none | The account's initial margin. |
| maintenance_margin | number | false | none | The maintenance margin. |
| margin_balance | number | false | none | The account's margin balance |
| options_session_rpl | number | false | none | Options session realized profit and Loss. |
| options_session_upl | number | false | none | Options session unrealized profit and Loss. |
| session_rpl | number | false | none | Session realized profit and loss. |
| session_upl | number | false | none | Options session unrealized profit and Loss. |
| total_pl | number | false | none | Profit and loss. |
models.GetDeliveryPrices
{
"count": 10,
"index_name": "btc_usd",
"offset": 0
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| count | integer | false | none | Number of requested items, default - 10 |
| index_name | string | true | none | Index identifier, matches (base) cryptocurrency with quote currency |
| offset | integer | false | none | The offset for pagination, default - 0 |
models.GetDeliveryPricesResponse
{
"date": "2020-01-02",
"delivery_price": 7131.214606410254
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| date | string | false | none | The event date with year, month and day |
| delivery_price | number | false | none | The settlement price for the instrument. |
models.GetDeposits
{
"count": 20,
"currency": "USD",
"offset": 0
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| count | integer | false | none | Number of requested items |
| currency | string | false | none | The currency symbol |
| offset | integer | false | none | The offset for pagination |
models.GetFundingChartDataRequest
{
"instrument_name": "BTC_USD-PERPETUAL",
"length": "8h"
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| instrument_name | string | true | none | Instrument name |
| length | string | true | none | Specifies time period. 8h - 8 hours, 24h - 24 hours, 1m - 1 month |
models.GetFundingChartDataResponse
{
"current_payment": 1e-8,
"funding_payments": [
{
"payment": 0,
"range_end": 0,
"range_start": 0,
"timestamp": 0
}
],
"funding_prices": [
{
"perp_close": 50500,
"perp_high": 51000,
"perp_low": 49000,
"perp_open": 50000,
"spot_close": 50500,
"spot_high": 51000,
"spot_low": 49000,
"spot_open": 50000,
"timestamp": 1612137600
}
]
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| current_payment | number | false | none | Current funding payment |
| funding_payments | [models.FundingPaymentArray] | false | none | none |
| funding_prices | [models.FundingPriceArray] | false | none | none |
models.GetFundingRateHistoryRequest
{
"end_timestamp": 1612137600,
"instrument_name": "BTC_USD-PERPETUAL",
"start_timestamp": 1609459200
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| end_timestamp | integer | false | none | End timestamp |
| instrument_name | string | false | none | Instrument name |
| start_timestamp | integer | false | none | Start timestamp |
models.GetFundingRateHistoryResponse
{
"current_payment": 6122.334,
"funding_payments": [
{
"payment": 0,
"range_end": 0,
"range_start": 0,
"timestamp": 0
}
],
"funding_prices": [
{
"perp_close": 50500,
"perp_high": 51000,
"perp_low": 49000,
"perp_open": 50000,
"spot_close": 50500,
"spot_high": 51000,
"spot_low": 49000,
"spot_open": 50000,
"timestamp": 1612137600
}
]
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| current_payment | number | false | none | Current payment |
| funding_payments | [models.FundingPaymentArray] | false | none | Funding payments |
| funding_prices | [models.FundingPriceArray] | false | none | Funding prices |
models.GetIndexPrice
{
"index_name": "btc_usd"
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| index_name | string | true | none | Index identifier |
models.GetInstrumentResponse
{
"base_currency": "USD",
"contract_size": 1,
"expiration_timestamp": 1673596800000,
"instrument_name": "BTC-31JUN23-50000-C",
"is_active": true,
"kind": "option",
"option_type": "put",
"price_index": "btc_usd",
"quote_currency": "BTC",
"settlement_currency": "USD",
"strike": 50000
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| base_currency | string | false | none | The underlying currency being traded |
| contract_size | integer | false | none | Contract size for instrument |
| expiration_timestamp | integer | false | none | The time when the instrument will expire |
| instrument_name | string | false | none | Unique instrument identifier |
| is_active | boolean | false | none | Indicates if the instrument can currently be traded |
| kind | string | false | none | Instrument kind |
| option_type | string | false | none | Option only |
| price_index | string | false | none | Name of price index that is used for this instrument |
| quote_currency | string | false | none | The currency in which the instrument prices are quoted |
| settlement_currency | string | false | none | Settlement currency for the instrument. |
| strike | number | false | none | The strike value |
models.GetInstruments
{
"currency": "BTC",
"expired": true,
"kind": "option"
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| currency | string | true | none | The currency symbol |
| expired | boolean | false | none | Set to true to show recently expired instruments instead of active ones |
| kind | string | false | none | Instrument kind, if not provided instruments of all kinds are considered |
models.GetLastTradesByInstrument
{
"count": 10,
"end_seq": 1966042,
"end_timestamp": 1590480724473,
"instrument_name": "BTC-31JUN23-50000-C",
"sorting": "asc",
"start_seq": 1966042,
"start_timestamp": 1590480724473
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| count | integer | false | none | Number of requested items |
| end_seq | integer | false | none | The sequence number of the last trade to be returned |
| end_timestamp | integer | false | none | The most recent timestamp to return result from, milliseconds since the UNIX epoch |
| instrument_name | string | false | none | Unique instrument identifier |
| sorting | string | false | none | Direction of results sorting (asc,desc,default) |
| start_seq | integer | false | none | The sequence number of the first trade to be returned |
| start_timestamp | integer | false | none | The earliest timestamp to return result from, milliseconds since the UNIX epoch |
models.GetMMPConfig
{
"index_name": "btc_usd"
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| index_name | string | false | none | Index name |
models.GetOpenOrdersByInstrument
{
"count": 10,
"instrument_name": "BTC-31JUN23-50000-C",
"type": "all"
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| count | integer | false | none | Number of requested items |
| instrument_name | string | true | none | Instrument name |
| type | string | false | none | Order type |
models.GetOrderBook
{
"depth": 1,
"instrument_name": "BTC-31JUN23-50000-C"
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| depth | integer | false | none | The number of entries to return for bids and asks |
| instrument_name | string | true | none | Instrument name |
models.GetOrderBookResponse
{
"ask_iv": 3955.75,
"asks": [
[
null
]
],
"best_ask_amount": 3955.75,
"best_ask_price": 3955.75,
"best_bid_amount": 3955.75,
"best_bid_price": 3955.75,
"bid_iv": 3955.75,
"bids": [
[
null
]
],
"greeks": {
"delta": 1.223,
"gamma": 5.323,
"rho": 5.443,
"theta": 2.344,
"vega": 4.223
},
"index_price": 3910.46,
"instrument_name": "BTC_USD-PERPETUAL",
"last_price": 3955.75,
"settlement_price": 3925.85,
"state": "open",
"stats": {
"high": 3976.25,
"low": 3940.75,
"price_change": 0.6913,
"volume": 3.35589552
},
"timestamp": 1550757626706,
"underlying_index": "index_price",
"underlying_price": 3910.46
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| ask_iv | number | false | none | implied volatility for best ask |
| asks | [array] | false | none | List of asks |
| best_ask_amount | number | false | none | It represents the requested order size of all best asks |
| best_ask_price | number | false | none | The current best ask price, null if there aren't any asks |
| best_bid_amount | number | false | none | It represents the requested order size of all best bids |
| best_bid_price | number | false | none | The current best bid price, null if there aren't any bids |
| bid_iv | number | false | none | implied volatility for best bid |
| bids | [array] | false | none | List of bids |
| greeks | models.OrderBookGreek | false | none | Only for options |
| index_price | number | false | none | Current index price |
| instrument_name | string | false | none | Unique instrument identifier |
| last_price | number | false | none | The price for the last trade |
| settlement_price | number | false | none | The settlement price for the instrument |
| state | string | false | none | The state of the order book. |
| stats | models.OrderBookStats | false | none | stats object |
| timestamp | integer | false | none | The timestamp |
| underlying_index | string | false | none | Name of the underlying future, or index_price |
| underlying_price | number | false | none | Underlying price for implied volatility calculations |
models.GetOrderHistoryByInstrument
{
"count": 20,
"include_old": true,
"include_unfilled": true,
"instrument_name": "BTC-31JUN23-50000-C",
"offset": 0
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| count | integer | false | none | Number of requested items |
| include_old | boolean | false | none | Include in result orders older than 2 days |
| include_unfilled | boolean | false | none | Include in result fully unfilled closed orders |
| instrument_name | string | true | none | Instrument name |
| offset | integer | false | none | The offset for pagination |
models.GetOrderState
{
"order_id": "646f0ae259c5e9efdb83c564"
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| order_id | string | true | none | The order id |
models.GetOrderStateByLabel
{
"count": 10,
"currency": "USD",
"label": "user label",
"offset": 0
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| count | integer | false | none | Number of requested items |
| currency | string | true | none | The currency symbol |
| label | string | false | none | User defined label for the order |
| offset | integer | false | none | The offset for pagination |
models.GetPositions
{
"currency": "USD",
"kind": "option"
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| currency | string | false | none | The currency symbol |
| kind | string | false | none | Instrument kind, if not provided instruments of all kinds are considered |
models.GetSettlementHistoryByCurrency
{
"count": 20,
"currency": "BTC",
"search_start_timestamp": 1550475692526,
"type": "settlement"
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| count | integer | false | none | Number of requested items |
| currency | string | false | none | The currency symbol |
| search_start_timestamp | integer | false | none | none |
| type | string | true | none | Settlement type contains "settlement" |
models.GetSettlementHistoryByInstrument
{
"count": 20,
"instrument_name": "BTC-31JUN23-50000-C",
"search_start_timestamp": 1550475692526,
"type": "settlement"
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| count | integer | false | none | Number of requested items |
| instrument_name | string | false | none | Instrument name |
| search_start_timestamp | integer | false | none | The earliest timestamp to return result from |
| type | string | true | none | Settlement type |
models.GetTradingviewChartDataRequest
{
"end_timestamp": 1550757626706,
"instrument_name": "BTC-31JUN23-50000-C",
"resolution": "1",
"start_timestamp": 1550757626706
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| end_timestamp | integer | true | none | The most recent timestamp to return result from |
| instrument_name | string | true | none | Instrument name |
| resolution | string | true | none | Chart bars resolution given in full minutes or keyword 1D |
| start_timestamp | integer | true | none | The earliest timestamp to return result from |
models.GetTradingviewChartDataResponse
{
"close": [
19.007942601,
20.095877981
],
"cost": [
19.007942601,
20.095877981
],
"high": [
19.007942601,
20.095877981
],
"low": [
19.007942601,
20.095877981
],
"open": [
19.007942601,
20.095877981
],
"status": "ok",
"ticks": [
1554373800000,
1554375600000
],
"volume": [
19.007942601,
20.095877981
]
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| close | [number] | false | none | List of prices at close |
| cost | [number] | false | none | List of cost bars |
| high | [number] | false | none | List of highest price levels |
| low | [number] | false | none | List of lowest price levels |
| open | [number] | false | none | List of prices at open |
| status | string | false | none | Status of the query ok or no_data |
| ticks | [integer] | false | none | Values of the time axis given in milliseconds since UNIX epoch |
| volume | [number] | false | none | List of volume bars |
models.GetUserTradesByInstrument
{
"count": 20,
"end_timestamp": 1590480712800,
"instrument_name": "BTC-31JUN23-50000-C",
"sorting": "asc",
"start_timestamp": 1590480712800
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| count | integer | false | none | Number of requested items |
| end_timestamp | integer | false | none | The most recent timestamp to return result from |
| instrument_name | string | true | none | Instrument name |
| sorting | string | false | none | Direction of results sorting |
| start_timestamp | integer | false | none | The earliest timestamp to return result from |
models.GetUserTradesByOrder
{
"count": 0,
"order_id": "646f0ae259c5e9efdb83c564",
"sorting": "asc"
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| count | integer | false | none | none |
| order_id | string | true | none | The order id |
| sorting | string | false | none | Direction of results sorting (default value means no sorting, results will be returned in order in which they left the database) |
models.MMPNotification
{
"frozen_until": 1640995200,
"index_name": "btc_usd"
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| frozen_until | integer | false | none | Frozen until |
| index_name | string | false | none | Index name |
models.OrderBookGreek
{
"delta": 1.223,
"gamma": 5.323,
"rho": 5.443,
"theta": 2.344,
"vega": 4.223
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| delta | number | false | none | The delta value for the option |
| gamma | number | false | none | The gamma value for the option |
| rho | number | false | none | The rho value for the option |
| theta | number | false | none | The theta value for the option |
| vega | number | false | none | The vega value for the option |
models.OrderBookStats
{
"high": 3976.25,
"low": 3940.75,
"price_change": 0.6913,
"volume": 3.35589552
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| high | number | false | none | Highest price during 24h |
| low | number | false | none | Lowest price during 24h |
| price_change | number | false | none | 24-hour price change expressed as a percentage, null if there weren't any trades |
| volume | number | false | none | Volume during last 24h in base currency |
models.OrderConfirmation
{
"amount": 10,
"api": true,
"average_price": 50000,
"cancel_reason": "user_request",
"creation_timestamp": 1612137600,
"direction": "buy",
"filled_amount": 10,
"instrument_name": "BTC-31JUN23-50000-C",
"is_primary_otoco": true,
"is_secondary_oto": true,
"label": "my_order",
"last_update_timestamp": 1612137600,
"linked_order_type": "one_triggers_one_cancels_other",
"max_show": 0,
"mmp": true,
"order_id": "60c72b2f9b1e8a001c8e4d5a",
"order_state": "open",
"order_type": "limit",
"oto_order_ids": [
"60c72b2f9b1e8a001c8e4d5b"
],
"post_only": true,
"price": 50000,
"primary_order_id": "60c72b2f9b1e8a001c8e4d5c",
"reduce_only": true,
"replaced": false,
"status_otoco": "active",
"time_in_force": "good_til_cancelled",
"trigger": "index_price",
"trigger_fill_condition": "incremental",
"trigger_price": 63000,
"usd": 1000
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| amount | number | false | none | Order size |
| api | boolean | false | none | API |
| average_price | number | false | none | Average price |
| cancel_reason | string | false | none | Cancel reason |
| creation_timestamp | integer | false | none | Creation timestamp |
| direction | types.Side | false | none | Direction |
| filled_amount | number | false | none | Filled amount |
| instrument_name | string | false | none | Unique instrument identifier |
| is_primary_otoco | boolean | false | none | Primary OTOCO |
| is_secondary_oto | boolean | false | none | Secondary OTO |
| label | string | false | none | User defined label |
| last_update_timestamp | integer | false | none | Last update timestamp |
| linked_order_type | types.LinkedOrderType | false | none | Linked order type |
| max_show | number | false | none | Max show |
| mmp | boolean | false | none | Market maker protection |
| order_id | string | false | none | Unique order identifier |
| order_state | types.OrderStatus | false | none | Order state |
| order_type | types.Type | false | none | Order type |
| oto_order_ids | [string] | false | none | OTO order IDs |
| post_only | boolean | false | none | Post-only |
| price | number | false | none | Price |
| primary_order_id | string | false | none | Primary order ID |
| reduce_only | boolean | false | none | Reduce-only |
| replaced | boolean | false | none | Replaced |
| status_otoco | types.StatusOtoco | false | none | Status of the OTCO order |
| time_in_force | types.TimeInForce | false | none | Time in force |
| trigger | types.Trigger | false | none | Trigger type |
| trigger_fill_condition | types.TriggerFillCondition | false | none | Trigger fill condition |
| trigger_price | number | false | none | Trigger price |
| usd | number | false | none | Option price in USD |
models.OtocoConfig
{
"amount": 10,
"direction": "buy",
"price": 62000,
"time_in_force": "good_til_cancelled",
"trigger": "index_price",
"trigger_price": 63000,
"type": "limit"
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| amount | number | false | none | It represents the requested order size. For perpetual and inverse futures, the amount is in USD units. For linear futures, it is the underlying base currency coin. For options, it is the amount of corresponding cryptocurrency contracts, e.g., BTC or ETH. |
| direction | types.Side | false | none | Direction: buy, or sell |
| price | number | false | none | The order price in the base currency (Only for limit and stop_limit orders). When adding an order with advanced=usd, the field price should be the option price value in USD. When adding an 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%. |
| time_in_force | types.TimeInForce | false | none | Specifies how long the order remains in effect. Default "good_til_cancelled". - "good_til_cancelled" unfilled order remains in order book until cancelled. - "good_til_day" unfilled order remains in order book till the end of the trading session. - "fill_or_kill" execute a transaction immediately and completely or not at all. - "immediate_or_cancel" execute a transaction immediately, and any portion of the order that cannot be immediately filled is cancelled |
| trigger | types.Trigger | false | none | Defines the trigger type. Required for "Stop-Loss", "Take-Profit" and "Trailing" trigger orders |
| trigger_price | number | false | none | Trigger price, required for trigger orders only (Stop-loss or Take-profit orders) |
| type | types.Type | false | none | the order type include limit, market, stop_limit, stop_market, take_limit, take_market |
models.PositionConfirmation
{
"average_price": 50000,
"delta": 0.5,
"direction": "buy",
"estimated_liquidation_price": 45000,
"floating_profit_loss": 1000,
"index_price": 49000,
"initial_margin": 5000,
"instrument_name": "BTC-25JUN21-40000-C",
"interest_value": 50,
"kind": "future",
"leverage": 10,
"maintenance_margin": 3000,
"mark_price": 49500,
"open_orders_margin": 2000,
"realized_profit_loss": 500,
"settlement_price": 48000,
"size": 1,
"size_currency": 1,
"size_out": 0.5,
"total_profit_loss": 1500
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| average_price | number | false | none | Average price of trades that built this position |
| delta | number | false | none | Delta parameter |
| direction | string | false | none | Direction: buy, sell |
| estimated_liquidation_price | number | false | none | Estimated liquidation price, added only for futures, for non portfolio margining users |
| floating_profit_loss | number | false | none | Floating profit or loss |
| index_price | number | false | none | Current index price |
| initial_margin | number | false | none | Initial margin |
| instrument_name | string | false | none | Unique instrument identifier |
| interest_value | number | false | none | Value used to calculate realized_funding (perpetual only) |
| kind | string | false | none | Instrument kind: "future", "option" |
| leverage | integer | false | none | Current available leverage for future position |
| maintenance_margin | number | false | none | Maintenance margin |
| mark_price | number | false | none | Current mark price for position's instrument |
| open_orders_margin | number | false | none | Open orders margin |
| realized_profit_loss | number | false | none | Realized profit or loss |
| settlement_price | number | false | none | Optional (not added for spot). Last settlement price for position's instrument 0 if instrument wasn't settled yet |
| size | number | false | none | Position size for futures size in quote currency |
| size_currency | integer | false | none | Only for futures, position size in base currency |
| size_out | number | false | none | Size out |
| total_profit_loss | number | false | none | Profit or loss from position |
models.PriceNotification
{
"index_name": "BTC_USD-PERPETUAL",
"price": 50000,
"timestamp": 1612137600
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| index_name | string | false | none | Index name |
| price | number | false | none | Price |
| timestamp | integer | false | none | Timestamp |
models.QuoteNotification
{
"best_ask_amount": 1.5,
"best_ask_price": 50000,
"best_bid_amount": 1,
"best_bid_price": 49900,
"instrument_name": "BTC_USD-PERPETUAL",
"timestamp": 1612137600
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| best_ask_amount | number | false | none | Best ask amount |
| best_ask_price | number | false | none | Best ask price |
| best_bid_amount | number | false | none | Best bid amount |
| best_bid_price | number | false | none | Best bid price |
| instrument_name | string | false | none | Instrument name |
| timestamp | integer | false | none | Timestamp |
models.Request-models_BuySell
{
"id": 1,
"jsonrpc": "2.0",
"method": "Method Name",
"params": {
"amount": 10,
"instrument_name": "BTC-31JUN23-50000-C",
"label": "label_example",
"linked_order_type": "one_triggers_one_cancels_other",
"max_show": 40,
"mmp": true,
"otoco_config": [
{
"amount": 10,
"direction": "buy",
"price": 62000,
"time_in_force": "good_til_cancelled",
"trigger": "index_price",
"trigger_price": 63000,
"type": "limit"
}
],
"post_only": false,
"price": 60000,
"reduce_only": false,
"time_in_force": "good_til_cancelled",
"trigger": "index_price",
"trigger_fill_condition": "incremental",
"trigger_price": 65000,
"type": "limit"
}
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| id | integer | false | none | Request ID |
| jsonrpc | string | false | none | jsonRPC version |
| method | string | false | none | Method Name |
| params | models.BuySell | false | none | none |
models.Request-models_Cancel
{
"id": 1,
"jsonrpc": "2.0",
"method": "Method Name",
"params": {
"order_id": "646f0ae259c5e9efdb83c564"
}
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| id | integer | false | none | Request ID |
| jsonrpc | string | false | none | jsonRPC version |
| method | string | false | none | Method Name |
| params | models.Cancel | false | none | none |
models.Request-models_CancelAll
{
"id": 1,
"jsonrpc": "2.0",
"method": "Method Name",
"params": {
"detailed": true
}
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| id | integer | false | none | Request ID |
| jsonrpc | string | false | none | jsonRPC version |
| method | string | false | none | Method Name |
| params | models.CancelAll | false | none | none |
models.Request-models_CancelAllByInstrument
{
"id": 1,
"jsonrpc": "2.0",
"method": "Method Name",
"params": {
"detailed": true,
"instrument_name": "BTC-31JUN23-50000-C",
"type": "limit"
}
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| id | integer | false | none | Request ID |
| jsonrpc | string | false | none | jsonRPC version |
| method | string | false | none | Method Name |
| params | models.CancelAllByInstrument | false | none | none |
models.Request-models_Edit
{
"id": 1,
"jsonrpc": "2.0",
"method": "Method Name",
"params": {
"amount": 10,
"order_id": "646f0ae259c5e9efdb83c564",
"price": 50000,
"trigger_price": 54000
}
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| id | integer | false | none | Request ID |
| jsonrpc | string | false | none | jsonRPC version |
| method | string | false | none | Method Name |
| params | models.Edit | false | none | none |
models.Request-models_GetAccountSummary
{
"id": 1,
"jsonrpc": "2.0",
"method": "Method Name",
"params": {
"currency": "USD"
}
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| id | integer | false | none | Request ID |
| jsonrpc | string | false | none | jsonRPC version |
| method | string | false | none | Method Name |
| params | models.GetAccountSummary | false | none | none |
models.Request-models_GetDeposits
{
"id": 1,
"jsonrpc": "2.0",
"method": "Method Name",
"params": {
"count": 20,
"currency": "USD",
"offset": 0
}
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| id | integer | false | none | Request ID |
| jsonrpc | string | false | none | jsonRPC version |
| method | string | false | none | Method Name |
| params | models.GetDeposits | false | none | none |
models.SetMMPConfig
{
"frozen_time": 10,
"index_name": "btc_usd",
"interval": 10,
"quantity_limit": 10
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| frozen_time | number | false | none | The frozen time in seconds |
| index_name | string | false | none | Index name |
| interval | number | false | none | The interval in seconds |
| quantity_limit | number | false | none | The quantity limit |
models.SettlementConfirmation
{
"index_price": "50000.0",
"instrument_name": "BTC-31JUN23-50000-C",
"position": "long",
"profit_loss": "1000.0",
"timestamp": 1612137600,
"type": "settlement"
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| index_price | string | false | none | Index price |
| instrument_name | string | false | none | Instrument name |
| position | string | false | none | Position |
| profit_loss | string | false | none | Profit and loss |
| timestamp | integer | false | none | Timestamp |
| type | string | false | none | Settlement type |
models.TradeConfirmation
{
"advanced": "usd",
"amount": 10,
"api": true,
"direction": "buy",
"index_price": 50000,
"instrument_name": "BTC-31JUN23-50000-C",
"label": "my_trade",
"mark_price": 49500,
"order_id": "60c72b2f9b1e8a001c8e4d5a",
"order_type": "limit",
"price": 50000,
"state": "filled",
"tick_direction": 0,
"timestamp": 1612137600,
"trade_id": "66fa560b912a3148d07efacf",
"trade_seq": 1,
"underlying_index": "BTCUSD",
"underlying_price": 49000
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| advanced | string | false | none | Advanced type of user order |
| amount | number | false | none | Trade amount |
| api | boolean | false | none | API |
| direction | types.Side | false | none | Direction |
| index_price | number | false | none | Index price |
| instrument_name | string | false | none | Unique instrument identifier |
| label | string | false | none | User defined label |
| mark_price | number | false | none | Mark price |
| order_id | string | false | none | Order ID |
| order_type | types.Type | false | none | Order type |
| price | number | false | none | Price |
| state | string | false | none | Order state |
| tick_direction | integer | false | none | Tick direction |
| timestamp | integer | false | none | Timestamp |
| trade_id | string | false | none | Trade ID |
| trade_seq | integer | false | none | Trade sequence |
| underlying_index | string | false | none | Underlying index |
| underlying_price | number | false | none | Underlying price |
models.TradesResponse
{
"amount": 10,
"api": true,
"direction": "buy",
"index_price": 50000,
"instrument_name": "BTC-31JUN23-50000-C",
"mark_iv": 0.5,
"mark_price": 49500,
"price": 50000,
"tick_direction": 0,
"timestamp": 1612137600,
"trade_id": "66fa560b912a3148d07efacf",
"trade_seq": 1
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| amount | number | false | none | Trade amount |
| api | boolean | false | none | API |
| direction | string | false | none | Direction |
| index_price | number | false | none | Index price |
| instrument_name | string | false | none | Unique instrument identifier |
| mark_iv | number | false | none | Mark IV |
| mark_price | number | false | none | Mark price |
| price | number | false | none | Price |
| tick_direction | integer | false | none | Tick direction |
| timestamp | integer | false | none | Trade timestamp |
| trade_id | string | false | none | Trade ID |
| trade_seq | integer | false | none | Trade sequence |
models.UserChangesNotification
{
"orders": [
{
"amount": 10,
"api": true,
"average_price": 50000,
"cancel_reason": "user_request",
"creation_timestamp": 1612137600,
"direction": "buy",
"filled_amount": 10,
"instrument_name": "BTC-31JUN23-50000-C",
"is_primary_otoco": true,
"is_secondary_oto": true,
"label": "my_order",
"last_update_timestamp": 1612137600,
"linked_order_type": "one_triggers_one_cancels_other",
"max_show": 0,
"mmp": true,
"order_id": "60c72b2f9b1e8a001c8e4d5a",
"order_state": "open",
"order_type": "limit",
"oto_order_ids": [
"60c72b2f9b1e8a001c8e4d5b"
],
"post_only": true,
"price": 50000,
"primary_order_id": "60c72b2f9b1e8a001c8e4d5c",
"reduce_only": true,
"replaced": false,
"status_otoco": "active",
"time_in_force": "good_til_cancelled",
"trigger": "index_price",
"trigger_fill_condition": "incremental",
"trigger_price": 63000,
"usd": 1000
}
],
"trades": [
{
"amount": 10,
"api": true,
"direction": "buy",
"index_price": 50000,
"instrument_name": "BTC-31JUN23-50000-C",
"mark_iv": 0.5,
"mark_price": 49500,
"price": 50000,
"tick_direction": 0,
"timestamp": 1612137600,
"trade_id": "66fa560b912a3148d07efacf",
"trade_seq": 1
}
]
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| orders | [models.OrderConfirmation] | false | none | List of order confirmations |
| trades | [models.TradesResponse] | false | none | List of trade responses |
return_codes.CommonCodes
1
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| CommonCodes | integer | false | none | none |
Enumerated Values
| Property | Value |
|---|---|
| CommonCodes | 1 |
| CommonCodes | 2 |
| CommonCodes | 3 |
| CommonCodes | 4 |
| CommonCodes | 5 |
| CommonCodes | 6 |
| CommonCodes | 7 |
| CommonCodes | 8 |
| CommonCodes | 9 |
| CommonCodes | 10 |
| CommonCodes | 11 |
| CommonCodes | 12 |
| CommonCodes | 13 |
services.LoginResponse
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
"expires_in": 1516239022,
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
"scope": "connection mainaccount",
"token_type": "bearer"
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| access_token | string | false | none | Access Token to use for authentication |
| expires_in | integer | false | none | Token lifetime in seconds |
| refresh_token | string | false | none | Can be used to request a new token (with a new lifetime) |
| scope | string | false | none | Type of the access for assigned token |
| token_type | string | false | none | Authorization type, allowed value - bearer |
types.LinkedOrderType
"one_triggers_other",
"one_triggers_one_cancels_other"
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| LinkedOrderType | string | false | none | none |
Enumerated Values
| Property | Value |
|---|---|
| LinkedOrderType | one_triggers_other |
| LinkedOrderType | one_triggers_one_cancels_other |
types.MetadataFundingType
"twap"
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| MetadataFundingType | string | false | none | none |
Enumerated Values
| Property | Value |
|---|---|
| MetadataFundingType | twap |
types.OrderStatus
"open",
"partially_filled",
"filled",
"cancelled",
"untriggered",
"rejected"
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| OrderStatus | string | false | none | none |
Enumerated Values
| Property | Value |
|---|---|
| OrderStatus | open |
| OrderStatus | partially_filled |
| OrderStatus | filled |
| OrderStatus | cancelled |
| OrderStatus | untriggered |
| OrderStatus | rejected |
types.Side
"buy",
"sell",
"edit",
"edit_leverage",
"cancel",
"cancel_all",
"cancel_all_by_instrument",
"cancel_all_by_connection_id"
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| Side | string | false | none | none |
Enumerated Values
| Property | Value |
|---|---|
| Side | buy |
| Side | sell |
| Side | edit |
| Side | edit_leverage |
| Side | cancel |
| Side | cancel_all |
| Side | cancel_all_by_instrument |
| Side | cancel_all_by_connection_id |
types.StatusOtoco
"active",
"draft"
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| StatusOtoco | string | false | none | none |
Enumerated Values
| Property | Value |
|---|---|
| StatusOtoco | active |
| StatusOtoco | draft |
types.TimeInForce
"good_til_cancelled",
"good_til_day",
"fill_or_kill",
"immediate_or_cancel"
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| TimeInForce | string | false | none | none |
Enumerated Values
| Property | Value |
|---|---|
| TimeInForce | good_til_cancelled |
| TimeInForce | good_til_day |
| TimeInForce | fill_or_kill |
| TimeInForce | immediate_or_cancel |
types.Trigger
"index_price",
"last_price"
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| Trigger | string | false | none | none |
Enumerated Values
| Property | Value |
|---|---|
| Trigger | index_price |
| Trigger | last_price |
types.TriggerFillCondition
"first_hit",
"complete_fill",
"incremental"
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| TriggerFillCondition | string | false | none | none |
Enumerated Values
| Property | Value |
|---|---|
| TriggerFillCondition | first_hit |
| TriggerFillCondition | complete_fill |
| TriggerFillCondition | incremental |
types.Type
"all",
"limit",
"stop_limit",
"take_limit",
"market",
"stop_market",
"take_market",
"trigger_all"
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| Type | string | false | none | none |
Enumerated Values
| Property | Value |
|---|---|
| Type | all |
| Type | limit |
| Type | stop_limit |
| Type | take_limit |
| Type | market |
| Type | stop_market |
| Type | take_market |
| Type | trigger_all |
user.Fee
{
"percentage": 0,
"volume": 0
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| percentage | number | false | none | none |
| volume | number | false | none | none |
user.HeartbeatTrade
{
"status_trade": "active"
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| status_trade | string | false | none | Status of the trade, active or inactive |
user.PublishFee
{
"future": {
"percentage": 0,
"volume": 0
},
"option": {
"percentage": 0,
"volume": 0
},
"perpetual": {
"percentage": 0,
"volume": 0
},
"user_id": "66fa6630cc40f0ef42ecbb47"
}
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| future | user.Fee | false | none | Future fee |
| option | user.Fee | false | none | Option fee |
| perpetual | user.Fee | false | none | Perpetual fee |
| user_id | string | false | none | User ID unique identifier |