Introduction
Welcome to the Delta Exchange API! You can use this API to place orders on Delta Exchange and listen to market feed.
We have language bindings in Shell, Python, Ruby and Nodejs! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
General Information
Definitions
Assets: are cryptocurrencies or fiat currencies. Each asset has a 3/4 letter code (e.g. BTC, USDC). A derivative contract on Delta Exchange will entail multiple assets, namely:
Underlying Asset: This is the asset over which a futures or perpetual contract is defined. For e.g. the underlying asset of the BTCUSD perpetual contract is BTC.
Quoting Asset: The asset in which price of the quoting is called the quoting asset. For e.g. the BTCUSD contract is quoted in USD. Therefore, the quoting asset of the contract is USD.
Settling Asset: The asset in which the margin and Profit/ Loss of a contract is denominated. For e.g. the BTCUSD contract is margined and settled in BTC. Therefore, the settling asset of the contract is BTC.
Products: are the derivative contracts listed on Delta Exchange. Each contract can be referred by either its Product ID (e.g. 27 is the Product ID of BTCUSD contract) or Symbol (BTCUSD is the symbol for BTCUSD contract). It is worth noting that Orders, Orderbook APIs expect Product IDs. e.g
product_id | symbol | product_type | description |
---|---|---|---|
27 | BTCUSD | inverse_future | Bitcoin Perpetual futures, quoted in US Dollar and settled & margined in BTC |
45 | XRPUSDQ | future | XRP/USD perpetual futures USDC Quanto, quoted in US Dollar and settled & margined in USDC |
46 | BTCUSD_27Dec | inverse_future | 27th December Bitcoin future quoted in US Dollar |
Symbology
Contract symbol: has the following format
Underlying Asset| Quoting Asset|Q (optional; applicable only to quanto contracts)|_|Matruity Date (optional, applicable only for futures contracts)
e.g. BTCUSD, BTCUSD_27Dec, LEOUSDQ
Mark Price: Each contract has a unique Mark Price which can be referred to by: MARK: Contract_Symbol (MARK:BTCUSD)
Index Price: The prices of the underlying assets for the contracts listed on Delta Exchange are obtained from various spot exchanges, and are computed by averaging prices from multiple exchanges. Details of all the indices are available on this page.
For a given Underlying Asset/ Quoting Asset pair, the Index price symbol is: .DE|Underlying Asset|Quoting Asset| e.g. .DEBNBXBT It is important to note that the BTCUSD Index price doesn't follow this convention as its symbol is .DEXBTUSD.
Pagination
Pagination allows to fetch data page-wise. We use cursor based pagination where each response metadata contains a before and after cursor. The cursor needs to passed on with the next request to paginate over the result. Please note that the cursors are updated with each new page.
Pagination can be called in following APIs
API | End point |
---|---|
Products | /products |
Orders | /orders |
Orders History | /orders/history |
Fills | /fills |
Wallet transactions | /wallet/transactions |
Pagination parameters
- after
- after cursor to fetch the next page
- before
- before cursor to fetch the previous page
- page_size
- page size for pagination
In API response, meta data will contain the cursors as show below
{
success: true,
result: [ {}, {}, .....],
meta: {
after: "an_arbitary_string",
before: "another_arbitary_string"
}
}
Example
https://api.india.delta.exchange/v2/products?page_size=30
https://api.india.delta.exchange/v2/products?page_size=30&after=after_cursor_from_last_request
Data Centers
Delta Exchange data centers are in AWS Tokyo
Authentication
Api endpoints that place orders or fetch account related information needs to authenticated using api key and api secret.
Common Errors
Note You should use ntp timestamp to sync local clocks in order to avoid following issue:
{ "error: "SignatureExpired", message:"your signature has expired" }
Signature created in the last 5 seconds is allowed. if signature reaches delta system post 5 seconds of generation, then it will fail.
{ "error": "InvalidApiKey", message: "Api Key not found"}
above error will be thrown if you are not using correct key, please check hostname e.g. erroneously Testnet.Delta.exchange api key have been used instead of Delta.exchange api key
{ "error: "UnauthorizedApiAccess", message:"Api Key not authorised to access this endpoint" }
Check api key have required permissions like trading permission
{"success": False, "error": {"code": "ip_blocked_for_api_key"}}
API call made from a machine with IP address that isn't whitelisted. Check the below docs for common issues and fixes.
Generating an API Key
Before being able to sign any requests, you must create an API key via the Delta website. Upon creating a key you will receive api key and api secret, which you must remember and secure at your end. The Key and Secret will be randomly generated.
You can create a new API key from here : https://www.delta.exchange/app/account/manageapikeys
To create an API key with Trading permissions, whitelisted IP(s) must be provided. API requests using this API key will only succeed, if made from a machine with an IP address that was whitelisted. Multiple IPs can be whitelisted for a single API key. IP values can take IPv4 and IPv6. Whitelisted IPs can be changed and updated from the same page.
Common issues:
1. Your machine is using IPv6 instead of IPv4 or vice-versa. Disable the one that isn’t whitelisted from your network settings or whitelist both.
2. Your ISP may automatically change the IP address at your home, office about once a week. Update your whitelisted IP in such case.
3. If you are using a Web Service/Cloud provider like AWS, assign a static public IPv4 address to your machine.
API Key Permissions
You can restrict the functionality of API keys. Before creating the key, you must choose what permissions you would like the key to have. The permissions are:
- Trading - Allow a key to have trading permissions. This includes placing new orders, cancelling orders, closing positions, changing margin & leverage.
Creating a Request
All Authenticated requests must contain the following headers:
api-key: The api key as a string.
signature: The hex-encoded signature (see Signing a Message).
timestamp: A timestamp for your request.
All request bodies should have content type application/json and be valid JSON.
Signing a Message
The signature header is generated by creating a sha256 HMAC using the secret key on the prehash string method + timestamp + requestPath + query params + body (where + represents string concatenation) and convert output to hexdigest. The timestamp value is the same as the 'timestamp' header.
Signature created in the last 5 seconds is allowed. if signature reaches delta system post 5 seconds of generation, then it will fail.
Code samples
# GET /orders
# queryString: product_id=1&state=open
# Generating signature:
echo -n "GET1542110948/orders?product_id=1&state=open" | openssl dgst -sha256 -hmac "7b6f39dcf660ec1c7c664f612c60410a2bd0c258416b498bf0311f94228f"
# Sample Request:
# Url:
# /orders?product_id=1&state=open
# Headers:
# signature: ad767fead0bdbe91ba1e4feb142079245fecd66aa5e47a70b40ba1a4c9b4e3db
# api-key: a207900b7693435a8fa9230a38195d
#timestamp: 1542110948
import hashlib
import hmac
import base64
import requests
import datetime
api_key = 'a207900b7693435a8fa9230a38195d'
api_secret = '7b6f39dcf660ec1c7c664f612c60410a2bd0c258416b498bf0311f94228f'
def generate_signature(secret, message):
message = bytes(message, 'utf-8')
secret = bytes(secret, 'utf-8')
hash = hmac.new(secret, message, hashlib.sha256)
return hash.hexdigest()
def get_time_stamp():
d = datetime.datetime.utcnow()
epoch = datetime.datetime(1970,1,1)
return str(int((d - epoch).total_seconds()))
url = "https://api.india.delta.exchange/v2/orders"
# Get open orders
payload = ''
method = 'GET'
timestamp = get_time_stamp()
path = '/v2/orders'
query_string = '?product_id=1&state=open'
signature_data = method + timestamp + path + query_string + payload
signature = generate_signature(api_secret, signature_data)
req_headers = {
'api-key': api_key,
'timestamp': timestamp,
'signature': signature,
'User-Agent': 'rest-client',
'Content-Type': 'application/json'
}
query = {"product_id": 1, "state": 'open'}
response = requests.request(
method, url, data=payload, params=query, timeout=(3, 27), headers=req_headers
)
# Place new order
method = 'POST'
timestamp = get_time_stamp()
path = '/v2/orders'
query_string = ''
payload = "{\"order_type\":\"limit_order\",\"size\":3,\"side\":\"buy\",\"limit_price\":\"0.0005\",\"product_id\":16}"
signature_data = method + timestamp + path + query_string + payload
signature = generate_signature(api_secret, signature_data)
req_headers = {
'api-key': api_key,
'timestamp': timestamp,
'signature': signature,
'User-Agent': 'rest-client',
'Content-Type': 'application/json'
}
response = requests.request(
method, url, data=payload, params={}, timeout=(3, 27), headers=req_headers
)
Rate Limits
When a rate limit is exceeded, a HTTP response status 429 Too Many Requests will be returned. 'X-RATE-LIMIT-RESET' is returned in response header with time left in milliseconds after which next API request can be hit.
We throttle unauthenticated api requests by IP address and authenticated requests by user ID.
Default Quota is 10000 for a fixed 5 minute window. Rate Limit quota resets to full every 5 mins.
REST API Rate Limit Weight
Every REST endpoint has been assigned a weight. When you make an API call, the weight of that endpoint is deducted from your 5 min window quota. Exceeding the rate limit quota, results in 429 HTTP response status error. API endpoints related to reading public data are lighter in weight, whereas API endpoints related to writing private data (like placing an order) are heavier in weight.
Here is the cost structure for various endpoints. Please note that any endpoint not mentioned here has a cost of 1 unit.
Weight Slab | API Endpoints |
---|---|
3 | Get Products, Get Orderbook, Get Tickers, Get Open Orders, Get Open Postions, Get Balances, OHLC Candles |
5 | Place/Edit/Delete Order, Add Position Margin |
10 | Get Order History, Get Fills, Get Txn Logs |
25 | Batch Order Apis |
e.g. Consider making all the below requests in a 5 minute window.
100 Get Open Orders requests = 100 * 3 = 300 weight.
50 Get Balances requests = 50 * 3 = 150 weight.
200 Place order requests = 200 * 5 = 1000 weight.
20 Batch Order requests = 20 * 25 = 500 weight.
Total quota used: 300 + 150 + 1000 + 500 = 1950 quota used. If this is greater than quota assigned to you, rate limit error will occur.
Increasing your rate limits
If you are running up against our limits and believe that you have a legitimate need, please email us at [email protected] to discuss increasing your rate limits.
Types
Timestamps
Unless otherwise specified, all timestamps from API are returned in ISO 8601 with microseconds. Make sure you can parse the following ISO 8601 format. Most modern languages and libraries will handle this without issues.
2019-09-18T10:41:20Z
Numbers
Big Decimal numbers are returned as strings to save full precision. When making a API request, it is suggested to convert numbers to strings to avoid truncation and precision errors.
e.g. Limit price, stop loss price, trail_amount
Integer numbers (like contract size, product_id and impact size) are unquoted.
IDs
Most identifiers are UUID unless otherwise specified. When making a request which requires a UUID, both forms (with and without dashes) are accepted.
167ja7cg-678e-6876-d6g3-f803ce49qsc9
or 167ja7cg678e6876d6g3f803ce49qsc9
Response Formats
To ensure that you are effectively using the api, we encourage you to go through this section.
- All responses coming from the server, either from rest api or socket rpc calls will have the following success and error formats.
- All timestamps reported in the apis will be in microseconds
- All big decimal values are sent as string
// Success format
{
success: true,
result: ..., // response body
meta: { // response meta - like pagination info
...
}
}
// Error format
{
success: false,
error: {
code: ..., // standard error code
context: { // extra context data to explain the cause of error
...
}
}
}
title: Delta Exchange Api V2 v1.0.0 language_tabs: - python: Python - shell: Shell - ruby: Ruby language_clients: - python: "" - shell: "" - ruby: "" toc_footers: [] includes: [] search: true highlight_theme: darkula headingLevel: 2
Rest Api
This section documents the latest(v2) api for trading on Delta Exchange. The REST API has endpoints for account and order management as well as public market data.
If you are looking for the old api documentation, here is the link to v1 api docs (now deprecated).
REST API Endpoint URL for Delta Exchange India
- Production-India - https://api.india.delta.exchange/v2
- Testnet-India - https://cdn-ind.testnet.deltaex.org/v2
REST API Endpoint URL for Delta Exchange Global
- Production-Global - https://api.delta.exchange/v2
- Testnet-Global - https://testnet-api.delta.exchange/v2
Assets
Get Asset List
Get list of all assets
Code samples
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('https://api.india.delta.exchange/v2/assets', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X GET https://api.india.delta.exchange/v2/assets \
-H 'Accept: application/json'
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'https://api.india.delta.exchange/v2/assets',
params: {
}, headers: headers
p JSON.parse(result)
GET /assets
Example responses
200 Response
{
"success": true,
"result": [
{
"id": 14,
"symbol": "USD",
"precision": 8,
"deposit_status": "enabled",
"withdrawal_status": "enabled",
"base_withdrawal_fee": "0.000000000000000000",
"min_withdrawal_amount": "0.000000000000000000"
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | List of Asset schema | Inline |
Response Schema
Enumerated Values
Property | Value |
---|---|
deposit_status | enabled |
deposit_status | disabled |
withdrawal_status | enabled |
withdrawal_status | disabled |
Indices
Get Indices List
Get indices
Code samples
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('https://api.india.delta.exchange/v2/indices', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X GET https://api.india.delta.exchange/v2/indices \
-H 'Accept: application/json'
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'https://api.india.delta.exchange/v2/indices',
params: {
}, headers: headers
p JSON.parse(result)
GET /indices
Indices refer to spot price indices that Delta Exchange creates by combining spot prices of prominent crypto exchanges. These indices form the underlying of futures and options contracts listed on Delta Exchange. All details of indices on Delta Exchange are available here.
Example responses
200 Response
{
"success": true,
"result": [
{
"id": 14,
"symbol": ".DEXBTUSD",
"constituent_exchanges": [
{
"name": "ExchangeA",
"weight": 0.25
}
],
"underlying_asset_id": 13,
"quoting_asset_id": 14,
"tick_size": "0.5",
"index_type": "spot_pair"
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | List of Spot Index schema | Inline |
Response Schema
Enumerated Values
Property | Value |
---|---|
index_type | spot_pair |
index_type | fixed_interest_rate |
index_type | floating_interest_rate |
Products
Get Product List
Get list of products
Code samples
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('https://api.india.delta.exchange/v2/products', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X GET https://api.india.delta.exchange/v2/products \
-H 'Accept: application/json'
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'https://api.india.delta.exchange/v2/products',
params: {
}, headers: headers
p JSON.parse(result)
GET /products
The endpoint provides details about all available trading products on the platform. Each product represents a financial instrument like perpetual futures, options, or contracts for specific asset pairs.
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
contract_types | query | string | false | Comma separated list of contract types e.g. futures,perpetual_futures,call_options, put_options, interest_rate_swaps,move_options,spreads, turbo_call_options, turbo_put_options, spot |
states | query | string | false | Comma separated list of states e.g. upcoming,live,expired,settled to get expired contracts. |
after | query | string | false | after cursor for paginated request |
before | query | string | false | before cursor for paginated request |
page_size | query | string | false | size of a single page for paginated request, default: 100 |
Example responses
200 Response
{
"success": true,
"result": [
{
"id": 27,
"symbol": "BTCUSD",
"description": "Bitcoin Perpetual futures, quoted, settled & margined in US Dollar",
"created_at": "2023-12-18T13:10:39Z",
"updated_at": "2024-11-15T02:47:50Z",
"settlement_time": null,
"notional_type": "vanilla",
"impact_size": 10000,
"initial_margin": "0.5",
"maintenance_margin": "0.25",
"contract_value": "0.001",
"contract_unit_currency": "BTC",
"tick_size": "0.5",
"product_specs": {
"funding_clamp_value": 0.05,
"only_reduce_only_orders_allowed": false,
"tags": [
"layer_1"
]
},
"state": "live",
"trading_status": "operational",
"max_leverage_notional": "100000",
"default_leverage": "200",
"initial_margin_scaling_factor": "0.0000025",
"maintenance_margin_scaling_factor": "0.00000125",
"taker_commission_rate": "0.0005",
"maker_commission_rate": "0.0002",
"liquidation_penalty_factor": "0.5",
"contract_type": "perpetual_futures",
"position_size_limit": 229167,
"basis_factor_max_limit": "10.95",
"is_quanto": false,
"funding_method": "mark_price",
"annualized_funding": "10.95",
"price_band": "2.5",
"underlying_asset": {
"id": 14,
"symbol": "USD",
"precision": 8,
"deposit_status": "enabled",
"withdrawal_status": "enabled",
"base_withdrawal_fee": "0.000000000000000000",
"min_withdrawal_amount": "0.000000000000000000"
},
"quoting_asset": {
"id": 14,
"symbol": "USD",
"precision": 8,
"deposit_status": "enabled",
"withdrawal_status": "enabled",
"base_withdrawal_fee": "0.000000000000000000",
"min_withdrawal_amount": "0.000000000000000000"
},
"settling_asset": {
"id": 14,
"symbol": "USD",
"precision": 8,
"deposit_status": "enabled",
"withdrawal_status": "enabled",
"base_withdrawal_fee": "0.000000000000000000",
"min_withdrawal_amount": "0.000000000000000000"
},
"spot_index": {
"id": 14,
"symbol": ".DEXBTUSD",
"constituent_exchanges": [
{
"name": "ExchangeA",
"weight": 0.25
}
],
"underlying_asset_id": 13,
"quoting_asset_id": 14,
"tick_size": "0.5",
"index_type": "spot_pair"
}
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | List of Products | Inline |
Response Schema
Enumerated Values
Property | Value |
---|---|
notional_type | vanilla |
notional_type | inverse |
state | live |
state | expired |
state | upcoming |
trading_status | operational |
trading_status | disrupted_cancel_only |
trading_status | disrupted_post_only |
deposit_status | enabled |
deposit_status | disabled |
withdrawal_status | enabled |
withdrawal_status | disabled |
index_type | spot_pair |
index_type | fixed_interest_rate |
index_type | floating_interest_rate |
Get product by symbol
Code samples
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('https://api.india.delta.exchange/v2/products/{symbol}', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X GET https://api.india.delta.exchange/v2/products/{symbol} \
-H 'Accept: application/json'
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'https://api.india.delta.exchange/v2/products/{symbol}',
params: {
}, headers: headers
p JSON.parse(result)
GET /products/{symbol}
The endpoint retrieves details of a specific product identified by its symbol (e.g., BTCUSD, ETHUSD).
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
symbol | path | string | true | symbol of the desired product like BTCUSD, ETHUSD |
Example responses
200 Response
{
"success": true,
"result": {
"id": 27,
"symbol": "BTCUSD",
"description": "Bitcoin Perpetual futures, quoted, settled & margined in US Dollar",
"created_at": "2023-12-18T13:10:39Z",
"updated_at": "2024-11-15T02:47:50Z",
"settlement_time": null,
"notional_type": "vanilla",
"impact_size": 10000,
"initial_margin": "0.5",
"maintenance_margin": "0.25",
"contract_value": "0.001",
"contract_unit_currency": "BTC",
"tick_size": "0.5",
"product_specs": {
"funding_clamp_value": 0.05,
"only_reduce_only_orders_allowed": false,
"tags": [
"layer_1"
]
},
"state": "live",
"trading_status": "operational",
"max_leverage_notional": "100000",
"default_leverage": "200",
"initial_margin_scaling_factor": "0.0000025",
"maintenance_margin_scaling_factor": "0.00000125",
"taker_commission_rate": "0.0005",
"maker_commission_rate": "0.0002",
"liquidation_penalty_factor": "0.5",
"contract_type": "perpetual_futures",
"position_size_limit": 229167,
"basis_factor_max_limit": "10.95",
"is_quanto": false,
"funding_method": "mark_price",
"annualized_funding": "10.95",
"price_band": "2.5",
"underlying_asset": {
"id": 14,
"symbol": "USD",
"precision": 8,
"deposit_status": "enabled",
"withdrawal_status": "enabled",
"base_withdrawal_fee": "0.000000000000000000",
"min_withdrawal_amount": "0.000000000000000000"
},
"quoting_asset": {
"id": 14,
"symbol": "USD",
"precision": 8,
"deposit_status": "enabled",
"withdrawal_status": "enabled",
"base_withdrawal_fee": "0.000000000000000000",
"min_withdrawal_amount": "0.000000000000000000"
},
"settling_asset": {
"id": 14,
"symbol": "USD",
"precision": 8,
"deposit_status": "enabled",
"withdrawal_status": "enabled",
"base_withdrawal_fee": "0.000000000000000000",
"min_withdrawal_amount": "0.000000000000000000"
},
"spot_index": {
"id": 14,
"symbol": ".DEXBTUSD",
"constituent_exchanges": [
{
"name": "ExchangeA",
"weight": 0.25
}
],
"underlying_asset_id": 13,
"quoting_asset_id": 14,
"tick_size": "0.5",
"index_type": "spot_pair"
}
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Product | Inline |
Response Schema
Enumerated Values
Property | Value |
---|---|
notional_type | vanilla |
notional_type | inverse |
state | live |
state | expired |
state | upcoming |
trading_status | operational |
trading_status | disrupted_cancel_only |
trading_status | disrupted_post_only |
deposit_status | enabled |
deposit_status | disabled |
withdrawal_status | enabled |
withdrawal_status | disabled |
index_type | spot_pair |
index_type | fixed_interest_rate |
index_type | floating_interest_rate |
Get tickers for products
Code samples
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('https://api.india.delta.exchange/v2/tickers', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X GET https://api.india.delta.exchange/v2/tickers \
-H 'Accept: application/json'
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'https://api.india.delta.exchange/v2/tickers',
params: {
}, headers: headers
p JSON.parse(result)
GET /tickers
This endpoint retrieves the live tickers for available trading products, with an optional filter by specified contract types. The contract types should be provided as a comma-separated list (e.g., futures, perpetual_futures, call_options). If no contract type is specified, data for all available products will be returned.
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
contract_types | query | string | false | A comma-separated list of contract types to filter the tickers. Example values include futures, perpetual_futures, call_options, put_options, interest_rate_swaps, move_options, spreads, turbo_call_options, turbo_put_options, and spot. |
Example responses
200 Response
{
"success": true,
"result": [
{
"close": 67321,
"contract_type": "futures",
"greeks": {
"delta": "0.25",
"gamma": "0.10",
"rho": "0.05",
"theta": "-0.02",
"vega": "0.15"
},
"high": 68500.5,
"low": 66300.25,
"mark_price": "67000.00",
"mark_vol": "500",
"oi": "15000",
"oi_value": "1000000",
"oi_value_symbol": "USD",
"oi_value_usd": "1050000",
"open": 67000,
"price_band": {
"lower_limit": "61120.45",
"upper_limit": "72300.00"
},
"product_id": 123456,
"quotes": {
"ask_iv": "0.25",
"ask_size": "100",
"best_ask": "150.00",
"best_bid": "148.00",
"bid_iv": "0.22",
"bid_size": "50"
},
"size": 100,
"spot_price": "67000.00",
"strike_price": "68000.00",
"symbol": "BTCUSD",
"timestamp": 1609459200,
"turnover": 5000000,
"turnover_symbol": "USD",
"turnover_usd": 5200000,
"volume": 25000
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | List of live tickers for all products, including implied volatility (IV) for option strikes. | Inline |
Response Schema
Get ticker for a product by symbol
Code samples
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('https://api.india.delta.exchange/v2/tickers/{symbol}', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X GET https://api.india.delta.exchange/v2/tickers/{symbol} \
-H 'Accept: application/json'
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'https://api.india.delta.exchange/v2/tickers/{symbol}',
params: {
}, headers: headers
p JSON.parse(result)
GET /tickers/{symbol}
This endpoint retrieves the ticker data for a specific product, identified by its symbol. The ticker data includes live price data, open interest, implied volatility (IV) for options, and other related market data.
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
symbol | path | string | true | The symbol of the product for which the ticker data is requested (e.g., BTCUSD, ETHUSD). |
Example responses
200 Response
{
"success": true,
"result": {
"close": 67321,
"contract_type": "futures",
"greeks": {
"delta": "0.25",
"gamma": "0.10",
"rho": "0.05",
"theta": "-0.02",
"vega": "0.15"
},
"high": 68500.5,
"low": 66300.25,
"mark_price": "67000.00",
"mark_vol": "500",
"oi": "15000",
"oi_value": "1000000",
"oi_value_symbol": "USD",
"oi_value_usd": "1050000",
"open": 67000,
"price_band": {
"lower_limit": "61120.45",
"upper_limit": "72300.00"
},
"product_id": 123456,
"quotes": {
"ask_iv": "0.25",
"ask_size": "100",
"best_ask": "150.00",
"best_bid": "148.00",
"bid_iv": "0.22",
"bid_size": "50"
},
"size": 100,
"spot_price": "67000.00",
"strike_price": "68000.00",
"symbol": "BTCUSD",
"timestamp": 1609459200,
"turnover": 5000000,
"turnover_symbol": "USD",
"turnover_usd": 5200000,
"volume": 25000
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Ticker data for the requested product, including implied volatility (IV) for option strikes, if applicable. | Inline |
Response Schema
Orders
Placing Orders, Cancelling Orders, Placing batch orders, Cancelling batch orders, Get Open orders, Change Orders Leverage. Rate limits have been introduced recently that allows only set number of operations inside a matching engine in a timeframe. The current rate limits is 500 operations/sec for each product. For ex - placing 50 orders in a batch is equivalent to 50 operations as these orders will be processed by matching engine. Rate limits do not apply when cancelling orders.
Place Order
Code samples
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.post('https://api.india.delta.exchange/v2/orders', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X POST https://api.india.delta.exchange/v2/orders \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.post 'https://api.india.delta.exchange/v2/orders',
params: {
}, headers: headers
p JSON.parse(result)
POST /orders
Body parameter
{
"product_id": 27,
"product_symbol": "BTCUSD",
"limit_price": "59000",
"size": 10,
"side": "buy",
"order_type": "limit_order",
"stop_order_type": "stop_loss_order",
"stop_price": "56000",
"trail_amount": "50",
"stop_trigger_method": "last_traded_price",
"bracket_stop_loss_limit_price": "57000",
"bracket_stop_loss_price": "56000",
"bracket_trail_amount": "50",
"bracket_take_profit_limit_price": "62000",
"bracket_take_profit_price": "61000",
"time_in_force": "gtc",
"mmp": "disabled",
"post_only": false,
"reduce_only": false,
"client_order_id": "34521712",
"cancel_orders_accepted": false
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
body | body | CreateOrderRequest | true | Order which needs to be created. Rate limits apply. |
Example responses
200 Response
{
"success": true,
"result": {
"id": 123,
"user_id": 453671,
"size": 10,
"unfilled_size": 2,
"side": "buy",
"order_type": "limit_order",
"limit_price": "59000",
"stop_order_type": "stop_loss_order",
"stop_price": "55000",
"paid_commission": "0.5432",
"commission": "0.5432",
"reduce_only": false,
"client_order_id": "34521712",
"state": "open",
"created_at": "1725865012000000",
"product_id": 27,
"product_symbol": "BTCUSD"
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Returns back the order object with assigned id and latest state | Inline |
400 | Bad Request | Returns error if order could not be placed | ApiErrorResponse |
Response Schema
Enumerated Values
Property | Value |
---|---|
side | buy |
side | sell |
order_type | limit_order |
order_type | market_order |
stop_order_type | stop_loss_order |
reduce_only | false |
reduce_only | true |
state | open |
state | pending |
state | closed |
state | cancelled |
Cancel Order
Code samples
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.delete('https://api.india.delta.exchange/v2/orders', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X DELETE https://api.india.delta.exchange/v2/orders \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.delete 'https://api.india.delta.exchange/v2/orders',
params: {
}, headers: headers
p JSON.parse(result)
DELETE /orders
Body parameter
{
"id": 13452112,
"client_order_id": "34521712",
"product_id": 27
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
body | body | DeleteOrderRequest | true | Order which needs to be cancelled |
Example responses
200 Response
{
"success": true,
"result": {
"id": 123,
"user_id": 453671,
"size": 10,
"unfilled_size": 2,
"side": "buy",
"order_type": "limit_order",
"limit_price": "59000",
"stop_order_type": "stop_loss_order",
"stop_price": "55000",
"paid_commission": "0.5432",
"commission": "0.5432",
"reduce_only": false,
"client_order_id": "34521712",
"state": "open",
"created_at": "1725865012000000",
"product_id": 27,
"product_symbol": "BTCUSD"
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Returns back the order object | Inline |
400 | Bad Request | Returns error if order could not be cancelled | ApiErrorResponse |
Response Schema
Enumerated Values
Property | Value |
---|---|
side | buy |
side | sell |
order_type | limit_order |
order_type | market_order |
stop_order_type | stop_loss_order |
reduce_only | false |
reduce_only | true |
state | open |
state | pending |
state | closed |
state | cancelled |
Edit Order
Code samples
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.put('https://api.india.delta.exchange/v2/orders', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X PUT https://api.india.delta.exchange/v2/orders \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.put 'https://api.india.delta.exchange/v2/orders',
params: {
}, headers: headers
p JSON.parse(result)
PUT /orders
Body parameter
{
"id": 34521712,
"product_id": 27,
"product_symbol": "BTCUSD",
"limit_price": "59000",
"size": 15,
"mmp": "disabled",
"post_only": false,
"cancel_orders_accepted": false,
"stop_price": "56000",
"trail_amount": "50"
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
body | body | EditOrderRequest | true | Order which needs to be edited. Rate limits apply. |
Example responses
200 Response
{
"success": true,
"result": {
"id": 123,
"user_id": 453671,
"size": 10,
"unfilled_size": 2,
"side": "buy",
"order_type": "limit_order",
"limit_price": "59000",
"stop_order_type": "stop_loss_order",
"stop_price": "55000",
"paid_commission": "0.5432",
"commission": "0.5432",
"reduce_only": false,
"client_order_id": "34521712",
"state": "open",
"created_at": "1725865012000000",
"product_id": 27,
"product_symbol": "BTCUSD"
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Returns back the order object with assigned id and latest state | Inline |
400 | Bad Request | Returns error if order could not be placed | ApiErrorResponse |
Response Schema
Enumerated Values
Property | Value |
---|---|
side | buy |
side | sell |
order_type | limit_order |
order_type | market_order |
stop_order_type | stop_loss_order |
reduce_only | false |
reduce_only | true |
state | open |
state | pending |
state | closed |
state | cancelled |
Get Active Orders
Code samples
import requests
headers = {
'Accept': 'application/json',
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.get('https://api.india.delta.exchange/v2/orders', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X GET https://api.india.delta.exchange/v2/orders \
-H 'Accept: application/json' \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.get 'https://api.india.delta.exchange/v2/orders',
params: {
}, headers: headers
p JSON.parse(result)
GET /orders
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
product_ids | query | string | false | comma separated product ids, if not specified, all the orders will be returned |
states | query | string | false | comma separated list of states - open,pending |
contract_types | query | string | false | comma separated list of desired contract types, if not specified any parameters then, all the orders will be returned |
order_types | query | string | false | comma separated order types |
start_time | query | integer | false | from time in micro-seconds in epoc; referring to the order creation time |
end_time | query | integer | false | from time in micro-seconds in epoc; referring to the order creation time |
after | query | string | false | after cursor for pagination; becomes null if page after the current one does not exist |
before | query | string | false | before cursor for pagination; becomes null if page before the current one does not exist |
page_size | query | integer | false | number of records per page |
Enumerated Values
Parameter | Value |
---|---|
contract_types | futures |
contract_types | perpetual_futures |
contract_types | call_options |
contract_types | put_options |
order_types | market |
order_types | limit |
order_types | stop_market |
order_types | stop_limit |
order_types | all_stop |
Example responses
200 Response
{
"success": true,
"result": [
{
"id": 123,
"user_id": 453671,
"size": 10,
"unfilled_size": 2,
"side": "buy",
"order_type": "limit_order",
"limit_price": "59000",
"stop_order_type": "stop_loss_order",
"stop_price": "55000",
"paid_commission": "0.5432",
"commission": "0.5432",
"reduce_only": false,
"client_order_id": "34521712",
"state": "open",
"created_at": "1725865012000000",
"product_id": 27,
"product_symbol": "BTCUSD"
}
],
"meta": {
"after": "g3QAAAACZAAKY3JlYXRlZF9hdHQAAAAN",
"before": "a2PQRSACZAAKY3JlYXRlZF3fnqHBBBNZL"
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | List of orders as per the query | Inline |
Response Schema
Enumerated Values
Property | Value |
---|---|
side | buy |
side | sell |
order_type | limit_order |
order_type | market_order |
stop_order_type | stop_loss_order |
reduce_only | false |
reduce_only | true |
state | open |
state | pending |
state | closed |
state | cancelled |
Place Bracket order
Code samples
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.post('https://api.india.delta.exchange/v2/orders/bracket', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X POST https://api.india.delta.exchange/v2/orders/bracket \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.post 'https://api.india.delta.exchange/v2/orders/bracket',
params: {
}, headers: headers
p JSON.parse(result)
POST /orders/bracket
A bracket order is a set of TP and SL order. For a bracket order , size need not be specified as it closes the entire position. For a given contract, you can have multiple bracket orders for open orders but only a single bracket order for any open position.
Body parameter
{
"product_id": 27,
"product_symbol": "BTCUSD",
"stop_loss_order": {
"order_type": "limit_order",
"stop_price": "56000",
"trail_amount": "50",
"limit_price": "55000"
},
"take_profit_order": {
"order_type": "limit_order",
"stop_price": "65000",
"limit_price": "64000"
},
"bracket_stop_trigger_method": "last_traded_price"
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
body | body | CreateBracketOrderRequest | true | Bracket Order which needs to be updated |
Example responses
200 Response
{
"success": true
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | returns back success response | ApiSuccessResponse |
400 | Bad Request | Returns error if orders could not be updated | ApiErrorResponse |
Edit Bracket order
Code samples
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.put('https://api.india.delta.exchange/v2/orders/bracket', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X PUT https://api.india.delta.exchange/v2/orders/bracket \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.put 'https://api.india.delta.exchange/v2/orders/bracket',
params: {
}, headers: headers
p JSON.parse(result)
PUT /orders/bracket
A bracket order is a set of TP and SL order. You can specify bracket order with an order that will create a new position. Use this api to change the bracket params attached with an order.
Body parameter
{
"id": 34521712,
"product_id": 27,
"product_symbol": "BTCUSD",
"bracket_stop_loss_limit_price": "55000",
"bracket_stop_loss_price": "56000",
"bracket_take_profit_limit_price": "65000",
"bracket_take_profit_price": "64000",
"bracket_trail_amount": "50",
"bracket_stop_trigger_method": "last_traded_price"
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
body | body | EditBracketOrderRequest | true | Bracket Order which needs to be updated |
Example responses
200 Response
{
"success": true
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | returns back success response | ApiSuccessResponse |
400 | Bad Request | Returns error if orders could not be updated | ApiErrorResponse |
Cancel all open orders
Code samples
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.delete('https://api.india.delta.exchange/v2/orders/all', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X DELETE https://api.india.delta.exchange/v2/orders/all \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.delete 'https://api.india.delta.exchange/v2/orders/all',
params: {
}, headers: headers
p JSON.parse(result)
DELETE /orders/all
Cancels all orders for a given product id. If product id is not provided, it cancels orders for provided contract types. If none of them are provided, it cancels all the orders. Provide either product id or list of contract types at a time. If both are provided, contract types will be ignored.
Body parameter
{
"product_id": 27,
"contract_types": "perpetual_futures,put_options,call_options",
"cancel_limit_orders": false,
"cancel_stop_orders": false,
"cancel_reduce_only_orders": false
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
body | body | CancelAllFilterObject | false | Filters for selecting orders that needs to be cancelled |
Example responses
200 Response
{
"success": true
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | returns back success response | ApiSuccessResponse |
400 | Bad Request | Returns error if orders could not be cancelled | ApiErrorResponse |
Create batch orders
Code samples
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.post('https://api.india.delta.exchange/v2/orders/batch', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X POST https://api.india.delta.exchange/v2/orders/batch \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.post 'https://api.india.delta.exchange/v2/orders/batch',
params: {
}, headers: headers
p JSON.parse(result)
POST /orders/batch
Orders in a batch should belong to the same contract. Max allowed size limit in a batch is 50. Rate limits apply. Please note that ioc is not valid time in force values for creating batch orders.
Body parameter
[
{
"product_id": 27,
"product_symbol": "BTCUSD",
"limit_price": "59000",
"size": 10,
"side": "buy",
"order_type": "limit_order",
"time_in_force": "gtc",
"mmp": "disabled",
"post_only": false,
"client_order_id": "34521712"
}
]
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
body | body | ArrayOfBatchCreateOrderRequest | true | Does not support time_in_force flag for orders, All orders in batch create are assumed to be gtc orders. batch create does not support stop orders, it support only limit orders |
Example responses
200 Response
{
"success": true,
"result": [
{
"id": 123,
"user_id": 453671,
"size": 10,
"unfilled_size": 2,
"side": "buy",
"order_type": "limit_order",
"limit_price": "59000",
"stop_order_type": "stop_loss_order",
"stop_price": "55000",
"paid_commission": "0.5432",
"commission": "0.5432",
"reduce_only": false,
"client_order_id": "34521712",
"state": "open",
"created_at": "1725865012000000",
"product_id": 27,
"product_symbol": "BTCUSD"
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | returns the orders placed | Inline |
400 | Bad Request | returns error if orders couldnt be placed | ApiErrorResponse |
Response Schema
Enumerated Values
Property | Value |
---|---|
side | buy |
side | sell |
order_type | limit_order |
order_type | market_order |
stop_order_type | stop_loss_order |
reduce_only | false |
reduce_only | true |
state | open |
state | pending |
state | closed |
state | cancelled |
Edit batch orders
Code samples
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.put('https://api.india.delta.exchange/v2/orders/batch', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X PUT https://api.india.delta.exchange/v2/orders/batch \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.put 'https://api.india.delta.exchange/v2/orders/batch',
params: {
}, headers: headers
p JSON.parse(result)
PUT /orders/batch
Orders to be edited in a batch. Rate limits apply.
Body parameter
[
{
"id": 34521712,
"product_id": 27,
"product_symbol": "BTCUSD",
"limit_price": "59000",
"size": 15,
"mmp": "disabled",
"post_only": false
}
]
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
body | body | ArrayOfBatchEditOrderRequest | true | none |
Example responses
200 Response
{
"success": true,
"result": [
{
"id": 123,
"user_id": 453671,
"size": 10,
"unfilled_size": 2,
"side": "buy",
"order_type": "limit_order",
"limit_price": "59000",
"stop_order_type": "stop_loss_order",
"stop_price": "55000",
"paid_commission": "0.5432",
"commission": "0.5432",
"reduce_only": false,
"client_order_id": "34521712",
"state": "open",
"created_at": "1725865012000000",
"product_id": 27,
"product_symbol": "BTCUSD"
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | List of edited orders | Inline |
400 | Bad Request | returns error if orders couldnt be edited | ApiErrorResponse |
Response Schema
Enumerated Values
Property | Value |
---|---|
side | buy |
side | sell |
order_type | limit_order |
order_type | market_order |
stop_order_type | stop_loss_order |
reduce_only | false |
reduce_only | true |
state | open |
state | pending |
state | closed |
state | cancelled |
Delete batch orders
Code samples
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.delete('https://api.india.delta.exchange/v2/orders/batch', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X DELETE https://api.india.delta.exchange/v2/orders/batch \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.delete 'https://api.india.delta.exchange/v2/orders/batch',
params: {
}, headers: headers
p JSON.parse(result)
DELETE /orders/batch
Body parameter
[
{
"id": 13452112,
"client_order_id": "34521712",
"product_id": 27
}
]
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
body | body | ArrayOfDeleteOrderRequest | true | none |
Example responses
200 Response
{
"success": true,
"result": [
{
"id": 123,
"user_id": 453671,
"size": 10,
"unfilled_size": 2,
"side": "buy",
"order_type": "limit_order",
"limit_price": "59000",
"stop_order_type": "stop_loss_order",
"stop_price": "55000",
"paid_commission": "0.5432",
"commission": "0.5432",
"reduce_only": false,
"client_order_id": "34521712",
"state": "open",
"created_at": "1725865012000000",
"product_id": 27,
"product_symbol": "BTCUSD"
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | returns the orders deleted | Inline |
400 | Bad Request | returns error if orders couldnt be deleted | ApiErrorResponse |
Response Schema
Enumerated Values
Property | Value |
---|---|
side | buy |
side | sell |
order_type | limit_order |
order_type | market_order |
stop_order_type | stop_loss_order |
reduce_only | false |
reduce_only | true |
state | open |
state | pending |
state | closed |
state | cancelled |
Get Order by id
Code samples
import requests
headers = {
'Accept': 'application/json',
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.get('https://api.india.delta.exchange/v2/orders/{order_id}', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X GET https://api.india.delta.exchange/v2/orders/{order_id} \
-H 'Accept: application/json' \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.get 'https://api.india.delta.exchange/v2/orders/{order_id}',
params: {
}, headers: headers
p JSON.parse(result)
GET /orders/{order_id}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
order_id | path | string | true | Id of the order |
Example responses
200 Response
{
"success": true,
"result": {
"id": 123,
"user_id": 453671,
"size": 10,
"unfilled_size": 2,
"side": "buy",
"order_type": "limit_order",
"limit_price": "59000",
"stop_order_type": "stop_loss_order",
"stop_price": "55000",
"paid_commission": "0.5432",
"commission": "0.5432",
"reduce_only": false,
"client_order_id": "34521712",
"state": "open",
"created_at": "1725865012000000",
"product_id": 27,
"product_symbol": "BTCUSD"
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Returns back the order object with assigned id and latest state | Inline |
Response Schema
Enumerated Values
Property | Value |
---|---|
side | buy |
side | sell |
order_type | limit_order |
order_type | market_order |
stop_order_type | stop_loss_order |
reduce_only | false |
reduce_only | true |
state | open |
state | pending |
state | closed |
state | cancelled |
Get Order by client oid
Code samples
import requests
headers = {
'Accept': 'application/json',
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.get('https://api.india.delta.exchange/v2/orders/client_order_id/{client_oid}', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X GET https://api.india.delta.exchange/v2/orders/client_order_id/{client_oid} \
-H 'Accept: application/json' \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.get 'https://api.india.delta.exchange/v2/orders/client_order_id/{client_oid}',
params: {
}, headers: headers
p JSON.parse(result)
GET /orders/client_order_id/{client_oid}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
client_oid | path | string | true | Client provided order id |
Example responses
200 Response
{
"success": true,
"result": {
"id": 123,
"user_id": 453671,
"size": 10,
"unfilled_size": 2,
"side": "buy",
"order_type": "limit_order",
"limit_price": "59000",
"stop_order_type": "stop_loss_order",
"stop_price": "55000",
"paid_commission": "0.5432",
"commission": "0.5432",
"reduce_only": false,
"client_order_id": "34521712",
"state": "open",
"created_at": "1725865012000000",
"product_id": 27,
"product_symbol": "BTCUSD"
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Returns back the order object with assigned client order id and latest state | Inline |
Response Schema
Enumerated Values
Property | Value |
---|---|
side | buy |
side | sell |
order_type | limit_order |
order_type | market_order |
stop_order_type | stop_loss_order |
reduce_only | false |
reduce_only | true |
state | open |
state | pending |
state | closed |
state | cancelled |
Change order leverage
Code samples
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.post('https://api.india.delta.exchange/v2/products/{product_id}/orders/leverage', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X POST https://api.india.delta.exchange/v2/products/{product_id}/orders/leverage \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.post 'https://api.india.delta.exchange/v2/products/{product_id}/orders/leverage',
params: {
}, headers: headers
p JSON.parse(result)
POST /products/{product_id}/orders/leverage
Body parameter
{
"leverage": 10
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
product_id | path | integer | true | Product id of the ordered product |
body | body | object | true | none |
» leverage | body | string | true | Order leverage |
Example responses
200 Response
{
"success": true,
"result": {
"leverage": 10,
"order_margin": "563.2",
"product_id": 27
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | returns the OrderLeverage object | Inline |
400 | Bad Request | Returns error if leverage couldnt be changed | ApiErrorResponse |
Response Schema
Get order leverage
Code samples
import requests
headers = {
'Accept': 'application/json',
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.get('https://api.india.delta.exchange/v2/products/{product_id}/orders/leverage', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X GET https://api.india.delta.exchange/v2/products/{product_id}/orders/leverage \
-H 'Accept: application/json' \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.get 'https://api.india.delta.exchange/v2/products/{product_id}/orders/leverage',
params: {
}, headers: headers
p JSON.parse(result)
GET /products/{product_id}/orders/leverage
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
product_id | path | integer | true | Product id of the ordered product |
Example responses
200 Response
{
"success": true,
"result": {
"leverage": 10,
"order_margin": "563.2",
"product_id": 27
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | returns the OrderLeverage object | Inline |
Response Schema
Positions
Get Open positions, Change Position Margin, Close Position, Close All Position
Get margined positions
Code samples
import requests
headers = {
'Accept': 'application/json',
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.get('https://api.india.delta.exchange/v2/positions/margined', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X GET https://api.india.delta.exchange/v2/positions/margined \
-H 'Accept: application/json' \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.get 'https://api.india.delta.exchange/v2/positions/margined',
params: {
}, headers: headers
p JSON.parse(result)
GET /positions/margined
Change in position may take upto 10secs to reflect. Use 'GET /position' for real-time data.
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
product_ids | query | string | false | comma separated product ids. If not specified any parameters, all the open positions will be returned |
contract_types | query | string | false | comma separated list of desired contract types. If not specified any parameters then, all the open positions will be returned |
Enumerated Values
Parameter | Value |
---|---|
contract_types | futures |
contract_types | perpetual_futures |
contract_types | call_options |
contract_types | put_options |
Example responses
200 Response
{
"success": true,
"result": [
{
"user_id": 0,
"size": 0,
"entry_price": "string",
"margin": "string",
"liquidation_price": "string",
"bankruptcy_price": "string",
"adl_level": 0,
"product_id": 0,
"product_symbol": "string",
"commission": "string",
"realized_pnl": "string",
"realized_funding": "string"
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | List of all open positions | Inline |
Response Schema
Get position
Code samples
import requests
headers = {
'Accept': 'application/json',
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.get('https://api.india.delta.exchange/v2/positions', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X GET https://api.india.delta.exchange/v2/positions \
-H 'Accept: application/json' \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.get 'https://api.india.delta.exchange/v2/positions',
params: {
}, headers: headers
p JSON.parse(result)
GET /positions
Get real-time positions data.
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
product_id | query | integer | false | id of the product |
underlying_asset_symbol | query | string | false | Underlying asset symbol. e.g. 'BTC', 'ETH'. This gives a list of all positions in products which have the given underlying asset |
Example responses
200 Response
{
"success": true,
"result": {
"size": 0,
"entry_price": "string"
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Open position for the give product id | Inline |
Response Schema
Auto Topup
Code samples
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.put('https://api.india.delta.exchange/v2/positions/auto_topup', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X PUT https://api.india.delta.exchange/v2/positions/auto_topup \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.put 'https://api.india.delta.exchange/v2/positions/auto_topup',
params: {
}, headers: headers
p JSON.parse(result)
PUT /positions/auto_topup
Changes position auto topup flag. Positions automatically inherits auto topup flag of the account. If account level auto topop is set to false, use this api to change auto topup flag for individual positions.
Body parameter
{
"product_id": 0,
"auto_topup": "false"
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
body | body | object | true | none |
» product_id | body | integer | true | none |
» auto_topup | body | boolean | true | none |
Example responses
200 Response
{
"success": true,
"result": {
"user_id": 0,
"size": 0,
"entry_price": "string",
"margin": "string",
"liquidation_price": "string",
"bankruptcy_price": "string",
"adl_level": 0,
"product_id": 0,
"product_symbol": "string",
"commission": "string",
"realized_pnl": "string",
"realized_funding": "string"
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | returns the position object | Inline |
400 | Bad Request | Returns error if position margin could not be changed | ApiErrorResponse |
Response Schema
Add/Remove position margin
Code samples
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.post('https://api.india.delta.exchange/v2/positions/change_margin', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X POST https://api.india.delta.exchange/v2/positions/change_margin \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.post 'https://api.india.delta.exchange/v2/positions/change_margin',
params: {
}, headers: headers
p JSON.parse(result)
POST /positions/change_margin
Body parameter
{
"product_id": 0,
"delta_margin": "string"
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
body | body | object | true | none |
» product_id | body | integer | true | none |
» delta_margin | body | string | true | Delta in the position margin, positive in case of adding margin & negative in case of removing margin |
Example responses
200 Response
{
"success": true,
"result": {
"user_id": 0,
"size": 0,
"entry_price": "string",
"margin": "string",
"liquidation_price": "string",
"bankruptcy_price": "string",
"adl_level": 0,
"product_id": 0,
"product_symbol": "string",
"commission": "string",
"realized_pnl": "string",
"realized_funding": "string"
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | returns the position object | Inline |
400 | Bad Request | Returns error if position margin could not be changed | ApiErrorResponse |
Response Schema
Close all positions
Code samples
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.post('https://api.india.delta.exchange/v2/positions/close_all', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X POST https://api.india.delta.exchange/v2/positions/close_all \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.post 'https://api.india.delta.exchange/v2/positions/close_all',
params: {
}, headers: headers
p JSON.parse(result)
POST /positions/close_all
Body parameter
{
"close_all_portfolio": true,
"close_all_isolated": true,
"user_id": 0
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
body | body | object | true | none |
» close_all_portfolio | body | boolean | true | none |
» close_all_isolated | body | boolean | true | none |
» user_id | body | integer | true | none |
Example responses
200 Response
{
"success": true
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | returns back success response | ApiSuccessResponse |
400 | Bad Request | Returns error if not able to close all positions | ApiErrorResponse |
TradeHistory
Get Orders History, Get Fill History
Get order history (cancelled and closed)
Code samples
import requests
headers = {
'Accept': 'application/json',
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.get('https://api.india.delta.exchange/v2/orders/history', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X GET https://api.india.delta.exchange/v2/orders/history \
-H 'Accept: application/json' \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.get 'https://api.india.delta.exchange/v2/orders/history',
params: {
}, headers: headers
p JSON.parse(result)
GET /orders/history
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
product_ids | query | string | false | comma separated product ids |
contract_types | query | string | false | comma separated list of desired contract types |
order_types | query | string | false | comma separated order types |
start_time | query | integer | false | from time in micro-seconds in epoc |
end_time | query | integer | false | from time in micro-seconds in epoc |
after | query | string | false | after cursor for pagination |
before | query | string | false | before cursor for pagination |
page_size | query | integer | false | number of records per page |
Enumerated Values
Parameter | Value |
---|---|
order_types | market |
order_types | limit |
order_types | stop_market |
order_types | stop_limit |
order_types | all_stop |
Example responses
200 Response
{
"success": true,
"result": [
{
"id": 123,
"user_id": 453671,
"size": 10,
"unfilled_size": 2,
"side": "buy",
"order_type": "limit_order",
"limit_price": "59000",
"stop_order_type": "stop_loss_order",
"stop_price": "55000",
"paid_commission": "0.5432",
"commission": "0.5432",
"reduce_only": false,
"client_order_id": "34521712",
"state": "open",
"created_at": "1725865012000000",
"product_id": 27,
"product_symbol": "BTCUSD"
}
],
"meta": {
"after": "g3QAAAACZAAKY3JlYXRlZF9hdHQAAAAN",
"before": "a2PQRSACZAAKY3JlYXRlZF3fnqHBBBNZL"
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | List of closed and cancelled orders. Order schema | Inline |
Response Schema
Enumerated Values
Property | Value |
---|---|
side | buy |
side | sell |
order_type | limit_order |
order_type | market_order |
stop_order_type | stop_loss_order |
reduce_only | false |
reduce_only | true |
state | open |
state | pending |
state | closed |
state | cancelled |
GET user fills by filters
Code samples
import requests
headers = {
'Accept': 'application/json',
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.get('https://api.india.delta.exchange/v2/fills', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X GET https://api.india.delta.exchange/v2/fills \
-H 'Accept: application/json' \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.get 'https://api.india.delta.exchange/v2/fills',
params: {
}, headers: headers
p JSON.parse(result)
GET /fills
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
product_ids | query | string | false | comma separated product ids |
contract_types | query | string | false | comma separated list of desired contract types |
start_time | query | integer | false | from time in micro-seconds in epoc |
end_time | query | integer | false | from time in micro-seconds in epoc |
after | query | string | false | after cursor for pagination |
before | query | string | false | before cursor for pagination |
page_size | query | integer | false | number of records per page |
Example responses
200 Response
{
"success": true,
"result": [
{
"id": 0,
"size": 0,
"fill_type": "normal",
"side": "buy",
"price": "string",
"role": "taker",
"commission": "string",
"created_at": "string",
"product_id": 0,
"product_symbol": "string",
"order_id": "string",
"settling_asset_id": 0,
"settling_asset_symbol": "string",
"meta_data": {
"commission_deto": "string",
"commission_deto_in_settling_asset": "string",
"effective_commission_rate": "string",
"liquidation_fee_deto": "string",
"liquidation_fee_deto_in_settling_asset": "string",
"order_price": "string",
"order_size": "string",
"order_type": "string",
"order_unfilled_size": "string",
"tfc_used_for_commission": "string",
"tfc_used_for_liquidation_fee": "string",
"total_commission_in_settling_asset": "string",
"total_liquidation_fee_in_settling_asset": "string"
}
}
],
"meta": {
"after": "g3QAAAACZAAKY3JlYXRlZF9hdHQAAAAN",
"before": "a2PQRSACZAAKY3JlYXRlZF3fnqHBBBNZL"
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Array of fills | Inline |
Response Schema
Enumerated Values
Property | Value |
---|---|
fill_type | normal |
fill_type | adl |
fill_type | liquidation |
fill_type | settlement |
fill_type | otc |
side | buy |
side | sell |
role | taker |
role | maker |
Download Fills history
Code samples
import requests
headers = {
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.get('https://api.india.delta.exchange/v2/fills/history/download/csv', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X GET https://api.india.delta.exchange/v2/fills/history/download/csv \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.get 'https://api.india.delta.exchange/v2/fills/history/download/csv',
params: {
}, headers: headers
p JSON.parse(result)
GET /fills/history/download/csv
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
product_ids | query | string | false | comma separated product ids |
contract_types | query | string | false | comma separated list of desired contract types |
start_time | query | integer | false | from time in micro-seconds in epoc |
end_time | query | integer | false | from time in micro-seconds in epoc |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | csv of fills for the filter query | None |
Orderbook
L2Orderbook
Get L2 orderbook
Code samples
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('https://api.india.delta.exchange/v2/l2orderbook/{symbol}', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X GET https://api.india.delta.exchange/v2/l2orderbook/{symbol} \
-H 'Accept: application/json'
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'https://api.india.delta.exchange/v2/l2orderbook/{symbol}',
params: {
}, headers: headers
p JSON.parse(result)
GET /l2orderbook/{symbol}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
symbol | path | string | true | none |
depth | query | integer | false | number of levels on each side |
Example responses
200 Response
{
"success": true,
"result": {
"buy": [
{
"depth": "983",
"price": "9187.5",
"size": 205640
}
],
"last_updated_at": 1654589595784000,
"sell": [
{
"depth": "1185",
"price": "9188.0",
"size": 113752
}
],
"symbol": "BTCUSD"
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | L2 orderbook for the product | Inline |
Response Schema
Trades
Get Trades of a contract
Get public trades
Code samples
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('https://api.india.delta.exchange/v2/trades/{symbol}', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X GET https://api.india.delta.exchange/v2/trades/{symbol} \
-H 'Accept: application/json'
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'https://api.india.delta.exchange/v2/trades/{symbol}',
params: {
}, headers: headers
p JSON.parse(result)
GET /trades/{symbol}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
symbol | path | string | true | none |
Example responses
200 Response
{
"success": true,
"result": {
"trades": [
{
"side": "buy",
"size": 0,
"price": "string",
"timestamp": 0
}
]
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | List of recent trades of the product | Inline |
Response Schema
Enumerated Values
Property | Value |
---|---|
side | buy |
side | sell |
Wallet
Get balances, Get transaction history
Get Wallet Balances
Code samples
import requests
headers = {
'Accept': 'application/json',
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.get('https://api.india.delta.exchange/v2/wallet/balances', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X GET https://api.india.delta.exchange/v2/wallet/balances \
-H 'Accept: application/json' \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.get 'https://api.india.delta.exchange/v2/wallet/balances',
params: {
}, headers: headers
p JSON.parse(result)
GET /wallet/balances
Example responses
200 Response
{
"meta": {
"net_equity": "string",
"robo_trading_equity": "string"
},
"result": [
{
"asset_id": 0,
"asset_symbol": "string",
"available_balance": "string",
"available_balance_for_robo": "string",
"balance": "string",
"blocked_margin": "string",
"commission": "string",
"cross_asset_liability": "string",
"cross_commission": "string",
"cross_locked_collateral": "string",
"cross_order_margin": "string",
"cross_position_margin": "string",
"id": 0,
"interest_credit": "string",
"order_margin": "string",
"pending_referral_bonus": "string",
"pending_trading_fee_credit": "string",
"portfolio_margin": "string",
"position_margin": "string",
"trading_fee_credit": "string",
"unvested_amount": "string",
"user_id": 0
}
],
"success": true
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | List of wallets attached to the user account | WalletPayload |
Get Wallet transactions
Code samples
import requests
headers = {
'Accept': 'application/json',
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.get('https://api.india.delta.exchange/v2/wallet/transactions', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X GET https://api.india.delta.exchange/v2/wallet/transactions \
-H 'Accept: application/json' \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.get 'https://api.india.delta.exchange/v2/wallet/transactions',
params: {
}, headers: headers
p JSON.parse(result)
GET /wallet/transactions
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
asset_ids | query | integer | false | comma separated list of asset_ids for which to get txns logs |
start_time | query | integer | false | from time in micro-seconds in epoc |
end_time | query | integer | false | from time in micro-seconds in epoc |
after | query | string | false | after cursor for pagination |
before | query | string | false | before cursor for pagination |
page_size | query | integer | false | number of records per page |
transaction_types | query | TransactionTypes | false | transaction types to retrieve |
Example responses
200 Response
{
"success": true,
"result": [
{
"id": 0,
"amount": "string",
"balance": "string",
"transaction_type": "string",
"meta_data": {},
"product_id": 0,
"asset_id": 0,
"asset_symbol": 0,
"created_at": "string"
}
],
"meta": {
"after": "g3QAAAACZAAKY3JlYXRlZF9hdHQAAAAN",
"before": "a2PQRSACZAAKY3JlYXRlZF3fnqHBBBNZL"
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | list of Wallet transactions | Inline |
Response Schema
Enumerated Values
Property | Value |
---|---|
transaction_type | cashflow |
transaction_type | deposit |
transaction_type | withdrawal |
transaction_type | commission |
transaction_type | conversion |
transaction_type | funding |
transaction_type | settlement |
transaction_type | liquidation_fee |
transaction_type | spot_trade |
transaction_type | withdrawal_cancellation |
transaction_type | referral_bonus |
transaction_type | sub_account_transfer |
transaction_type | commission_rebate |
transaction_type | promo_credit |
transaction_type | trading_credits |
transaction_type | trading_credits_forfeited |
transaction_type | trading_credits_paid |
transaction_type | trading_fee_credits_paid_liquidation_fee |
transaction_type | trading_credits_reverted |
transaction_type | interest_credit |
transaction_type | external_deposit |
transaction_type | credit_line |
transaction_type | trading_competition |
transaction_type | fund_deposit |
transaction_type | fund_withdrawal |
transaction_type | fund_wallet_deposit |
transaction_type | fund_wallet_withdrawal |
transaction_type | fund_reward |
transaction_type | trade_farming_reward |
transaction_type | interest_credit |
transaction_type | revert |
transaction_type | raf_bonus |
transaction_type | fill_appropriation |
transaction_type | incident_compensation |
Download Wallet transactions
Code samples
import requests
headers = {
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.get('https://api.india.delta.exchange/v2/wallet/transactions/download', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X GET https://api.india.delta.exchange/v2/wallet/transactions/download \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.get 'https://api.india.delta.exchange/v2/wallet/transactions/download',
params: {
}, headers: headers
p JSON.parse(result)
GET /wallet/transactions/download
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
asset_ids | query | integer | false | comma separated list of asset_ids |
start_time | query | integer | false | from time in micro-seconds in epoc |
end_time | query | integer | false | from time in micro-seconds in epoc |
after | query | string | false | after cursor for pagination |
before | query | string | false | before cursor for pagination |
page_size | query | integer | false | number of records per page |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | csv of transactions for that wallet | None |
Request asset transfer
Code samples
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.post('https://api.india.delta.exchange/v2/wallets/sub_account_balance_transfer', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X POST https://api.india.delta.exchange/v2/wallets/sub_account_balance_transfer \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.post 'https://api.india.delta.exchange/v2/wallets/sub_account_balance_transfer',
params: {
}, headers: headers
p JSON.parse(result)
POST /wallets/sub_account_balance_transfer
This api transfers asset from one subaccount to another subaccount or to the main/parent account. Please ensure that the subaccounts involved in the transfer should belong to the same parent account. Requests to transfer assets across subaccounts that belong to different parent accounts will fail. Please make sure that the api key used to make this api request belongs to the main/parent account.
Body parameter
{
"transferrer_user_id": "string",
"transferee_user_id": "string",
"asset_symbol": "string",
"amount": null
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
body | body | AssetTransferSubaccountReq | true | none |
Example responses
200 Response
{
"success": true,
"result": null
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Returns success message | Inline |
400 | Bad Request | Returns error code | ApiErrorResponse |
Response Schema
Request subaccount balance transfer history.
Code samples
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.get('https://api.india.delta.exchange/v2/wallets/sub_accounts_transfer_history', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X GET https://api.india.delta.exchange/v2/wallets/sub_accounts_transfer_history \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.get 'https://api.india.delta.exchange/v2/wallets/sub_accounts_transfer_history',
params: {
}, headers: headers
p JSON.parse(result)
GET /wallets/sub_accounts_transfer_history
This api returns the wallet balance transfers for subaccounts belonging to the parent/main account of an api user. Make sure you are calling this api from the main account. If no subaccount is mentioned in the request, data for all the subacounts will be returned. Use page size to get more entries in a single request.
Body parameter
{
"subaccount_user_id": "string",
"before": "string",
"after": "string",
"page_size": 10
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
body | body | SubaccountTransferHistory | true | none |
Example responses
200 Response
{
"success": true,
"result": [
{
"transferrer_user_id": "string",
"transferee_user_id": "string",
"asset_symbol": "string",
"amount": null,
"created_at": "string",
"transferee_user": {},
"transferrer_user": {}
}
],
"meta": {
"after": "g3QAAAACZAAKY3JlYXRlZF9hdHQAAAAN",
"before": "a2PQRSACZAAKY3JlYXRlZF3fnqHBBBNZL"
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Returns success message | Inline |
400 | Bad Request | Returns error code | ApiErrorResponse |
Response Schema
Stats
Get Volume Stats
Get volume stats
Code samples
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('https://api.india.delta.exchange/v2/stats', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X GET https://api.india.delta.exchange/v2/stats \
-H 'Accept: application/json'
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'https://api.india.delta.exchange/v2/stats',
params: {
}, headers: headers
p JSON.parse(result)
GET /stats
Example responses
200 Response
{
"success": true,
"result": {
"last_30_days_volume": 0,
"last_7_days_volume": 0,
"total_volume": 0
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | sum of turnover in the last 7 and 30 days along with Total Volume in the last 24 hours (in USD) | Inline |
Response Schema
MMP
Market maker protection
Update MMP config
Code samples
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.put('https://api.india.delta.exchange/v2/users/update_mmp', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X PUT https://api.india.delta.exchange/v2/users/update_mmp \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.put 'https://api.india.delta.exchange/v2/users/update_mmp',
params: {
}, headers: headers
p JSON.parse(result)
PUT /users/update_mmp
Channel provides updates when MMP is triggered. Market maker protection is available to registered market makers by default. Others can reach out to support for getting access to MMP. More info here.
Body parameter
{
"asset": "string",
"window_interval": 0,
"freeze_interval": 0,
"trade_limit": "string",
"delta_limit": "string",
"vega_limit": "string",
"mmp": "mmp1"
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
body | body | MMPConfigUpdateRequest | true | mmp config for a given underlying asset |
Example responses
200 Response
{
"success": true,
"result": {
"user_id": 0,
"default_auto_topup": true,
"mmp_config": {},
"deto_for_commission": true,
"vip_level": 0
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Returns back the User Preference which contains mmp config | Inline |
400 | Bad Request | Returns error if mmp is not enabled on the account | ApiErrorResponse |
Response Schema
Reset MMP
Code samples
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.put('https://api.india.delta.exchange/v2/users/reset_mmp', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X PUT https://api.india.delta.exchange/v2/users/reset_mmp \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.put 'https://api.india.delta.exchange/v2/users/reset_mmp',
params: {
}, headers: headers
p JSON.parse(result)
PUT /users/reset_mmp
Body parameter
{
"asset": "string",
"mmp": "mmp1"
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
body | body | MMPResetRequest | true | reset mmp config for a given underlying asset |
Example responses
200 Response
{
"success": true
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Returns back the User Preference which contains mmp config | ApiSuccessResponse |
400 | Bad Request | Returns error if mmp is not enabled on the account | ApiErrorResponse |
Dead Man's Switch (Auto Cancel)
Set up timers for auto orders cancel in case of network malfunctions
Cancel After
Code samples
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.post('https://api.india.delta.exchange/v2/orders/cancel_after', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X POST https://api.india.delta.exchange/v2/orders/cancel_after \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.post 'https://api.india.delta.exchange/v2/orders/cancel_after',
params: {
}, headers: headers
p JSON.parse(result)
POST /orders/cancel_after
Body parameter
{
"cancel_after": "5000"
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
body | body | CancelAfterRequest | true | cancel after details |
Example responses
200 Response
{
"success": true,
"result": {
"cancel_after_enabled": "true",
"cancel_after_timestamp": "1669119262000"
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Returns back the cancel_after configs set | Inline |
400 | Bad Request | Returns if configs couldnt be set | ApiErrorResponse |
Response Schema
Enumerated Values
Property | Value |
---|---|
cancel_after_enabled | false |
cancel_after_enabled | true |
Account
Account level settings
Get users trading preferences
Code samples
import requests
headers = {
'Accept': 'application/json',
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.get('https://api.india.delta.exchange/v2/users/trading_preferences', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X GET https://api.india.delta.exchange/v2/users/trading_preferences \
-H 'Accept: application/json' \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.get 'https://api.india.delta.exchange/v2/users/trading_preferences',
params: {
}, headers: headers
p JSON.parse(result)
GET /users/trading_preferences
Example responses
200 Response
{
"success": true,
"result": {
"user_id": 0,
"default_auto_topup": true,
"mmp_config": {},
"deto_for_commission": true,
"vip_level": 0
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | User trading preferences attached to the account | Inline |
Response Schema
Get subaccounts
Code samples
import requests
headers = {
'Accept': 'application/json',
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.get('https://api.india.delta.exchange/v2/sub_accounts', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X GET https://api.india.delta.exchange/v2/sub_accounts \
-H 'Accept: application/json' \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.get 'https://api.india.delta.exchange/v2/sub_accounts',
params: {
}, headers: headers
p JSON.parse(result)
GET /sub_accounts
This api returns all the subaccounts belonging to the same parent/main user. Make sure to call this api from the parent user.
Example responses
200 Response
{
"success": true,
"result": [
{
"id": null,
"email": "string",
"account_name": "string",
"first_name": "string",
"last_name": "string",
"dob": "string",
"country": "string",
"phone_number": "string",
"margin_mode": "string",
"pf_index_symbol": "string",
"is_sub_account": true,
"is_kyc_done": true
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Subaccounts belonging to the same parent account. | Inline |
Response Schema
Get user
Code samples
import requests
headers = {
'Accept': 'application/json',
'api-key': '****',
'signature': '****',
'timestamp': '****'
}
r = requests.get('https://api.india.delta.exchange/v2/profile', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X GET https://api.india.delta.exchange/v2/profile \
-H 'Accept: application/json' \
-H 'api-key: ****' \
-H 'signature: ****' \
-H 'timestamp: ****'
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'api-key' => '****',
'signature' => '****',
'timestamp' => '****'
}
result = RestClient.get 'https://api.india.delta.exchange/v2/profile',
params: {
}, headers: headers
p JSON.parse(result)
GET /profile
This api returns the user object.
Example responses
200 Response
{
"success": true,
"result": {
"id": null,
"email": "string",
"account_name": "string",
"first_name": "string",
"last_name": "string",
"dob": "string",
"country": "string",
"phone_number": "string",
"margin_mode": "string",
"pf_index_symbol": "string",
"is_sub_account": true,
"is_kyc_done": true
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | User Object | Inline |
Response Schema
Settlement Prices
Get product settlement prices
Code samples
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('https://api.india.delta.exchange/v2/products/?states=expired', params={
}, headers = headers)
print r.json()
# You can also use wget
curl -X GET https://api.india.delta.exchange/v2/products/?states=expired \
-H 'Accept: application/json'
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'https://api.india.delta.exchange/v2/products/?states=expired',
params: {
}, headers: headers
p JSON.parse(result)
GET /products/?states=expired
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
states | query | string | false | Comma separated list of states e.g. to get expired contracts https://api.india.delta.exchange/v2/products?contract_types=call_options&states=expired |
page_size | query | string | false | size of a single page for paginated request, default: 100 |
Example responses
200 Response
{
"success": true,
"result": {
"id": 27,
"symbol": "BTCUSD",
"description": "Bitcoin Perpetual futures, quoted, settled & margined in US Dollar",
"created_at": "2023-12-18T13:10:39Z",
"updated_at": "2024-11-15T02:47:50Z",
"settlement_time": null,
"notional_type": "vanilla",
"impact_size": 10000,
"initial_margin": "0.5",
"maintenance_margin": "0.25",
"contract_value": "0.001",
"contract_unit_currency": "BTC",
"tick_size": "0.5",
"product_specs": {
"funding_clamp_value": 0.05,
"only_reduce_only_orders_allowed": false,
"tags": [
"layer_1"
]
},
"state": "live",
"trading_status": "operational",
"max_leverage_notional": "100000",
"default_leverage": "200",
"initial_margin_scaling_factor": "0.0000025",
"maintenance_margin_scaling_factor": "0.00000125",
"taker_commission_rate": "0.0005",
"maker_commission_rate": "0.0002",
"liquidation_penalty_factor": "0.5",
"contract_type": "perpetual_futures",
"position_size_limit": 229167,
"basis_factor_max_limit": "10.95",
"is_quanto": false,
"funding_method": "mark_price",
"annualized_funding": "10.95",
"price_band": "2.5",
"underlying_asset": {
"id": 14,
"symbol": "USD",
"precision": 8,
"deposit_status": "enabled",
"withdrawal_status": "enabled",
"base_withdrawal_fee": "0.000000000000000000",
"min_withdrawal_amount": "0.000000000000000000"
},
"quoting_asset": {
"id": 14,
"symbol": "USD",
"precision": 8,
"deposit_status": "enabled",
"withdrawal_status": "enabled",
"base_withdrawal_fee": "0.000000000000000000",
"min_withdrawal_amount": "0.000000000000000000"
},
"settling_asset": {
"id": 14,
"symbol": "USD",
"precision": 8,
"deposit_status": "enabled",
"withdrawal_status": "enabled",
"base_withdrawal_fee": "0.000000000000000000",
"min_withdrawal_amount": "0.000000000000000000"
},
"spot_index": {
"id": 14,
"symbol": ".DEXBTUSD",
"constituent_exchanges": [
{
"name": "ExchangeA",
"weight": 0.25
}
],
"underlying_asset_id": 13,
"quoting_asset_id": 14,
"tick_size": "0.5",
"index_type": "spot_pair"
}
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | List of products | Inline |
Response Schema
Enumerated Values
Property | Value |
---|---|
notional_type | vanilla |
notional_type | inverse |
state | live |
state | expired |
state | upcoming |
trading_status | operational |
trading_status | disrupted_cancel_only |
trading_status | disrupted_post_only |
deposit_status | enabled |
deposit_status | disabled |
withdrawal_status | enabled |
withdrawal_status | disabled |
index_type | spot_pair |
index_type | fixed_interest_rate |
index_type | floating_interest_rate |
Historical OHLC Candles/Sparklines
GET historical ohlc candles
Code samples
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('https://api.india.delta.exchange/v2/history/candles', params={
'resolution': '5m', 'symbol': 'BTCUSD', 'start': '1685618835', 'end': '1722511635'
}, headers = headers)
print r.json()
# You can also use wget
curl -X GET https://api.india.delta.exchange/v2/history/candles?resolution=5m&symbol=BTCUSD&start=1685618835&end=1722511635 \
-H 'Accept: application/json'
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'https://api.india.delta.exchange/v2/history/candles',
params: {
'resolution' => '5m',
'symbol' => 'BTCUSD',
'start' => '1685618835',
'end' => '1722511635'
}, headers: headers
p JSON.parse(result)
GET /history/candles
It returns historical Open-High-Low-Close(ohlc) candles data of the symbol as per input values for resolution, start time and end time. Also, it can return only upto 2000 candles maximum in a response.
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
resolution | query | string | true | ohlc candle time frames like 1m, 5m, 1h |
symbol | query | string | true | To get funding history pass symbol as FUNDING:${symbol}, mark price MARK:${symbol} and OI data OI:${symbol} for e.g. - FUNDING:BTCUSD, MARK:C-BTC-66400-010824, OI:ETHUSD |
start | query | integer | true | Start time: unix timestamp in seconds |
end | query | integer | true | End time: unix timestamp in seconds |
Enumerated Values
Parameter | Value |
---|---|
resolution | 1m |
resolution | 3m |
resolution | 5m |
resolution | 15m |
resolution | 30m |
resolution | 1h |
resolution | 2h |
resolution | 4h |
resolution | 6h |
resolution | 1d |
resolution | 7d |
resolution | 30d |
resolution | 1w |
resolution | 2w |
Example responses
200 Response
{
"success": true,
"result": [
{
"time": 0,
"open": 0,
"high": 0,
"low": 0,
"close": 0,
"volume": 0
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | ohlc | Inline |
Response Schema
GET product history sparklines
Code samples
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('https://api.india.delta.exchange/v2/history/sparklines', params={
'symbols': 'ETHUSD,MARK:BTCUSD'
}, headers = headers)
print r.json()
# You can also use wget
curl -X GET https://api.india.delta.exchange/v2/history/sparklines?symbols=ETHUSD%2CMARK%3ABTCUSD \
-H 'Accept: application/json'
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'https://api.india.delta.exchange/v2/history/sparklines',
params: {
'symbols' => 'ETHUSD,MARK:BTCUSD'
}, headers: headers
p JSON.parse(result)
GET /history/sparklines
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
symbols | query | string | true | comma separated product symbols |
Example responses
200 Response
{
"success": true,
"result": {
"ETHUSD": [
[
1594214051,
0.00003826
],
[
1594214051,
0.00003826
]
],
"MARK:BTCUSD": [
[
1594215270,
0.00003826
]
]
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | product history sparkline | Inline |
Response Schema
Schemas
ApiSuccessResponse
{
"success": true
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
success | boolean | false | none | none |
ApiErrorResponse
{
"success": false,
"error": {}
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
success | boolean | false | none | none |
error | object | false | none | none |
Index
{
"id": 14,
"symbol": ".DEXBTUSD",
"constituent_exchanges": [
{
"name": "ExchangeA",
"weight": 0.25
}
],
"underlying_asset_id": 13,
"quoting_asset_id": 14,
"tick_size": "0.5",
"index_type": "spot_pair"
}
Details of an index used in trading, including its constituents and characteristics.
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | integer(int64) | false | none | Unique identifier for the index. |
symbol | string | false | none | Symbol representing the index, typically prefixed by '.DE' followed by base asset and quoting asset. |
constituent_exchanges | [object] | false | none | Details of constituent exchanges, including their names and weights in the index. |
» name | string | false | none | Name of the constituent exchange. |
» weight | number | false | none | Weight of the exchange in the index. |
underlying_asset_id | integer | false | none | ID of the underlying asset for the index. |
quoting_asset_id | integer | false | none | ID of the quoting asset for the index. |
tick_size | string | false | none | Precision of the spot price in decimal format. |
index_type | string | false | none | Type of the index. |
Enumerated Values
Property | Value |
---|---|
index_type | spot_pair |
index_type | fixed_interest_rate |
index_type | floating_interest_rate |
ArrayOfIndices
[
{
"id": 14,
"symbol": ".DEXBTUSD",
"constituent_exchanges": [
{
"name": "ExchangeA",
"weight": 0.25
}
],
"underlying_asset_id": 13,
"quoting_asset_id": 14,
"tick_size": "0.5",
"index_type": "spot_pair"
}
]
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [Index] | false | none | [Details of an index used in trading, including its constituents and characteristics.] |
ProductSpecs
{
"funding_clamp_value": 0.05,
"only_reduce_only_orders_allowed": false,
"tags": [
"layer_1"
]
}
Specifications related to the specific product or contract.
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
funding_clamp_value | number | false | none | The maximum allowable funding rate clamp value. |
only_reduce_only_orders_allowed | boolean | false | none | Indicates whether only reduce-only orders are allowed. |
tags | [string] | false | none | Tags associated with the product specifications. |
Asset
{
"id": 14,
"symbol": "USD",
"precision": 8,
"deposit_status": "enabled",
"withdrawal_status": "enabled",
"base_withdrawal_fee": "0.000000000000000000",
"min_withdrawal_amount": "0.000000000000000000"
}
Details of the asset used in the product or contract.
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | integer(int64) | false | none | Unique identifier for the asset. |
symbol | string | false | none | Symbol representing the asset. |
precision | integer | false | none | Number of decimal places supported for the asset. |
deposit_status | string | false | none | Indicates if deposits are enabled for the asset. |
withdrawal_status | string | false | none | Indicates if withdrawals are enabled for the asset. |
base_withdrawal_fee | string | false | none | Fixed withdrawal fee for the asset. |
min_withdrawal_amount | string | false | none | Minimum allowable withdrawal amount for the asset. |
Enumerated Values
Property | Value |
---|---|
deposit_status | enabled |
deposit_status | disabled |
withdrawal_status | enabled |
withdrawal_status | disabled |
ArrayOfAssets
[
{
"id": 14,
"symbol": "USD",
"precision": 8,
"deposit_status": "enabled",
"withdrawal_status": "enabled",
"base_withdrawal_fee": "0.000000000000000000",
"min_withdrawal_amount": "0.000000000000000000"
}
]
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [Asset] | false | none | [Details of the asset used in the product or contract.] |
Product
{
"id": 27,
"symbol": "BTCUSD",
"description": "Bitcoin Perpetual futures, quoted, settled & margined in US Dollar",
"created_at": "2023-12-18T13:10:39Z",
"updated_at": "2024-11-15T02:47:50Z",
"settlement_time": null,
"notional_type": "vanilla",
"impact_size": 10000,
"initial_margin": "0.5",
"maintenance_margin": "0.25",
"contract_value": "0.001",
"contract_unit_currency": "BTC",
"tick_size": "0.5",
"product_specs": {
"funding_clamp_value": 0.05,
"only_reduce_only_orders_allowed": false,
"tags": [
"layer_1"
]
},
"state": "live",
"trading_status": "operational",
"max_leverage_notional": "100000",
"default_leverage": "200",
"initial_margin_scaling_factor": "0.0000025",
"maintenance_margin_scaling_factor": "0.00000125",
"taker_commission_rate": "0.0005",
"maker_commission_rate": "0.0002",
"liquidation_penalty_factor": "0.5",
"contract_type": "perpetual_futures",
"position_size_limit": 229167,
"basis_factor_max_limit": "10.95",
"is_quanto": false,
"funding_method": "mark_price",
"annualized_funding": "10.95",
"price_band": "2.5",
"underlying_asset": {
"id": 14,
"symbol": "USD",
"precision": 8,
"deposit_status": "enabled",
"withdrawal_status": "enabled",
"base_withdrawal_fee": "0.000000000000000000",
"min_withdrawal_amount": "0.000000000000000000"
},
"quoting_asset": {
"id": 14,
"symbol": "USD",
"precision": 8,
"deposit_status": "enabled",
"withdrawal_status": "enabled",
"base_withdrawal_fee": "0.000000000000000000",
"min_withdrawal_amount": "0.000000000000000000"
},
"settling_asset": {
"id": 14,
"symbol": "USD",
"precision": 8,
"deposit_status": "enabled",
"withdrawal_status": "enabled",
"base_withdrawal_fee": "0.000000000000000000",
"min_withdrawal_amount": "0.000000000000000000"
},
"spot_index": {
"id": 14,
"symbol": ".DEXBTUSD",
"constituent_exchanges": [
{
"name": "ExchangeA",
"weight": 0.25
}
],
"underlying_asset_id": 13,
"quoting_asset_id": 14,
"tick_size": "0.5",
"index_type": "spot_pair"
}
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | integer(int64) | false | none | Unique identifier of a product or contract. |
symbol | string | false | none | Symbol of the product or contract like BTCUSD, ETHUSD. |
description | string | false | none | Detailed description of the product or contract. |
created_at | string | false | none | Creation timestamp of the product or contract. |
updated_at | string | false | none | Last update timestamp of the product or contract. |
settlement_time | string | false | none | Settlement timestamp for futures contracts. |
notional_type | string | false | none | Type of notional calculation. |
impact_size | integer | false | none | Size of a typical trade used for mark price computation. |
initial_margin | string | false | none | Margin required to open a position. |
maintenance_margin | string | false | none | Minimum margin required to maintain a position. |
contract_value | string | false | none | Notional value of the contract (spot price x contract amount). |
contract_unit_currency | string | false | none | Unit of the contract (underlying asset or settling asset). |
tick_size | string | false | none | Minimum price interval between two successive prices. |
product_specs | ProductSpecs | false | none | Specifications related to the specific product or contract. |
state | string | false | none | Current state of the product. |
trading_status | string | false | none | Trading status of the contract. |
max_leverage_notional | string | false | none | Maximum notional position size at the highest leverage. |
default_leverage | string | false | none | Default leverage assigned to the product. |
initial_margin_scaling_factor | string | false | none | Scaling factor for initial margin. |
maintenance_margin_scaling_factor | string | false | none | Scaling factor for maintenance margin. |
taker_commission_rate | string | false | none | Commission rate for taker trades. |
maker_commission_rate | string | false | none | Commission rate for maker trades. |
liquidation_penalty_factor | string | false | none | Factor used to calculate liquidation penalty. |
contract_type | string | false | none | Type of contract (e.g., futures, perpetual). |
position_size_limit | integer | false | none | Maximum size for a single contract order. |
basis_factor_max_limit | string | false | none | Maximum value for annualized basis. |
is_quanto | boolean | false | none | Indicates if the contract is quanto. |
funding_method | string | false | none | Method used for funding calculation. |
annualized_funding | string | false | none | Maximum allowed annualized funding rate. |
price_band | string | false | none | Price range allowed around the mark price (percentage). |
underlying_asset | Asset | false | none | Details of the asset used in the product or contract. |
quoting_asset | Asset | false | none | Details of the asset used in the product or contract. |
settling_asset | Asset | false | none | Details of the asset used in the product or contract. |
spot_index | Index | false | none | Details of an index used in trading, including its constituents and characteristics. |
Enumerated Values
Property | Value |
---|---|
notional_type | vanilla |
notional_type | inverse |
state | live |
state | expired |
state | upcoming |
trading_status | operational |
trading_status | disrupted_cancel_only |
trading_status | disrupted_post_only |
ProductCategories
{
"PutOptions": "string",
"CallOptions": "string",
"MoveOptions": "string",
"Spot": "string",
"Futures": "string",
"Perpetual Futures": "string"
}
List of all the product category names on delta exchange. Please refer to this list while subscribing to various public and private channels on delta exchange websocket
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
PutOptions | string | false | none | put_options |
CallOptions | string | false | none | call_options |
MoveOptions | string | false | none | move_options |
Spot | string | false | none | spot |
Futures | string | false | none | futures |
Perpetual Futures | string | false | none | perpetual_futures |
ArrayOfProducts
[
{
"id": 27,
"symbol": "BTCUSD",
"description": "Bitcoin Perpetual futures, quoted, settled & margined in US Dollar",
"created_at": "2023-12-18T13:10:39Z",
"updated_at": "2024-11-15T02:47:50Z",
"settlement_time": null,
"notional_type": "vanilla",
"impact_size": 10000,
"initial_margin": "0.5",
"maintenance_margin": "0.25",
"contract_value": "0.001",
"contract_unit_currency": "BTC",
"tick_size": "0.5",
"product_specs": {
"funding_clamp_value": 0.05,
"only_reduce_only_orders_allowed": false,
"tags": [
"layer_1"
]
},
"state": "live",
"trading_status": "operational",
"max_leverage_notional": "100000",
"default_leverage": "200",
"initial_margin_scaling_factor": "0.0000025",
"maintenance_margin_scaling_factor": "0.00000125",
"taker_commission_rate": "0.0005",
"maker_commission_rate": "0.0002",
"liquidation_penalty_factor": "0.5",
"contract_type": "perpetual_futures",
"position_size_limit": 229167,
"basis_factor_max_limit": "10.95",
"is_quanto": false,
"funding_method": "mark_price",
"annualized_funding": "10.95",
"price_band": "2.5",
"underlying_asset": {
"id": 14,
"symbol": "USD",
"precision": 8,
"deposit_status": "enabled",
"withdrawal_status": "enabled",
"base_withdrawal_fee": "0.000000000000000000",
"min_withdrawal_amount": "0.000000000000000000"
},
"quoting_asset": {
"id": 14,
"symbol": "USD",
"precision": 8,
"deposit_status": "enabled",
"withdrawal_status": "enabled",
"base_withdrawal_fee": "0.000000000000000000",
"min_withdrawal_amount": "0.000000000000000000"
},
"settling_asset": {
"id": 14,
"symbol": "USD",
"precision": 8,
"deposit_status": "enabled",
"withdrawal_status": "enabled",
"base_withdrawal_fee": "0.000000000000000000",
"min_withdrawal_amount": "0.000000000000000000"
},
"spot_index": {
"id": 14,
"symbol": ".DEXBTUSD",
"constituent_exchanges": [
{
"name": "ExchangeA",
"weight": 0.25
}
],
"underlying_asset_id": 13,
"quoting_asset_id": 14,
"tick_size": "0.5",
"index_type": "spot_pair"
}
}
]
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [Product] | false | none | none |
Order
{
"id": 123,
"user_id": 453671,
"size": 10,
"unfilled_size": 2,
"side": "buy",
"order_type": "limit_order",
"limit_price": "59000",
"stop_order_type": "stop_loss_order",
"stop_price": "55000",
"paid_commission": "0.5432",
"commission": "0.5432",
"reduce_only": false,
"client_order_id": "34521712",
"state": "open",
"created_at": "1725865012000000",
"product_id": 27,
"product_symbol": "BTCUSD"
}
An Order object
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | integer | false | none | Genraeted order id |
user_id | integer | false | none | Client id |
size | integer | false | none | Order size |
unfilled_size | integer | false | none | Order size which is not filled yet |
side | string | false | none | Side for which to place order |
order_type | string | false | none | Order type - limit_order/market_order |
limit_price | string | false | none | Price level on which order must be triggered |
stop_order_type | string | false | none | Stop order type - stop loss or take profit |
stop_price | string | false | none | Stop price level for the stop order |
paid_commission | string | false | none | Commission paid for filled order |
commission | string | false | none | Commission blocked for order |
reduce_only | string | false | none | if set, will only close positions. New orders will not be placed |
client_order_id | string | false | none | client order id provided by the user while creating order |
state | string | false | none | Order Status |
created_at | string | false | none | Created at unix timestamp of the order in micro seconds |
product_id | integer | false | none | Product id of the ordered product |
product_symbol | string | false | none | Product symbol of the ordered product |
Enumerated Values
Property | Value |
---|---|
side | buy |
side | sell |
order_type | limit_order |
order_type | market_order |
stop_order_type | stop_loss_order |
reduce_only | false |
reduce_only | true |
state | open |
state | pending |
state | closed |
state | cancelled |
ArrayOfOrders
[
{
"id": 123,
"user_id": 453671,
"size": 10,
"unfilled_size": 2,
"side": "buy",
"order_type": "limit_order",
"limit_price": "59000",
"stop_order_type": "stop_loss_order",
"stop_price": "55000",
"paid_commission": "0.5432",
"commission": "0.5432",
"reduce_only": false,
"client_order_id": "34521712",
"state": "open",
"created_at": "1725865012000000",
"product_id": 27,
"product_symbol": "BTCUSD"
}
]
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [Order] | false | none | [An Order object] |
CreateOrderRequest
{
"product_id": 27,
"product_symbol": "BTCUSD",
"limit_price": "59000",
"size": 10,
"side": "buy",
"order_type": "limit_order",
"stop_order_type": "stop_loss_order",
"stop_price": "56000",
"trail_amount": "50",
"stop_trigger_method": "last_traded_price",
"bracket_stop_loss_limit_price": "57000",
"bracket_stop_loss_price": "56000",
"bracket_trail_amount": "50",
"bracket_take_profit_limit_price": "62000",
"bracket_take_profit_price": "61000",
"time_in_force": "gtc",
"mmp": "disabled",
"post_only": false,
"reduce_only": false,
"client_order_id": "34521712",
"cancel_orders_accepted": false
}
A create order object
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
product_id | integer | true | none | Only one of either product_id or product_symbol must be sent. |
product_symbol | string | true | none | Only one of either product_id or product_symbol must be sent. |
limit_price | string | false | none | Price level for limit orders |
size | integer | false | none | Order size |
side | string | false | none | Buy order or Sell order |
order_type | string | false | none | Limit order(limit_price must be defined) or Market order |
stop_order_type | string | false | none | Stop order type - stop loss or take profit |
stop_price | string | false | none | Stop loss price level if the order is stop order |
trail_amount | string | false | none | Use trail amount if you want a trailing stop order. Required if stop price is empty. |
stop_trigger_method | string | false | none | Stop order trigger method - mark_price/last_traded_price/spot_price |
bracket_stop_loss_limit_price | string | false | none | Bracket order stop loss limit price |
bracket_stop_loss_price | string | false | none | Bracket order stop loss trigger price |
bracket_trail_amount | string | false | none | use bracket trail amount if you want a trailing stop order. Required if bracket stop price is empty |
bracket_take_profit_limit_price | string | false | none | Bracket order take profit limit price |
bracket_take_profit_price | string | false | none | take profit trigger price for bracket order |
time_in_force | string | false | none | GTC/IOC order type |
mmp | string | false | none | MMP level for the order - disabled/mmp1/mmp2/mmp3/mmp4/mmp5 |
post_only | string | false | none | Post only order |
reduce_only | string | false | none | if set, will only close positions. New orders will not be placed |
client_order_id | string | false | none | client order id provided by the user while creating order |
cancel_orders_accepted | string | false | none | if set, will cancel all existing orders for the product |
Enumerated Values
Property | Value |
---|---|
side | buy |
side | sell |
order_type | limit_order |
order_type | market_order |
stop_order_type | stop_loss_order |
stop_order_type | take_profit_order |
stop_trigger_method | mark_price |
stop_trigger_method | last_traded_price |
stop_trigger_method | spot_price |
time_in_force | gtc |
time_in_force | ioc |
mmp | disabled |
mmp | mmp1 |
mmp | mmp2 |
mmp | mmp3 |
mmp | mmp4 |
mmp | mmp5 |
post_only | true |
post_only | false |
reduce_only | true |
reduce_only | false |
cancel_orders_accepted | true |
cancel_orders_accepted | false |
BatchCreateOrderRequest
{
"product_id": 27,
"product_symbol": "BTCUSD",
"limit_price": "59000",
"size": 10,
"side": "buy",
"order_type": "limit_order",
"time_in_force": "gtc",
"mmp": "disabled",
"post_only": false,
"client_order_id": "34521712"
}
A create order object
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
product_id | integer | true | none | Only one of either product_id or product_symbol must be sent. |
product_symbol | string | true | none | Only one of either product_id or product_symbol must be sent. |
limit_price | string | false | none | Price level for limit orders |
size | integer | false | none | Order size |
side | string | false | none | Buy order or Sell order |
order_type | string | false | none | Limit order(limit_price must be defined) or Market order |
time_in_force | string | false | none | GTC/IOC order type |
mmp | string | false | none | MMP level for the order - disabled/mmp1/mmp2/mmp3/mmp4/mmp5 |
post_only | string | false | none | Post only order |
client_order_id | string | false | none | client order id provided by the user while creating order |
Enumerated Values
Property | Value |
---|---|
side | buy |
side | sell |
order_type | limit_order |
order_type | market_order |
time_in_force | gtc |
time_in_force | ioc |
mmp | disabled |
mmp | mmp1 |
mmp | mmp2 |
mmp | mmp3 |
mmp | mmp4 |
mmp | mmp5 |
post_only | true |
post_only | false |
ArrayOfBatchCreateOrderRequest
[
{
"product_id": 27,
"product_symbol": "BTCUSD",
"limit_price": "59000",
"size": 10,
"side": "buy",
"order_type": "limit_order",
"time_in_force": "gtc",
"mmp": "disabled",
"post_only": false,
"client_order_id": "34521712"
}
]
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [BatchCreateOrderRequest] | false | none | [A create order object] |
ArrayOfCreateOrderRequest
[
{
"product_id": 27,
"product_symbol": "BTCUSD",
"limit_price": "59000",
"size": 10,
"side": "buy",
"order_type": "limit_order",
"stop_order_type": "stop_loss_order",
"stop_price": "56000",
"trail_amount": "50",
"stop_trigger_method": "last_traded_price",
"bracket_stop_loss_limit_price": "57000",
"bracket_stop_loss_price": "56000",
"bracket_trail_amount": "50",
"bracket_take_profit_limit_price": "62000",
"bracket_take_profit_price": "61000",
"time_in_force": "gtc",
"mmp": "disabled",
"post_only": false,
"reduce_only": false,
"client_order_id": "34521712",
"cancel_orders_accepted": false
}
]
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [CreateOrderRequest] | false | none | [A create order object] |
EditOrderRequest
{
"id": 34521712,
"product_id": 27,
"product_symbol": "BTCUSD",
"limit_price": "59000",
"size": 15,
"mmp": "disabled",
"post_only": false,
"cancel_orders_accepted": false,
"stop_price": "56000",
"trail_amount": "50"
}
edit order object
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | integer | false | none | existing order id to be edited |
product_id | integer | true | none | Only one of either product_id or product_symbol must be sent. |
product_symbol | string | true | none | Only one of either product_id or product_symbol must be sent. |
limit_price | string | false | none | Price level for limit orders |
size | integer | false | none | total size after editing order |
mmp | string | false | none | MMP level for the order - disabled/mmp1/mmp2/mmp3/mmp4/mmp5 |
post_only | string | false | none | Post only order |
cancel_orders_accepted | string | false | none | if set, will cancel all existing orders for the product |
stop_price | string | false | none | price to trigger stop order |
trail_amount | string | false | none | Use trail amount if you want a trailing stop order. Required if stop price is empty. |
Enumerated Values
Property | Value |
---|---|
mmp | disabled |
mmp | mmp1 |
mmp | mmp2 |
mmp | mmp3 |
mmp | mmp4 |
mmp | mmp5 |
post_only | true |
post_only | false |
cancel_orders_accepted | true |
cancel_orders_accepted | false |
BatchEditOrderRequest
{
"id": 34521712,
"product_id": 27,
"product_symbol": "BTCUSD",
"limit_price": "59000",
"size": 15,
"mmp": "disabled",
"post_only": false
}
edit order object
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | integer | false | none | existing order id to be edited |
product_id | integer | true | none | Only one of either product_id or product_symbol must be sent. |
product_symbol | string | true | none | Only one of either product_id or product_symbol must be sent. |
limit_price | string | false | none | Price level for limit orders |
size | integer | false | none | total size after editing order |
mmp | string | false | none | MMP level for the order - disabled/mmp1/mmp2/mmp3/mmp4/mmp5 |
post_only | string | false | none | Post only order |
Enumerated Values
Property | Value |
---|---|
mmp | disabled |
mmp | mmp1 |
mmp | mmp2 |
mmp | mmp3 |
mmp | mmp4 |
mmp | mmp5 |
post_only | false |
post_only | true |
ArrayOfBatchEditOrderRequest
[
{
"id": 34521712,
"product_id": 27,
"product_symbol": "BTCUSD",
"limit_price": "59000",
"size": 15,
"mmp": "disabled",
"post_only": false
}
]
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [BatchEditOrderRequest] | false | none | [edit order object] |
CreateBracketOrderRequest
{
"product_id": 27,
"product_symbol": "BTCUSD",
"stop_loss_order": {
"order_type": "limit_order",
"stop_price": "56000",
"trail_amount": "50",
"limit_price": "55000"
},
"take_profit_order": {
"order_type": "limit_order",
"stop_price": "65000",
"limit_price": "64000"
},
"bracket_stop_trigger_method": "last_traded_price"
}
bracket order object
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
product_id | integer | true | none | Only one of either product_id or product_symbol must be sent. |
product_symbol | string | true | none | Only one of either product_id or product_symbol must be sent. |
stop_loss_order | object | false | none | none |
» order_type | string | false | none | Limit order(limit_price must be defined) or Market order |
» stop_price | string | false | none | Stop loss price level |
» trail_amount | string | false | none | Use trail amount if you want a trailing stop order. Required if stop price is empty. |
» limit_price | string | false | none | required for limit orders |
take_profit_order | object | false | none | none |
» order_type | string | false | none | Limit order(limit_price must be defined) or Market order |
» stop_price | string | false | none | Stop price level |
» limit_price | string | false | none | required for limit orders |
bracket_stop_trigger_method | string | false | none | stop order trigger method for bracket orders- mark_price/last_traded_price/spot_price |
Enumerated Values
Property | Value |
---|---|
order_type | limit_order |
order_type | market_order |
order_type | limit_order |
order_type | market_order |
bracket_stop_trigger_method | mark_price |
bracket_stop_trigger_method | last_traded_price |
bracket_stop_trigger_method | spot_price |
EditBracketOrderRequest
{
"id": 34521712,
"product_id": 27,
"product_symbol": "BTCUSD",
"bracket_stop_loss_limit_price": "55000",
"bracket_stop_loss_price": "56000",
"bracket_take_profit_limit_price": "65000",
"bracket_take_profit_price": "64000",
"bracket_trail_amount": "50",
"bracket_stop_trigger_method": "last_traded_price"
}
bracket order object
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | integer | false | none | Order ID for which bracket params are being updated |
product_id | integer | true | none | Only one of either product_id or product_symbol must be sent. |
product_symbol | string | true | none | Only one of either product_id or product_symbol must be sent. |
bracket_stop_loss_limit_price | string | false | none | stop loss limit price for bracket order |
bracket_stop_loss_price | string | false | none | stop loss trigger price for bracket order |
bracket_take_profit_limit_price | string | false | none | take profit limit price for bracket order |
bracket_take_profit_price | string | false | none | take profit trigger price for bracket order |
bracket_trail_amount | string | false | none | trail amount of bracket order |
bracket_stop_trigger_method | string | false | none | stop order trigger method for bracket orders- mark_price/last_traded_price/spot_price |
Enumerated Values
Property | Value |
---|---|
bracket_stop_trigger_method | mark_price |
bracket_stop_trigger_method | last_traded_price |
bracket_stop_trigger_method | spot_price |
DeleteOrderRequest
{
"id": 13452112,
"client_order_id": "34521712",
"product_id": 27
}
A delete order object
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | integer | false | none | use bracket trail amount if you want a trailing stop order. Required if bracket stop price is empty |
client_order_id | string | false | none | client order id provided by the user while creating order |
product_id | integer | false | none | product_id of the product in the order |
CancelAllFilterObject
{
"product_id": 27,
"contract_types": "perpetual_futures,put_options,call_options",
"cancel_limit_orders": false,
"cancel_stop_orders": false,
"cancel_reduce_only_orders": false
}
Cancel all request filter object
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
product_id | integer | false | none | Only one of either product_id or product_symbol must be sent. |
contract_types | string | false | none | comma separated list of desired contract types |
cancel_limit_orders | string | false | none | set true to cancel open limit orders |
cancel_stop_orders | string | false | none | set as true to cancel stop orders |
cancel_reduce_only_orders | string | false | none | set as true to cancel reduce only orders |
Enumerated Values
Property | Value |
---|---|
cancel_limit_orders | true |
cancel_limit_orders | false |
cancel_stop_orders | true |
cancel_stop_orders | false |
cancel_reduce_only_orders | true |
cancel_reduce_only_orders | false |
ArrayOfDeleteOrderRequest
[
{
"id": 13452112,
"client_order_id": "34521712",
"product_id": 27
}
]
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [DeleteOrderRequest] | false | none | [A delete order object] |
Position
{
"user_id": 0,
"size": 0,
"entry_price": "string",
"margin": "string",
"liquidation_price": "string",
"bankruptcy_price": "string",
"adl_level": 0,
"product_id": 0,
"product_symbol": "string",
"commission": "string",
"realized_pnl": "string",
"realized_funding": "string"
}
A position object
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
user_id | integer | false | none | none |
size | integer | false | none | Position size, negative for short and positive for long |
entry_price | string | false | none | none |
margin | string | false | none | none |
liquidation_price | string | false | none | none |
bankruptcy_price | string | false | none | none |
adl_level | integer | false | none | none |
product_id | integer | false | none | none |
product_symbol | string | false | none | none |
commission | string | false | none | commissions blocked in the position |
realized_pnl | string | false | none | Net realized pnl since the position was opened |
realized_funding | string | false | none | Net realized funding since the position was opened |
ArrayOfPositions
[
{
"user_id": 0,
"size": 0,
"entry_price": "string",
"margin": "string",
"liquidation_price": "string",
"bankruptcy_price": "string",
"adl_level": 0,
"product_id": 0,
"product_symbol": "string",
"commission": "string",
"realized_pnl": "string",
"realized_funding": "string"
}
]
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [Position] | false | none | [A position object] |
Fill
{
"id": 0,
"size": 0,
"fill_type": "normal",
"side": "buy",
"price": "string",
"role": "taker",
"commission": "string",
"created_at": "string",
"product_id": 0,
"product_symbol": "string",
"order_id": "string",
"settling_asset_id": 0,
"settling_asset_symbol": "string",
"meta_data": {
"commission_deto": "string",
"commission_deto_in_settling_asset": "string",
"effective_commission_rate": "string",
"liquidation_fee_deto": "string",
"liquidation_fee_deto_in_settling_asset": "string",
"order_price": "string",
"order_size": "string",
"order_type": "string",
"order_unfilled_size": "string",
"tfc_used_for_commission": "string",
"tfc_used_for_liquidation_fee": "string",
"total_commission_in_settling_asset": "string",
"total_liquidation_fee_in_settling_asset": "string"
}
}
A fill object
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | integer | false | none | none |
size | integer | false | none | none |
fill_type | string | false | none | none |
side | string | false | none | none |
price | string | false | none | Price at which the fill happened, BigDecimal sent as string |
role | string | false | none | none |
commission | string | false | none | Commission paid on this fill, negative value means commission was earned because of maker role |
created_at | string | false | none | none |
product_id | integer | false | none | none |
product_symbol | string | false | none | none |
order_id | string | false | none | Will be order_id(Integer) in most cases. Will be UUID string of order when fill_type is settlement |
settling_asset_id | integer | false | none | none |
settling_asset_symbol | string | false | none | none |
meta_data | FillMetaData | false | none | Meta data inside fill |
Enumerated Values
Property | Value |
---|---|
fill_type | normal |
fill_type | adl |
fill_type | liquidation |
fill_type | settlement |
fill_type | otc |
side | buy |
side | sell |
role | taker |
role | maker |
ArrayOfFills
[
{
"id": 0,
"size": 0,
"fill_type": "normal",
"side": "buy",
"price": "string",
"role": "taker",
"commission": "string",
"created_at": "string",
"product_id": 0,
"product_symbol": "string",
"order_id": "string",
"settling_asset_id": 0,
"settling_asset_symbol": "string",
"meta_data": {
"commission_deto": "string",
"commission_deto_in_settling_asset": "string",
"effective_commission_rate": "string",
"liquidation_fee_deto": "string",
"liquidation_fee_deto_in_settling_asset": "string",
"order_price": "string",
"order_size": "string",
"order_type": "string",
"order_unfilled_size": "string",
"tfc_used_for_commission": "string",
"tfc_used_for_liquidation_fee": "string",
"total_commission_in_settling_asset": "string",
"total_liquidation_fee_in_settling_asset": "string"
}
}
]
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [Fill] | false | none | [A fill object] |
FillMetaData
{
"commission_deto": "string",
"commission_deto_in_settling_asset": "string",
"effective_commission_rate": "string",
"liquidation_fee_deto": "string",
"liquidation_fee_deto_in_settling_asset": "string",
"order_price": "string",
"order_size": "string",
"order_type": "string",
"order_unfilled_size": "string",
"tfc_used_for_commission": "string",
"tfc_used_for_liquidation_fee": "string",
"total_commission_in_settling_asset": "string",
"total_liquidation_fee_in_settling_asset": "string"
}
Meta data inside fill
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
commission_deto | string | false | none | none |
commission_deto_in_settling_asset | string | false | none | none |
effective_commission_rate | string | false | none | none |
liquidation_fee_deto | string | false | none | none |
liquidation_fee_deto_in_settling_asset | string | false | none | none |
order_price | string | false | none | none |
order_size | string | false | none | none |
order_type | string | false | none | none |
order_unfilled_size | string | false | none | none |
tfc_used_for_commission | string | false | none | none |
tfc_used_for_liquidation_fee | string | false | none | none |
total_commission_in_settling_asset | string | false | none | none |
total_liquidation_fee_in_settling_asset | string | false | none | none |
OrderLeverage
{
"leverage": 10,
"order_margin": "563.2",
"product_id": 27
}
Order Leverage for a product
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
leverage | string | false | none | Leverage of all open orders for this product |
order_margin | string | false | none | Margin blocked in open orders for this product |
product_id | integer | false | none | Product id of the ordered product |
L2Orderbook
{
"buy": [
{
"depth": "983",
"price": "9187.5",
"size": 205640
}
],
"last_updated_at": 1654589595784000,
"sell": [
{
"depth": "1185",
"price": "9188.0",
"size": 113752
}
],
"symbol": "BTCUSD"
}
L2 orderbook
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
buy | [object] | false | none | none |
» depth | string | false | none | sum of size till that price level |
» price | string | false | none | none |
» size | integer | false | none | for derivatives -> number of contracts, for spot -> amount in underlying |
last_updated_at | integer | false | none | none |
sell | [object] | false | none | none |
» depth | string | false | none | sum of size till that price level |
» price | string | false | none | none |
» size | integer | false | none | for derivatives -> number of contracts, for spot -> amount in underlying |
symbol | string | false | none | none |
Trades
{
"trades": [
{
"side": "buy",
"size": 0,
"price": "string",
"timestamp": 0
}
]
}
trades of a symbol
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
trades | [object] | false | none | none |
» side | string | false | none | none |
» size | integer | false | none | none |
» price | string | false | none | none |
» timestamp | integer | false | none | none |
Enumerated Values
Property | Value |
---|---|
side | buy |
side | sell |
Wallet
{
"asset_id": 0,
"asset_symbol": "string",
"available_balance": "string",
"available_balance_for_robo": "string",
"balance": "string",
"blocked_margin": "string",
"commission": "string",
"cross_asset_liability": "string",
"cross_commission": "string",
"cross_locked_collateral": "string",
"cross_order_margin": "string",
"cross_position_margin": "string",
"id": 0,
"interest_credit": "string",
"order_margin": "string",
"pending_referral_bonus": "string",
"pending_trading_fee_credit": "string",
"portfolio_margin": "string",
"position_margin": "string",
"trading_fee_credit": "string",
"unvested_amount": "string",
"user_id": 0
}
Wallet Data for each asset.
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
asset_id | integer | false | none | Id for assets like BTC |
asset_symbol | string | false | none | Symbol for assets like BTC |
available_balance | string | false | none | Balance available for trading |
available_balance_for_robo | string | false | none | Balance available for robo trading |
balance | string | false | none | Total wallet balance |
blocked_margin | string | false | none | Total blocked margin including commissions for all modes |
commission | string | false | none | Commissions blocked in Isolated Mode |
cross_asset_liability | string | false | none | Asset liability in Cross margin mode |
cross_commission | string | false | none | Commision blocked in Cross margin mode |
cross_locked_collateral | string | false | none | collateral blocked in Cross margin mode |
cross_order_margin | string | false | none | margin blocked for open orders in Cross margin mode |
cross_position_margin | string | false | none | margin blocked for open positions in Cross margin mode |
id | integer | false | none | Wallet Id |
interest_credit | string | false | none | Total interest credited |
order_margin | string | false | none | margin blocked for open positions in isolated mode |
pending_referral_bonus | string | false | none | Pending referral bonus |
pending_trading_fee_credit | string | false | none | Credit of trading fee pending |
portfolio_margin | string | false | none | Total margin blocked including commissions in portfolio margin mode |
position_margin | string | false | none | Margin blocked in open positions in isolated mode |
trading_fee_credit | string | false | none | Credit of trading fee |
unvested_amount | string | false | none | Amount currently unvested |
user_id | integer | false | none | User Id linked to this wallet |
WalletPayload
{
"meta": {
"net_equity": "string",
"robo_trading_equity": "string"
},
"result": [
{
"asset_id": 0,
"asset_symbol": "string",
"available_balance": "string",
"available_balance_for_robo": "string",
"balance": "string",
"blocked_margin": "string",
"commission": "string",
"cross_asset_liability": "string",
"cross_commission": "string",
"cross_locked_collateral": "string",
"cross_order_margin": "string",
"cross_position_margin": "string",
"id": 0,
"interest_credit": "string",
"order_margin": "string",
"pending_referral_bonus": "string",
"pending_trading_fee_credit": "string",
"portfolio_margin": "string",
"position_margin": "string",
"trading_fee_credit": "string",
"unvested_amount": "string",
"user_id": 0
}
],
"success": true
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
meta | WalletMetaData | false | none | Meta data for robo trading |
result | ArrayOfWallets | false | none | Array of wallet for every asset |
success | boolean | false | none | none |
WalletMetaData
{
"net_equity": "string",
"robo_trading_equity": "string"
}
Meta data for robo trading
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
net_equity | string | false | none | Net equity for robo trading |
robo_trading_equity | string | false | none | trading equity for robo trading |
ArrayOfWallets
[
{
"asset_id": 0,
"asset_symbol": "string",
"available_balance": "string",
"available_balance_for_robo": "string",
"balance": "string",
"blocked_margin": "string",
"commission": "string",
"cross_asset_liability": "string",
"cross_commission": "string",
"cross_locked_collateral": "string",
"cross_order_margin": "string",
"cross_position_margin": "string",
"id": 0,
"interest_credit": "string",
"order_margin": "string",
"pending_referral_bonus": "string",
"pending_trading_fee_credit": "string",
"portfolio_margin": "string",
"position_margin": "string",
"trading_fee_credit": "string",
"unvested_amount": "string",
"user_id": 0
}
]
Array of wallet for every asset
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [Wallet] | false | none | Array of wallet for every asset |
AssetTransferSubaccountReq
{
"transferrer_user_id": "string",
"transferee_user_id": "string",
"asset_symbol": "string",
"amount": null
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
transferrer_user_id | string | false | none | Debit account |
transferee_user_id | string | false | none | Credit account |
asset_symbol | string | false | none | Asset to transfer |
amount | big_decimal | false | none | Amount to transfer. Only postive values allowed. |
SubaccountTransferHistory
{
"subaccount_user_id": "string",
"before": "string",
"after": "string",
"page_size": 10
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
subaccount_user_id | string | false | none | subaccount user id |
before | string | false | none | before cursor for pagination |
after | string | false | none | after cursor for pagination |
page_size | big_decimal | false | none | records per page |
TransactionTypes
"string"
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | string | false | none | none |
transaction_type | string | false | none | none |
Enumerated Values
Property | Value |
---|---|
transaction_type | cashflow |
transaction_type | deposit |
transaction_type | withdrawal |
transaction_type | commission |
transaction_type | conversion |
transaction_type | funding |
transaction_type | settlement |
transaction_type | liquidation_fee |
transaction_type | spot_trade |
transaction_type | withdrawal_cancellation |
transaction_type | referral_bonus |
transaction_type | sub_account_transfer |
transaction_type | commission_rebate |
transaction_type | promo_credit |
transaction_type | trading_credits |
transaction_type | trading_credits_forfeited |
transaction_type | trading_credits_paid |
transaction_type | trading_fee_credits_paid_liquidation_fee |
transaction_type | trading_credits_reverted |
transaction_type | interest_credit |
transaction_type | external_deposit |
transaction_type | credit_line |
transaction_type | trading_competition |
transaction_type | fund_deposit |
transaction_type | fund_withdrawal |
transaction_type | fund_wallet_deposit |
transaction_type | fund_wallet_withdrawal |
transaction_type | fund_reward |
transaction_type | trade_farming_reward |
transaction_type | interest_credit |
transaction_type | revert |
transaction_type | raf_bonus |
transaction_type | fill_appropriation |
transaction_type | incident_compensation |
Transaction
{
"id": 0,
"amount": "string",
"balance": "string",
"transaction_type": "string",
"meta_data": {},
"product_id": 0,
"asset_id": 0,
"asset_symbol": 0,
"created_at": "string"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | integer | false | none | none |
amount | string | false | none | amount credited/debited in this transaction (+ for credited, - for debited) |
balance | string | false | none | net wallet balance after this transaction |
transaction_type | TransactionTypes | false | none | none |
meta_data | object | false | none | none |
product_id | integer | false | none | none |
asset_id | integer | false | none | none |
asset_symbol | integer | false | none | none |
created_at | string | false | none | none |
ArrayOfTransactions
[
{
"id": 0,
"amount": "string",
"balance": "string",
"transaction_type": "string",
"meta_data": {},
"product_id": 0,
"asset_id": 0,
"asset_symbol": 0,
"created_at": "string"
}
]
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [Transaction] | false | none | none |
SubaccountTransferLog
{
"transferrer_user_id": "string",
"transferee_user_id": "string",
"asset_symbol": "string",
"amount": null,
"created_at": "string",
"transferee_user": {},
"transferrer_user": {}
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
transferrer_user_id | string | false | none | User id of the account debited with the asset. |
transferee_user_id | string | false | none | User id of the account credited with the asset. |
asset_symbol | string | false | none | Asset symbol transferred. |
amount | big_decimal | false | none | Amount transferred. |
created_at | string | false | none | transfer creation date and time |
transferee_user | object | false | none | User details |
transferrer_user | object | false | none | User details |
ArrayOfSubaccountTransferLog
[
{
"transferrer_user_id": "string",
"transferee_user_id": "string",
"asset_symbol": "string",
"amount": null,
"created_at": "string",
"transferee_user": {},
"transferrer_user": {}
}
]
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [SubaccountTransferLog] | false | none | none |
greeks
{
"delta": "0.25",
"gamma": "0.10",
"rho": "0.05",
"theta": "-0.02",
"vega": "0.15"
}
The Greeks represent different factors that influence the pricing of options. These are key measures for assessing risk and managing option positions.
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
delta | string | false | none | The rate of change of the option price with respect to changes in the underlying asset price. A measure of sensitivity to the asset price movement. |
gamma | string | false | none | The rate of change of delta with respect to changes in the underlying asset price. A measure of the curvature of the option’s price sensitivity to the asset price. |
rho | string | false | none | The rate of change of the option price with respect to changes in the risk-free interest rate. A measure of interest rate sensitivity. |
theta | string | false | none | The rate of change of the option price with respect to time, often referred to as time decay. A measure of how the option's price declines as expiration approaches. |
vega | string | false | none | The rate of change of the option price with respect to changes in the volatility of the underlying asset. A measure of volatility sensitivity. |
price_band
{
"lower_limit": "61120.45",
"upper_limit": "72300.00"
}
The price band defines the permissible price range for a product. The lower and upper limits represent the boundaries within which the product's price can fluctuate.
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
lower_limit | string | false | none | The minimum price limit for the product. It defines the lowest allowable price before triggering a price band constraint. |
upper_limit | string | false | none | The maximum price limit for the product. It defines the highest allowable price before triggering a price band constraint. |
quotes
{
"ask_iv": "0.25",
"ask_size": "100",
"best_ask": "150.00",
"best_bid": "148.00",
"bid_iv": "0.22",
"bid_size": "50"
}
The 'quotes' object contains the latest bid and ask prices, their respective implied volatilities (IV), and order sizes for an asset. It provides key market data for understanding liquidity and pricing.
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
ask_iv | string | false | none | The implied volatility (IV) for the ask price. Represents the market's expectation of the future volatility of the underlying asset. |
ask_size | string | false | none | The size of the ask order, representing the quantity of the asset available for sale at the ask price. |
best_ask | string | false | none | The best (lowest) ask price available in the market for the asset. |
best_bid | string | false | none | The best (highest) bid price available in the market for the asset. |
bid_iv | string | false | none | The implied volatility (IV) for the bid price. Represents the market's expectation of future volatility for the bid side of the order book. |
bid_size | string | false | none | The size of the bid order, representing the quantity of the asset that buyers are willing to purchase at the bid price. |
Ticker
{
"close": 67321,
"contract_type": "futures",
"greeks": {
"delta": "0.25",
"gamma": "0.10",
"rho": "0.05",
"theta": "-0.02",
"vega": "0.15"
},
"high": 68500.5,
"low": 66300.25,
"mark_price": "67000.00",
"mark_vol": "500",
"oi": "15000",
"oi_value": "1000000",
"oi_value_symbol": "USD",
"oi_value_usd": "1050000",
"open": 67000,
"price_band": {
"lower_limit": "61120.45",
"upper_limit": "72300.00"
},
"product_id": 123456,
"quotes": {
"ask_iv": "0.25",
"ask_size": "100",
"best_ask": "150.00",
"best_bid": "148.00",
"bid_iv": "0.22",
"bid_size": "50"
},
"size": 100,
"spot_price": "67000.00",
"strike_price": "68000.00",
"symbol": "BTCUSD",
"timestamp": 1609459200,
"turnover": 5000000,
"turnover_symbol": "USD",
"turnover_usd": 5200000,
"volume": 25000
}
The 'Ticker' object provides real-time trading data for a specific product, including prices, volumes, open interest, and Greek values (for options). This data is essential for analyzing market trends and asset performance.
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
close | integer | false | none | The closing price of the last trade for the product. |
contract_type | string | false | none | Comma-separated list of contract types, such as futures, perpetual_futures, call_options, put_options, interest_rate_swaps, move_options, spreads, turbo_call_options, turbo_put_options, and spot. |
greeks | greeks | false | none | The Greeks represent different factors that influence the pricing of options. These are key measures for assessing risk and managing option positions. |
high | number | false | none | The highest price reached during the trading session. |
low | number | false | none | The lowest price reached during the trading session. |
mark_price | string | false | none | The market price of the product, reflecting the most recent transaction. |
mark_vol | string | false | none | The market volume at the most recent trade price. |
oi | string | false | none | The open interest, or the number of outstanding contracts, for the product. |
oi_value | string | false | none | The value of the open interest in the base currency. |
oi_value_symbol | string | false | none | The symbol representing the currency of the open interest value. |
oi_value_usd | string | false | none | The open interest value converted to USD. |
open | number | false | none | The opening price at the start of the trading session. |
price_band | price_band | false | none | The price band defines the permissible price range for a product. The lower and upper limits represent the boundaries within which the product's price can fluctuate. |
product_id | number | false | none | A unique identifier for the product. |
quotes | quotes | false | none | The 'quotes' object contains the latest bid and ask prices, their respective implied volatilities (IV), and order sizes for an asset. It provides key market data for understanding liquidity and pricing. |
size | number | false | none | The size of the most recent order executed in the market. |
spot_price | string | false | none | The current spot price of the underlying asset. |
strike_price | string | false | none | The strike price for options contracts associated with the product. |
symbol | string | false | none | The ticker symbol for the product. |
timestamp | number | false | none | The timestamp of the last trade or update to the ticker. |
turnover | number | false | none | The total turnover (value traded) for the product during the trading session. |
turnover_symbol | string | false | none | The symbol representing the currency in which the turnover is measured. |
turnover_usd | number | false | none | The turnover value converted to USD. |
volume | integer | false | none | The total trading volume for the product during the trading session. |
ArrayOfTickers
[
{
"close": 67321,
"contract_type": "futures",
"greeks": {
"delta": "0.25",
"gamma": "0.10",
"rho": "0.05",
"theta": "-0.02",
"vega": "0.15"
},
"high": 68500.5,
"low": 66300.25,
"mark_price": "67000.00",
"mark_vol": "500",
"oi": "15000",
"oi_value": "1000000",
"oi_value_symbol": "USD",
"oi_value_usd": "1050000",
"open": 67000,
"price_band": {
"lower_limit": "61120.45",
"upper_limit": "72300.00"
},
"product_id": 123456,
"quotes": {
"ask_iv": "0.25",
"ask_size": "100",
"best_ask": "150.00",
"best_bid": "148.00",
"bid_iv": "0.22",
"bid_size": "50"
},
"size": 100,
"spot_price": "67000.00",
"strike_price": "68000.00",
"symbol": "BTCUSD",
"timestamp": 1609459200,
"turnover": 5000000,
"turnover_symbol": "USD",
"turnover_usd": 5200000,
"volume": 25000
}
]
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [Ticker] | false | none | [The 'Ticker' object provides real-time trading data for a specific product, including prices, volumes, open interest, and Greek values (for options). This data is essential for analyzing market trends and asset performance.] |
PaginationMeta
{
"after": "g3QAAAACZAAKY3JlYXRlZF9hdHQAAAAN",
"before": "a2PQRSACZAAKY3JlYXRlZF3fnqHBBBNZL"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
after | string | false | none | after cursor for pagination; becomes null if page after the current one does not exist |
before | string | false | none | before cursor for pagination; becomes null if page before the current one does not exist |
OHLCData
{
"time": 0,
"open": 0,
"high": 0,
"low": 0,
"close": 0,
"volume": 0
}
A ohlc object
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
time | integer | false | none | none |
open | number | false | none | none |
high | number | false | none | none |
low | number | false | none | none |
close | number | false | none | none |
volume | number | false | none | none |
ArrayOfOHLCData
[
{
"time": 0,
"open": 0,
"high": 0,
"low": 0,
"close": 0,
"volume": 0
}
]
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [OHLCData] | false | none | [A ohlc object] |
SparklineData
{
"ETHUSD": [
[
1594214051,
0.00003826
],
[
1594214051,
0.00003826
]
],
"MARK:BTCUSD": [
[
1594215270,
0.00003826
]
]
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
additionalProperties | [integer] | false | none | array of timestamp and closing value |
Stats
{
"last_30_days_volume": 0,
"last_7_days_volume": 0,
"total_volume": 0
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
last_30_days_volume | integer | false | none | sum of turnover usd in the last 30 days |
last_7_days_volume | integer | false | none | sum of turnover usd in the last 7 days |
total_volume | integer | false | none | sum of turnover usd in the last 24 hours |
MMPConfigUpdateRequest
{
"asset": "string",
"window_interval": 0,
"freeze_interval": 0,
"trade_limit": "string",
"delta_limit": "string",
"vega_limit": "string",
"mmp": "mmp1"
}
MMP config for an underlying
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
asset | string | false | none | none |
window_interval | integer | false | none | Window interval in seconds |
freeze_interval | integer | false | none | MMP freeze interval in seconds. Setting this to zero will require a manual reset once mmp is triggered. |
trade_limit | string | false | none | Notional trade limit for mmp to trigger (in USD) |
delta_limit | string | false | none | Delta Adjusted notional trade limit for mmp to trigger (in USD) |
vega_limit | string | false | none | vega traded limit for mmp to trigger (in USD) |
mmp | string | false | none | Specify mmp flag for the config update |
Enumerated Values
Property | Value |
---|---|
mmp | mmp1 |
mmp | mmp2 |
mmp | mmp3 |
mmp | mmp4 |
mmp | mmp5 |
MMPResetRequest
{
"asset": "string",
"mmp": "mmp1"
}
MMP config for an underlying
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
asset | string | false | none | none |
mmp | string | false | none | specify mmp flag to reset |
Enumerated Values
Property | Value |
---|---|
mmp | mmp1 |
mmp | mmp2 |
mmp | mmp3 |
mmp | mmp4 |
mmp | mmp5 |
UserPreference
{
"user_id": 0,
"default_auto_topup": true,
"mmp_config": {},
"deto_for_commission": true,
"vip_level": 0
}
User trading preferences
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
user_id | integer | false | none | none |
default_auto_topup | boolean | false | none | Default auto topup setting for newly acquired positions (only for isolated mode) |
mmp_config | object | false | none | Config object for market maker protection (only for MMP enabled accounts) |
deto_for_commission | boolean | false | none | Flag to determine whether to pay commissions in deto |
vip_level | integer | false | none | VIP level for this account. Customers get better fee discounting for higher VIP levels |
CancelAfterRequest
{
"cancel_after": "5000"
}
Cancel After Request Object
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
cancel_after | string | false | none | Timer value in milliseconds after which orders are to be cancelled. To disable deadman switch and keep your orders open, set cancel_after to 0. |
CancelAfterResponse
{
"cancel_after_enabled": "true",
"cancel_after_timestamp": "1669119262000"
}
Cancel After Response Object
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
cancel_after_enabled | string | false | none | none |
cancel_after_timestamp | string | false | none | timestamp after which orders will get cancelled |
Enumerated Values
Property | Value |
---|---|
cancel_after_enabled | false |
cancel_after_enabled | true |
User
{
"id": null,
"email": "string",
"account_name": "string",
"first_name": "string",
"last_name": "string",
"dob": "string",
"country": "string",
"phone_number": "string",
"margin_mode": "string",
"pf_index_symbol": "string",
"is_sub_account": true,
"is_kyc_done": true
}
User Object
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | integer_or_string | false | none | id |
string | false | none | ||
account_name | string | false | none | none |
first_name | string | false | none | none |
last_name | string | false | none | none |
dob | string | false | none | none |
country | string | false | none | none |
phone_number | string | false | none | none |
margin_mode | string | false | none | none |
pf_index_symbol | string | false | none | Portfolio index symbol if account is at portfolio margin mode. |
is_sub_account | boolean | false | none | none |
is_kyc_done | boolean | false | none | none |
ArrayOfSubaccouns
[
{
"id": null,
"email": "string",
"account_name": "string",
"first_name": "string",
"last_name": "string",
"dob": "string",
"country": "string",
"phone_number": "string",
"margin_mode": "string",
"pf_index_symbol": "string",
"is_sub_account": true,
"is_kyc_done": true
}
]
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [User] | false | none | [User Object] |
Place order errors
This section lists various errors returned by the system while placing order. The error format looks like this
{
success: false,
error: {
code: ..., // error code
context: {
...
}
}
}
Here is a list of error codes and their explanation
error code | description |
---|---|
insufficient_margin | Margin required to place order with selected leverage and quantity is insufficient. |
order_size_exceed_available | Rhe order book doesn't have sufficient liquidity, hence the order couldnt be filled (for ex - ioc orders). |
risk_limits_breached | orders couldn't be placed as it will breach allowed risk limits. |
invalid_contract | The contract/product is either doesn\'t exist or has already expired. |
immediate_liquidation | Order will cause immediate liquidation. |
out_of_bankruptcy | Order prices are out of position bankruptcy limits. |
self_matching_disrupted_post_only | Self matching is not allowed during auction. |
immediate_execution_post_only | orders couldn't be placed as it includes post only orders which will be immediately executed. |
Errors
Delta API uses the following error codes:
Error Code | Meaning |
---|---|
400 | Bad Request -- Your request is invalid. |
401 | Unauthorized -- Your API key/Signature is wrong. |
404 | Not Found -- The specified resource could not be found. |
405 | Method Not Allowed -- You tried to access a resource with an invalid method. |
406 | Not Acceptable -- You requested a format that isn't json. |
429 | Too Many Requests -- You have exhausted your rate limits! Slow down! |
500 | Internal Server Error -- We had a problem with our server. Try again later. |
503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. |
Rest Clients
Delta API conforms to the Swagger spec for REST endpoints. Any Swagger-compatible client can connect to the Delta API and execute commands.
You can find the swagger spec json for Delta Api here
We also have Rest Api Clients available for the following languages
CCXT
CCXT is our authorized SDK provider and you may access our API through CCXT.
For more information, please visit ccxt website.
Websocket Feed
Websocket api can be used for the following use cases
- Get real time feed of market data, this includes L2 and L3 orderbook and recent trades.
- Get price feeds - Mark prices of different contracts, price feed of underlying indexes etc.
- Get account specific notifications like fills, liquidations, ADL and PnL updates.
- Get account specific updates on orders ,positions and wallets.
Access url for Delta Exchange India
- Production-India - wss://socket.india.delta.exchange
- Testnet-India - wss://socket-ind.testnet.deltaex.org
Access url for Delta Exchange Global
- Production-Global - wss://socket.delta.exchange
- Testnet-Global - wss://testnet-socket.delta.exchange
You will be disconnected, if there is no activity within 60 seconds after making connection.
Subscribing to Channels
Subscribe
To begin receiving feed messages, you must first send a subscribe message to the server indicating which channels and contracts to subscribe for.
To specify contracts within each channel, just pass a list of symbols inside the channel payload. Mention ["all"] in symbols if you want to receive updates across all the contracts. Please note that snapshots are sent only for specified symbols,meaning no snapshots are sent for symbol: "all".
Once a subscribe message is received the server will respond with a subscriptions message that lists all channels you are subscribed to. Subsequent subscribe messages will add to the list of subscriptions.
Subscription Sample
// Request
// Subscribe to BTCUSD_28Dec and ETHBTC_28Dec with the ticker and orderbookL2 channels,
{
"type": "subscribe",
"payload": {
"channels": [
{
"name": "ticker",
"symbols": [
"BTCUSD_28Dec",
"ETHBTC_28Dec"
]
},
{
"name": "l2_orderbook",
"symbols": [
"BTCUSD_28Dec"
]
},
{
"name": "funding_rate",
"symbols": [
"all"
]
}
]
}
}
// Response
{
"type": "subscriptions",
"channels": [
{
"name": "l2_orderbook",
"symbols": [
"BTCUSD_28Dec"
],
},
{
"name": "ticker",
"symbols": [
"BTCUSD_28Dec",
"ETHBTC_28Dec"
]
},
{
"name": "funding_rate",
"symbols": [
"all"
]
}
]
}
// Error Response
{
"type": "subscriptions",
"channels": [
{
"name": "l2_orderbook",
"symbols": [
"BTCUSD_28Dec"
],
},
{
"name": "trading_notifications",
"error": "subscription forbidden on trading_notifications. Unauthorized user"
}
]
}
Unsubscribe
If you want to unsubscribe from channel/contracts pairs, send an "unsubscribe" message. The structure is equivalent to subscribe messages. If you want to unsubscribe for specific symbols in a channel, you can pass it in the symbol list. As a shorthand you can also provide no symbols for a channel, which will unsubscribe you from the channel entirely.
Unsubscribe Sample
// Request
{
"type": "unsubscribe",
"payload": {
"channels": [
{
"name": "ticker", // unsubscribe from ticker channel only for BTCUSD_28Dec
"symbols": [
"BTCUSD_28Dec"
]
},
{
"name": "l2_orderbook" // unsubscribe from all symbols for l2_orderbook channel
}
]
}
}
Authenticating a connection
Authentication allows clients to receives private messages, like trading notifications. Examples of the trading notifications are: fills, liquidations, adl and pnl updates.
To authenticate, you need to send a signed request of type 'auth' on your socket connection. Check the authentication section above for more details on how to sign a request using api key and secret.
The payload for the signed request will be 'GET' + timestamp + '/live'
To subscribe to private channels, the client needs to first send an auth event, providing api-key, and signature.
Authentication sample
# auth message with signed request
import websocket
import hashlib
import hmac
import base64
api_key = 'a207900b7693435a8fa9230a38195d'
api_secret = '7b6f39dcf660ec1c7c664f612c60410a2bd0c258416b498bf0311f94228f'
def generate_signature(secret, message):
message = bytes(message, 'utf-8')
secret = bytes(secret, 'utf-8')
hash = hmac.new(secret, message, hashlib.sha256)
return hash.hexdigest()
def get_time_stamp():
d = datetime.datetime.utcnow()
epoch = datetime.datetime(1970,1,1)
return str(int((d - epoch).total_seconds()))
# Get open orders
method = 'GET'
timestamp = get_time_stamp()
path = '/live'
signature_data = method + timestamp + path
signature = generate_signature(api_secret, signature_data)
ws = websocket.WebSocketApp('wss://socket.india.delta.exchange')
ws.send(json.dumps({
"type": "auth",
"payload": {
"api-key": api_key,
"signature": signature,
"timestamp": timestamp
}
}))
To unsubscribe from all private channels, just send a 'unauth' message on the socket. This will automatically unsubscribe the connection from all authenticated channels.
ws.send(json.dumps({
"type": 'unauth',
"payload": {}
}))
Detecting Connection Drops
Some client libraries might not detect connection drops properly. We provide two methods for the clients to ensure they are connected and getting subscribed data.
Heartbeat (Recommended)
The client can enable heartbeat on the socket. If heartbeat is enabled, the server is expected to periodically send a heartbeat message to the client. Right now, the heartbeat time is set to 30 seconds.
How to Implement on client side
- Enable heartbeat (check sample code) after each successful socket connection
- Set a timer with duration of 35 seconds (We take 5 seconds buffer for heartbeat to arrive).
- When you receive a new heartbeat message, you reset the timer
- If the timer is called, that means the client didn't receive any heartbeat in last 35 seconds. In this case, the client should exit the existing connection and try to reconnect.
// Enable Heartbeat on successful connection
ws.send({
"type": "enable_heartbeat"
})
// Disable Heartbeat
ws.send({
"type": "disable_heartbeat"
})
// Sample Heartbeat message received periodically by client
{
"type": "heartbeat"
}
Ping/Pong
The client can periodically (~ every 30 seconds) send a ping frame or a raw ping message and the server will respond back with a pong frame or a raw pong response. If the client doesn't receive a pong response in next 5 seconds, the client should exit the existing connection and try to reconnect.
// Ping Request
ws.send({
"type": "ping"
})
// Pong Response
ws.send({
"type": "pong"
})
Public Channels
v2 ticker
The ticker channel provides price change data for the last 24 hrs (rolling window).
It is published every 5 seconds.
To subscribe to the ticker channel, you need to send the list of symbols for which you would like to receive updates.
You can also subscribe to ticker updates for a category of products by sending a list of category names.
For example, to receive updates for put options and futures, use the following format:
{"symbols": ["put_options", "futures"]}
If you would like to subscribe to all listed contracts, pass:
{ "symbols": ["all"] }
Important:
If you subscribe to the ticker channel without specifying a symbols list, you will not receive any data.
Ticker Sample
// Subscribe to specific symbol
{
"type": "subscribe",
"payload": {
"channels": [
{
"name": "v2/ticker",
"symbols": [
"BTCUSD_28Dec"
]
}
]
}
}
// Subscribe to all symbols
{
"type": "subscribe",
"payload": {
"channels": [
{
"name": "v2/ticker",
"symbols": [
"all"
]
}
]
}
}
// Response
{
"open": 0.00001347, // The price at the beginning of the 24-hour period
"close": 0.00001327, // The price at the end of the 24-hour period
"high": 0.00001359, // The highest price during the 24-hour period
"low": 0.00001323, // The lowest price during the 24-hour period
"mark_price": "0.00001325", // The current market price
"mark_change_24h": "-0.1202", // Percentage change in market price over the last 24 hours
"oi": "812.6100", // Open interest, indicating the total number of outstanding contracts
"product_id": 56, // The unique identifier for the product
"quotes": {
"ask_iv": "0.25", // Implied volatility for the ask price (if available)
"ask_size": "922", // The size of the ask (the amount available for sale)
"best_ask": "3171.5", // The best ask price (the lowest price at which the asset is being offered)
"best_bid": "3171.4", // The best bid price (the highest price a buyer is willing to pay)
"bid_iv": "0.25", // Implied volatility for the bid price (if available)
"bid_size": "191", // The size of the bid (the amount a buyer is willing to purchase)
"impact_mid_price": "61200", // Mid price impact, if available (the price midpoint between the best bid and ask)
"mark_iv": "0.29418049" // Mark volatility (volatility of the asset used for mark price calculation)
},
"greeks": { // Options-related metrics, will be null for Futures and Spot products
"delta": "0.01939861", // Rate of change of the option price with respect to the underlying asset's price
"gamma": "0.00006382", // Rate of change of delta with respect to the underlying asset's price
"rho": "0.00718630", // Rate of change of option price with respect to interest rate
"spot": "63449.5", // The current spot price of the underlying asset
"theta": "-81.48397021", // Rate of change of option price with respect to time (time decay)
"vega": "0.72486575" // Sensitivity of the option price to volatility changes
},
"size": 1254631, // Number of contracts traded
"spot_price": "0.00001326", // Spot price at the time of the ticker
"symbol": "BTCUSD_28Dec", // The symbol of the contract
"timestamp": 1595242187705121, // The timestamp of the data (in microseconds)
"turnover": 16.805033569999996, // The total turnover in the settling symbol
"turnover_symbol": "BTC", // The symbol used for settling
"turnover_usd": 154097.09108233, // The turnover value in USD
"volume": 1254631 // Total volume, defined as contract value * size
}
l1_orderbook
l1_orderbook channel provides level1 orderbook updates. You need to send the list of symbols for which you would like to subscribe to L1 orderbook. You can also subscribe to
orderbook updates for category of products by sending category-names. For example: to receive updates for put options and futures, refer this: {"symbols": ["put_options", "futures"]}
.
If you would like to subscribe for all the listed contracts, pass: { "symbols": ["all"] }
.
Please note that if you subscribe to L1 channel without specifying the symbols list, you will not receive any data.
Publish interval: 100 millisecs
Max interval (in case of same data): 5 secs
L1 Orderbook Sample
//Subscribe
{
"type": "subscribe",
"payload": {
"channels": [
{
"name": "l1_orderbook",
"symbols": [
"ETHUSD"
]
}
]
}
}
// l1 orderbook Response
{
"ask_qty":"839",
"best_ask":"1211.3",
"best_bid":"1211.25",
"bid_qty":"772",
"last_sequence_no":1671603257645135,
"last_updated_at":1671603257623000,
"product_id":176,"symbol":"ETHUSD",
"timestamp":1671603257645134,
"type":"l1_orderbook"
}
l1ob
l1ob channel provides best ask and bid price, size updates in the orderbook. You need to send the list of symbols for which you would like to subscribe. If best ask/bid data is same for a symbol, same data will only be sent after the max interval (stated below) has passed since that symbol's data was last sent.
Please note that if you subscribe to l1ob channel without specifying the symbols list, you will not receive any data.
Publish interval: 100 millisecs
Max interval (in case of same data): 5 secs
l1ob subscribe Sample
//Subscribe
{
"type": "subscribe",
"payload": {
"channels": [
{
"name": "l1ob",
"symbols": [
"BTCUSD",
"C-BTC-42000-260124"
]
}
]
}
}
// l1ob sample Response
{
"type":"l1ob",
"s":"BTCUSD", //product symbol
"d": ["37026.2","2133","37025.6","1977"],
// [BestAskPrice, BestAskSize, BestBidPrice, BestBidSize]
// Price and Size will be null for the side with no orders.
"t": 1701157803668868, //message publish time in microsec
"T": 1701157444959989 //orderbook update time in microsec
}
l1ob_c
l1ob_c channel provides best ask and bid price, size updates in the orderbook for an Option chain. You can subscribe to a Asset_Expiry. e.g. To subscribe to data for all BTC Options expiring on 26th January 2024, send "BTC_260124". If best ask/bid data is same for a symbol, same data will only be sent after the max interval (stated below) has passed since that symbol's data was last sent.
The data is Brotli compressed and in base64 encoded string format, to use this data first Brotli decompress to get a list of json.
Please note that if you subscribe to l1ob_c channel without specifying the Asset_Expiry list, you will not receive any data.
Publish interval: 100 millisecs
Max interval (in case of same data): 5 secs
l1ob_c subscribe Sample
//Subscribe
{
"type": "subscribe",
"payload": {
"channels": [
{
"name": "l1ob_c",
"symbols": [
"BTC_260124",
"BTC_270124"
]
}
]
}
}
// l1ob_c Response
{
"type":"l1ob_c",
"s":"BTC_011223", //Asset_Expiry
"c": "G6gA+B0HzjnKz3E2icneQi2yFbPX1mbq5Ok9j49QZ6iGuNDWLDpdfWEDjinwATeecMOF7GTgAjJOddfahjsUbHpW6fEp4spZhjoMQTFpZEo2fjnjvWcEAQyUk2E32VVd3ssdudqRE61qupUB",
//Brotli decompress this to get the below json.
"t": 1701157556471116 //message publish time
}
//Brotli decompressed data format
[{
"T":1701105329216885, //orderbook update time in microsec
"s":"C-BTC-32000-081223", //product symbol
"d":["5246.8","593","5053.2","6655"] // [BestAskPrice, BestAskSize, BestBidPrice, BestBidSize]
},
{
"T":1701105298898194,
"d":["1064.8","593","936.0","989"],
"s":"C-BTC-37500-081223"
}, ...
]
l2_orderbook
l2_orderbook channel provides the complete level2 orderbook for the sepecified list of symbols at a pre-determined frequency. The frequency of updates may vary for different symbols. You can only subscribe to upto 20 symbols on a single connection. Unlike L1 orderbook channel, L2 orderbook channel does not accept product category names or "all" as valid symbols.
Please note that if you subscribe to L2 channel without specifying the symbols list, you will not receive any data.
Publish interval: 1 sec
Max interval (in case of same data): 10 secs
L2 Orderbook Sample
//Subscribe
{
"type": "subscribe",
"payload": {
"channels": [
{
"name": "l2_orderbook",
"symbols": [
"ETHUSD"
]
}
]
}
}
// l2 orderbook Response
{
"type":"l2_orderbook"
"symbol":"ETHUSD",
"product_id": 176,
"buy": [
{
"limit_price":"101.5",
"size":10, // For Futures & Options: number of contracts integer. Spot product: Asset token quantity in string.
"depth":"10" // total size from best bid
},
...
],
"sell": [
{
"limit_price":"102.0",
"size":20,
"depth":"20" // total size from best ask
},
...
],
"last_sequence_no": 6435634,
"last_updated_at": 1671600133884000,
"timestamp":1671600134033215,
}
l2_updates
l2_updates channel provides initial snapshot and then incremental orderbook data. The frequency of updates may vary for different symbols. You can only subscribe to upto 100 symbols on a single connection. l2_updates channel does not accept product category names or "all" as valid symbols.
Please note that if you subscribe to l2_updates channel without specifying the symbols list, you will not receive any data.
Publish interval: 100 millisecs
"action"="update" messages wont be published till there is an orderbook change.
//Subscribe
{
"type": "subscribe",
"payload": {
"channels": [
{
"name": "l2_updates",
"symbols": [
"BTCUSD"
]
}
]
}
}
// Initial snapshot response
{
"action":"snapshot",
"asks":[["16919.0", "1087"], ["16919.5", "1193"], ["16920.0", "510"]],
"bids":[["16918.0", "602"], ["16917.5", "1792"], ["16917.0", "2039"]],
"timestamp":1671140718980723,
"sequence_no":6199,
"symbol":"BTCUSD",
"type":"l2_updates",
"cs":2178756498
}
// Incremental update response
{
"action":"update",
"asks":[["16919.0", "0"], ["16919.5", "710"]],
"bids":[["16918.5", "304"]],
"sequence_no":6200,
"symbol":"BTCUSD",
"type":"l2_updates",
"timestamp": 1671140769059031,
"cs":3409694612
}
// Error response
{
"action":"error",
"symbol":"BTCUSD",
"type":"l2_updates",
"msg":"Snapshot load failed. Verify if product is live and resubscribe after a few secs."
}
How to maintain orderbook locally using this channel:
1) When you subscribe to this channel, the first message with "action"= "snapshot" resembles the complete l2_orderbook at this time. "asks" and "bids" are arrays of ["price", "size"]. (size is number of contracts at this price)
2) After the initial snapshot, messages will be with "action" = "update", resembling the difference between current and previous orderbook state. "asks" and "bids" are arrays of ["price", "new size"]. "asks" are sorted in increasing order of price. "bids" are sorted in decreasing order of price. This is true for both "snapshot" and "update" messages.
3) "sequence_no" field must be used to check if any messages were dropped. "sequence_no" must be +1 of the last message.
e.g. In the snapshot message it is 6199, and the update message has 6200. The next update message must have 6201. In case of sequence_no mismatch, resubscribe to the channel, and start from the beginning.
4) If sequence_no is correct, edit the in-memory orderbook using the "update" message.
Case 1: price already exists, new size is 0 -> Delete this price level.
Case 2: price already exists, new size isn't 0 -> Replace the old size with new size.
Case 3: price doesn’t exists -> insert the price level.
e.g. for the shown snapshot and update messages to create the new orderbook: in the ask side, price level of "16919.0" will be deleted. Size at price level "16919.5" will be changed from "1193" to "710". In the bids side there was no price level of "16918.5", so add a new level of "16918.5" of size "304". Other price levels from the snapshot will remain the same.
5) If "action":"error" message is received, resubscribe this symbol after a few seconds. Can occur in rare cases, e.g. Failed to send "action":"snapshot" message after subscribing due to a race condition, instead an "error" message will be sent.
Checksum: Using this, users can verify the accuracy of orderbook data created using l2_updates. checksum is the "cs" key in the message payload.
Steps to calculate checksum:
1) Edit the old in-memory orderbook with the "update" message received.
2) Create asks_string and bids_string as shown below. where priceN = price at Nth level, sizeN = size at Nth level. Asks are sorted in increasing order and bids in decreasing order by price.
asks_string = price0:size0,price1:size1,…,price9:size9
bids_string = price0:size0,price1:size1,…,price9:size9
checksum_string = asks_string + "|" + bids_string
Only consider the first 10 price levels on both sides. If orderbook as less than 10 levels, use only them.
e.g. If after applying the update, the new orderbook becomes ->
asks = [["100.00", "23"], ["100.05", "34"]]
bids = [["99.04", "87"], ["98.65", "102"], ["98.30", "16"]]
checksum_string = "100.00:23,100.05:34|99.04:87,98.65:102,98.30:16"
3) Calculate the CRC32 value (32-bit unsigned integer) of checksum_string. This should be equal to the checksum provided in the “update” message.
all_trades
all_trades channel provides a real time feed of all trades (fills).
You need to send the list of symbols for which you would like to subscribe to all trades channel. After subscribing to this channel, you get a snapshot of last 50 trades and then trade data in real time. You can also subscribe to
all trades updates for category of products by sending category-names. For example: to receive updates for put options and futures, refer this: {"symbols": ["put_options", "futures"]}
.
If you would like to subscribe for all the listed contracts, pass: { "symbols": ["all"] }
.
Please note that if you subscribe to all_trades channel without specifying the symbols list, you will not receive any data.
All Trades Sample
//Subscribe
{
"type": "subscribe",
"payload": {
"channels": [
{
"name": "all_trades",
"symbols": [
"BTCUSD"
]
}
]
}
}
// All Trades Response Snapshot
{
"symbol": "BTCUSD",
"type": "all_trades_snapshot", // "type" is not "all_trades"
"trades": [ // Recent trades list
{
"buyer_role": "maker",
"seller_role": "taker",
"size": 53, // size in contracts
"price": "25816.5",
"timestamp": 1686577411879974 // time of the trade.
},
... // More recent trades.
]
}
// All Trades Response
{
symbol: "BTCUSD",
price: "25816.5",
size: 100,
type: "all_trades",
buyer_role: "maker",
seller_role: "taker",
timestamp: 1686577411879974
}
mark_price
mark_price channel provides mark price updates at a fixed interval. This is the price on which all open positions are marked for liquidation.Please note that the product symbol is prepended with a "MARK:" to subscribe for mark price.
You need to send the list of symbols for which you would like to subscribe to mark price channel. You can also subscribe to
mark price updates for category of products by sending category-names. For example: to receive updates for put options and futures, refer this: {"symbols": ["put_options", "futures"]}
.
If you would like to subscribe for all the listed contracts, pass: { "symbols": ["all"] }
.
You can also subscribe to a Options chain, by passing 'Asset-Expiry', e.g. {"symbols": ["BTC-310524"] }
will subscribe to all BTC Options expirying on 31st May 2024.
Please note that if you subscribe to mark price channel without specifying the symbols list, you will not receive any data.
Publish interval: 2 secs.
Mark Price Sample
//Subscribe
{
"type": "subscribe",
"payload": {
"channels": [
{
"name": "mark_price",
"symbols": [
"MARK:C-BTC-13000-301222"
]
}
]
}
}
// Mark Price Response
{
"ask_iv":null,
"ask_qty":null,
"best_ask":null,
"best_bid":"9532",
"bid_iv":"5.000",
"bid_qty":"896",
"delta":"0",
"gamma":"0",
"implied_volatility":"0",
"price":"3910.088012",
"price_band":{"lower_limit":"3463.375340559572217228510815","upper_limit":"4354.489445440427782771489185"},
"product_id":39687,
"rho":"0",
"symbol":"MARK:C-BTC-13000-301222",
"timestamp":1671867039712836,
"type":"mark_price",
"vega":"0"
}
spot_price
spot_price channel provides a real time feed of the underlying index prices. Specifying symbols when subscribing to spot_price is necessary to receive updates. No updates are sent for symbol: "all"
Spot Price Sample
//Subscribe
{
"type": "subscribe",
"payload": {
"channels": [
{
"name": "spot_price",
"symbols": [
".DEBNBBTC"
]
}
]
}
}
// Spot Price Response
{
symbol: ".DEBNBBTC",
price: "0.0014579",
type: "spot_price"
}
v2/spot_price
v2/spot_price channel publishes data of underlying index prices at a fixed interval. Specifying symbols when subscribing to v2/spot_price is necessary to receive updates. No updates are sent for symbol: "all"
Publish interval: 1 sec
v2/spot_price Subscribe
//Subscribe
{
"type": "subscribe",
"payload": {
"channels": [
{
"name": "v2/spot_price",
"symbols": [
".DEETHUSDT"
]
}
]
}
}
// Response
{
s: ".DEETHUSDT", # spot index symbol
p: 1349.3412141, # spot price
type: "v2/spot_price"
}
spot_30mtwap_price
spot_30mtwap_price channel provides a real time feed of the 30 min twap of underlying index prices. This is the price used for settlement of options. Specifying symbols when subscribing to spot_30mtwap_price is necessary to receive updates. No updates are sent for symbol: "all"
Spot Price 30mtwap Sample
//Subscribe
{
"type": "subscribe",
"payload": {
"channels": [
{
"name": "spot_30mtwap_price",
"symbols": [
".DEXBTUSDT"
]
}
]
}
}
// Spot 30 minutes twap Price Response
{
symbol: ".DEXBTUSDT",
price: "0.0014579",
type: "spot_30mtwap_price",
timestamp: 1561634049751430
}
funding_rate
funding_rate channel provides a real time feed of funding rates for perpetual contracts.
You need to send the list of symbols for which you would like to subscribe to funding rate channel. You can also subscribe to funding rate updates for category of products by sending category-names. For example: to receive updates for put options and futures, refer this: {"symbols": ["put_options", "futures"]}
.
If you would like to subscribe for all the listed contracts, pass: { "symbols": ["all"] }
.
Please note that if you subscribe to funding rate channel without specifying the symbols list, you will not receive any data.
Funding Rate Sample
//Subscribe
{
"type": "subscribe",
"payload": {
"channels": [
{
"name": "funding_rate",
"symbols": [
"BTCUSD"
]
}
]
}
}
// Funding Rate Response
{
symbol: "BTCUSD",
product_id: 139,
type: "funding_rate",
funding_rate: 0.005701298078111892, // %
funding_rate_8h: 0.005701298078111892, // %
next_funding_realization: 1683734400000000 // %
predicted_funding_rate: 0.007221329334075148, // in us
timestamp: 1683711930547419 // in us
}
product_updates
This channel provides updates when markets are disrupted and resumed. On opening, we conduct a single price auction and auction starting and finish events are also published on this channel. To subscribe, you dont need to pass the symbol list. This channel automatically subscribes to all markets by default.
Product Updates Sample
//Subscribe
{
"type": "subscribe",
"payload": {
"channels": [
{
"name": "product_updates"
}
]
}
}
// Market Disruption Response
{
"type":"product_updates",
"event":"market_disruption",
"product":{
"id":17,
"symbol":"NEOUSDQ",
"trading_status":"disrupted_cancel_only",
},
"timestamp": 1561634049751430,
}
// Auction Started Response
{
"type":"product_updates",
"event":"start_auction",
"product":{
"id":17,
"symbol":"NEOUSDQ",
"trading_status":"disrupted_post_only",
},
"timestamp": 1561634049751430,
}
// Auction Finished Response
{
"type":"product_updates",
"event":"finish_auction",
"product":{
"id":17,
"symbol":"NEOUSDQ",
"trading_status":"operational",
},
"timestamp": 1561634049751430,
}
Market Disruption
When markets are disrupted, orderbook enters into cancel only mode. You can refer to "trading_status" field in product info to determine this. In cancel only mode, you can only cancel your orders. No matching happens in this mode.
Auction Started
When markets need to come up, we conduct a single price auction. In this case, orderbook enters into post only mode. In post only mode, you can post new orders, cancel exisiting orders, add more margin to open positions. No matching happens in this mode. It is possible to see an overlap between asks and bids during this time.
Auction Finished
When auction finishes, markets enter into operational mode and trading continues as usual.
You can read more about the single price auction here
announcements
This channel provides updates on system wide announcements like scheduled maintenance, new contract launches etc. No need to pass any symbols while subscribing to this channel.
Announcements Sample
//Subscribe
{
"type": "subscribe",
"payload": {
"channels": [
{
"name": "announcements"
}
]
}
}
// Maintenance Started Response
{
"type":"announcements",
"event":"maintenance_started",
"maintenance_finish_time": 1561638049751430,
"timestamp": 1561634049751430,
}
// Maintenance Finished Response
{
"type":"announcements",
"event":"maintenance_finished",
"timestamp": 1561634049751430,
}
candlesticks
This channel provides last ohlc candle for given time resolution.
Subscribe to candlestick_${resolution} channel for updates.
List of supported resolutions ["1m","3m","5m","15m","30m","1h","2h","4h","6h","12h","1d","1w","2w","30d"]
You need to send the list of symbols for which you would like to subscribe to candlesticks channel. You can also subscribe to candlesticks
updates for category of products by sending category-names. For example: to receive updates for put options and futures, refer this: {"symbols": ["put_options", "futures"]}
.
Please note that if you subscribe to candlsticks channel without specifying the symbols list, you will not receive any data.
OHLC candles update sample
Sample Subscribe Request
{
"name": "candlestick_1m", // "candlestick_" + resolution
"symbols": [ "BTCUSD" ] // product symbol
}
Sample feed response
{
"candle_start_time": 1596015240000000,
"close": 9223,
"high": 9228,
"low": 9220,
"open": 9221,
"resolution": "1m",
"symbol": "BTCUSD",
"timestamp": 1596015289339699,
"type": "candlestick_1m",
"volume": 1.2
}
Private Channels
Private channels require clients to authenticate.
Margins
This channel provides updates on wallet balances. Updates are sent for a specific asset whenever there is a change in wallet balances and margins for that asset.
Margins Sample
//Subscribe
{
"type": "subscribe",
"payload": {
"channels": [
{
"name": "margins"
}
]
}
}
// margin update
{
"action": "update",
"asset_id": 2, // BTC
"asset_symbol": "BTC", // BTC
"available_balance": "9.385", // Available balance for trading = balance - blocked_margin
"available_balance_for_robo": "9.385", // Available balance for robo trading = balance - blocked_margin
"balance": "10", // Wallet balance = deposits - withdrawals + realised_cashflows
"blocked_margin": "0.615", // Total Margin blocked
"commission": "0.001", // Commissions blocked in isolated margined positions and orders
"cross_asset_liability": "0", // Liability between asset in cross margin mode
"cross_commission": "0.002", // Commissions blocked in cross margined positions and orders
"cross_locked_collateral": "0.003", // Balance blocked for collateral
"cross_order_margin": "0.004", // Margin blocked in cross margined open orders
"cross_position_margin": "0.005", // Margin blocked in cross margined positions
"id": 1, // Wallet Id
"interest_credit": "0", // Interest credited
"order_margin": "0.1", // Margin blocked in isolated margined open orders
"pending_referral_bonus": "0", // Bonus pending
"pending_trading_fee_credit": "0", // Pending trading fee to credit
"portfolio_margin": "0.2", // Margin blocked for portfolio margined positions and orders. Same as blocked margin in portfolio margins channel.
"position_margin": "0.3", // Margin blocked in isolated margined positions
"robo_trading_equity": "0", // Equity for robo trading
"timestamp": 1719397302569921, // Unix timestamp in microseconds
"trading_fee_credit": "0", // Trading fee credited
"type": "margins", // Margins channel
"unvested_amount": "0", // Amount locked. Relevant only for DETO
"user_id": 1 // User id
}
Positions
This channel provides updates whenever there is any change in your open positions.
A snapshot of current open position will be sent after subscribing a symbol, incremental updates will be sent on trade executions.
You need to send the list of symbols for which you would like to subscribe to positions channel. You can also subscribe to positions
updates for category of products by sending category-names. For example: to receive updates for put options and futures, refer this: {"symbols": ["put_options", "futures"]}
.
If you would like to subscribe for all the listed contracts, pass: { "symbols": ["all"] }
.
Please note that if you subscribe to positions channel without specifying the symbols list, you will not receive any data.
Positions Sample
//Subscribe
{
"type": "subscribe",
"payload": {
"channels": [
{
"name": "positions",
"symbols": ["BTCUSD_29Mar"]
}
]
}
}
//Subscribe for all the symbols
{
"type": "subscribe",
"payload": {
"channels": [
{
"name": "positions",
"symbols": ["all"]
}
]
}
}
// Position update
{
"type": "positions",
"action": "", // "create"/"update"/"delete"
"reason": "", // null, "auto_topup"
"symbol": "BTCUSD_29Mar", // Product Symbol
"product_id": 1, // Product ID
"size": -100, // Position size, if > 0 -> long else short
"margin": "0.0121", // Margin blocked in the position
"entry_price": "3500.0", // Avg Entry price of the position
"liquidation_price": "3356.0", // Liquidation trigger price
"bankruptcy_price": "3300.0", // Bankruptcy Price
"commission": "0.00001212" // Commissions blocked for closing the position
}
//Snapshot
{
"result":[
{
"adl_level":"4.3335",
"auto_topup":false,
"bankruptcy_price":"261.82",
"commission":"17.6571408",
"created_at":"2021-04-29T07:25:59Z",
"entry_price":"238.023457888493475682",
"liquidation_price":"260.63",
"margin":"4012.99",
"product_id":357,
"product_symbol":"ZECUSD",
"realized_funding":"-3.08",
"realized_pnl":"6364.57",
"size":-1686,
"updated_at":"2021-04-29T10:00:05Z",
"user_id":1,
"symbol":"ZECUSD"
}
],
"success":true,
"type":"positions",
"action":"snapshot"
}
Orders
Channel provides updates when any order is updated for any action such as fill, quantity change. Need to pass list of product symbols while subscribing.
A snapshot of all open/pending orders will be sent after subscribing a symbol. And all incremental updates will be sent on create/update/delete of orders
All updates including snapshot will have incremental seq_id. seq_id is separate for each symbol.
Any of the following events can be tracked by the reason field in this channel
- fill
- stop_update
- stop_trigger
- stop_cancel
- liquidation
- self_trade
You need to send the list of symbols for which you would like to subscribe to orders channel. You can also subscribe to orders
updates for category of products by sending category-names. For example: to receive updates for put options and futures, refer this: {"symbols": ["put_options", "futures"]}
.
If you would like to subscribe for all the listed contracts, pass: { "symbols": ["all"] }
.
Please note that if you subscribe to orders channel without specifying the symbols list, you will not receive any data.
Orders Sample
//Subscribe
{
"type": "subscribe",
"payload": {
"channels": [
{
"name": "orders",
"symbols": ["BTCUSD_29Mar"]
}
]
}
}
// Order update
{
"type": "orders",
"action": "create", // "create"/"update"/"delete"
"reason": "", // "fill"/"stop_update"/"stop_trigger"/"stop_cancel"/"liquidation"/"self_trade"/null
"symbol": "BTCUSD_29Mar", // Product Symbol
"product_id": 1, // Product ID
"order_id": 1234 // Order id
"client_order_id": "" // Client order id
"size": 100, // Order size
"unfilled_size": 55, // Unfilled size
"average_fill_price": "8999.00" // nil for unfilled orders
"limit_price": "9000.00" // Price of the order
"side": "buy" // Order side (buy or sell)
"cancellation_reason": "cancelled_by_user" // Cancellation reason in case of cancelled order, null otherwise
"stop_order_type": "stop_loss_order", // If a Stop Order -> "stop_loss_order"/"take_profit_order", null otherwise
"bracket_order": false // true for a bracket_order, false otherwise
"state": "open" // "open"/"pending"/"closed"/"cancelled"
"seq_no": 1 // Incremental sequence number
"timestamp": 1594105083998848 // Unix timestamp in microseconds
"stop_price": "9010.00" // stop_price of stop order
"trigger_price_max_or_min": "9020.00" // for trailing stop orders
"bracket_stop_loss_price": "8090.00"
"bracket_stop_loss_limit_price": "8090.00"
"bracket_take_profit_price": "9020"
"bracket_take_profit_limit_price": "9020"
"bracket_trail_amount": "10.00"
}
// Snapshot
{
"meta": {
"seq_no": 7,
"timestamp": 1594149235554045
},
"result": [
{
"id": 1592130,
"limit_price": "9000",
"order_type": "limit_order",
"product_id": 13,
"reduce_only": false,
"side": "buy",
"size": 1,
"state": "open",
"stop_order_type": null,
"stop_price": null,
"time_in_force": "gtc",
"trail_amount": null,
"unfilled_size": 1,
"average_fill_price": "8999.00",
"user_id": 1132
}
],
"success": true,
"symbol": "BTCUSD",
"type": "orders",
"action": "snapshot"
}
UserTrades
Please use "v2/user_trades" channel for better latency.
Channel provides updates for fills. Need to pass list of product symbols while subscribing.
All updates will have incremental seq_id. seq_id is separate for each symbol.
Auto Deleverage Liquidations of a position can be tracked by reason: "adl" in the user_trades channel.
You need to send the list of symbols for which you would like to subscribe to user trades channel. You can also subscribe to user trades
updates for category of products by sending category-names. For example: to receive updates for put options and futures, refer this: {"symbols": ["put_options", "futures"]}
.
If you would like to subscribe for all the listed contracts, pass: { "symbols": ["all"] }
.
Please note that if you subscribe to user trades channel without specifying the symbols list, you will not receive any data.
User Trades Sample
//Subscribe
{
"type": "subscribe",
"payload": {
"channels": [
{
"name": "user_trades",
"symbols": ["BNBBTC_30Nov"]
}
]
}
}
// user_trades
{
"symbol": "BNBBTC_30Nov",
"fill_id": "1234-abcd-qwer-3456",
"reason": "normal" // "normal" or "adl"
"product_id": 7,
"type": "user_trades",
"user_id": 1998,
"order_id": 3283999,
"side": "buy",
"size": 190,
"price": "0.00145791",
"role": "taker",
"client_order_id": "GA123",
"timestamp": 1544091555086559,
"seq_no": 1
}
v2/user_trades
Channel provides updates for fills. Need to pass list of product symbols while subscribing. This channel is similar to user_trades channel, only difference is that, it is faster than user_trades and doesn't contain commission data.
All updates will have incremental sequence_id. sequence_id is separate for each symbol, useful for identifying if any v2/user_trades messages were missed/dropped. The sequence_id will reset to 1 after our systems restart. (usually after maintainaince/market disruption).
Auto Deleverage Liquidations of a position can be tracked by reason: "adl" in the user_trades channel.
You need to send the list of symbols for which you would like to subscribe to v2/user_trades channel. You can also subscribe to v2/user_trades
updates for category of products by sending category-names. For example: to receive updates for put options and futures, refer this: {"symbols": ["put_options", "futures"]}
.
If you would like to subscribe for all the listed contracts, pass: { "symbols": ["all"] }
.
Please note that if you subscribe to v2/user_trades channel without specifying the symbols list, you will not receive any data.
v2/user_trades Sample
//Subscribe
{
"type": "subscribe",
"payload": {
"channels": [
{
"name": "v2/user_trades",
"symbols": ["BTCUSD"]
}
]
}
}
// v2/user_trades
{
"type": "v2/user_trades",
"sy": "BTCUSD", // symbol
"f": "1234-abcd-qwer-3456", // fill_id
"R": "normal" // reason: "normal" or "adl"
"u": 1998, // user_id
"o": 3283999, // order_id
"S": "buy", // side: "buy" or "sell"
"s": 190, // size in contracts
"p": "17289.2", // price
"po": 5, // position (in contracts) after this fill.
"r": "taker", // role: "taker" or "maker"
"c": "GA123", // client_order_id
"t": 1685794274866438, // timestamp of fill creation
"se": 4 // incremental sequence_no
}
PortfolioMargins
Channel provides updates for portfolio margin values of the selected sub-account. These updates are sent every 2 seconds. In case portfolio margin is not enabled on the selected sub-account, no updates will be sent on this channel.
For detailed description of portfolio margin please see user guide
UCF: is unrealised cashflows of your portfolio. These are the cashflows (negative for outgoing and positive for incoming) that will take place if all the positions in your portfolio are closed at prevailing mark prices.
Portfolio Margin Sample
//Subscribe
{
"type": "subscribe",
"payload": {
"channels": [
{
"name": "portfolio_margins",
"symbols": [".DEXBTUSDT"]
}
]
}
}
// portfolio margin update
{
"type": "portfolio_margins",
"user_id": 1,
"asset_id": 2, // BTC
"index_symbol": ".DEXBTUSDT",
liquidation_risk: false,
"blocked_margin": "100", // Margin blocked for current portfolio. Same as portfolio_margin in margins channel.
"mm_wo_ucf": "80",
"mm_w_ucf": "80",
"im_wo_ucf": "100",
"im_w_ucf": "100",
"positions_upl": "0",
"risk_margin": "100",
"risk_matrix":{"down":[{"is_worst":false,"pnl":"230.03686162","price_shock":"10"}],"unchanged":[{"is_worst":false,"pnl":"230.03686162","price_shock":"10"}],"up":[]},
"futures_margin_floor": "20",
"short_options_margin_floor": "20",
"long_options_margin_floor": "20",
"under_liquidation": false,
"commission": "3.444",
"margin_floor": "60",
"timestamp": 1544091555086559, //timestamp in microseconds
"margin_shortfall": "4.5" // key sent when liquidation_risk is true
}
Keys -
- index_symbol
- This is the coin on which portfolio margin is enabled.
- positions_upl
- This is unrealised cashflows (UCF) of your portfolio. These are the cashflows (negative for outgoing and positive for incoming) that will take place if all the positions in your portfolio are closed at prevailing mark prices. Unrealised cashflow is positive for long options and negative for short options.
- im_w_ucf
- This is the initial margin (IM) requirement for the portfolio. IM is computed as max(risk_margin, margin_floor) - UCF.
- If UCF > max(risk_margin, margin_floor) then IM is negative. Negative margin requirement results in increase in your balance available for trading.
- If the Wallet Balance (ex spot orders) is less than IM then you would only be able to place orders that reduce the risk of the portfolio.
- im_wo_ucf
- This is IM without UCF.
- mm_w_ucf
- This is the maintenance margin (MM) requirement for the portfolio. MM is computed as 80% * max(risk_margin, margin_floor) - UCF.
- If the Wallet Balance (ex spot orders) is less than MM then the portfolio will go into liquidation.
- mm_wo_ucf
- This is MM without UCF.
- commission
- This is the trading fees blocked for the open orders/positions (for closing the positions) in the portfolio.
- This is in addition to the IM requirement.
- blocked_margin
- The margin actually blocked for your portfolio. If your Wallet Balance (ex spot orders) is greater than IM + commission then blocked_margin = IM + commissions. Otherwise blocked_margin is equal to the maximum amout we are able to block to meet the portfolio margin requirement.
- If blocked_margin < MM then the portfolio goes into liquidation.
- liquidation_risk
- This flag indicates if the portfolio is at liquidation risk.
- This flag is set to TRUE when blocked_margin < im_w_ucf + commissions.
- under_liquidation
- This flag is set to TRUE when the portfolio is under liquidation.
- margin_shortfall
- This is the minimum topup amount needed to bring the portfolio out of liquidation risk state.
- risk_margin
- The maximum likely loss of the portfolio under the various simulated stress scenarios.
- risk_matrix
- Matrix showing the profit/loss of the portfolio under various simulated stress scenarios.
- Profit/loss for each position and open order is computed with reference to the prevailing mark prices. Positive numbers indicate profit and negative numbers indicate loss.
- margin_floor
- Margin Floor is the minimum risk_margin required for a portfolio.
- It is comprised of sum of futures_margin_floor, long_options_margin_floor, short_options_margin_floor
MMP Trigger
Channel provides updates when MMP is triggered. Market maker protection is available to registered market makers by default. Others can reach out to support for getting access to MMP. More info here.
MMP Trigger Sample
//Subscribe
{
"type": "subscribe",
"payload": {
"channels": [
{
"name": "mmp_trigger"
}
]
}
}
// mmp_trigger response
{
user_id: 1,
asset: "BTC",
frozen_till: 1561634049751430 # timestamp is microseconds, will be -1 if manual reset is enabled
}
Web Socket RPC
You can make requests over rpc (Remote Procedure Call) using the socket api. Almost all rest endpoints can be invoked as rpc calls to the Web Socket Server.
Remote Procedure Call (RPC) is a protocol that one program can use to request a service from a program located in another computer in a network without having to understand network details. RPC uses the client/server model. The requesting program is a client and the service-providing program is the server.
The client sends request message to the server and then waits for the response. Socket connection needs to be authenticated to make RPC requests.
Request Message
The request message must be JSON object with the following fields.
Name | Type | Description |
---|---|---|
type | string | Type of request message. |
payload | object | The payload object contains method, params and id. |
method | string | The method to be invoked. |
params | object | The parameters for the method that needs to be invoked. |
id | string | An identifier of the request. If it is included, then the response will contain the same identifier |
// Socket RPC request message sample
{
"type": "rpc",
"payload" : {
"method": "post/orders",
"params" : {
"order_type":"limit_order",
"size":1,
"side":"buy",
"limit_price":"4200",
"product_id":16,
"post_only":"false",
"reduce_only":"false",
"time_in_force":"gtc"
},
"id": "1234"
}
}
Response Message
The response message will be similar to the REST API.
Changelog
18.10.2024
- Added clickable links to the corresponding API response json schemas under some API "Responses" table. Updated some schemas to match the response. (This is a documentation fix, no changes in API)
- Added "Testnet-India" REST and Websocket host endpoints.
- Changed "Rate Limits" description and added an example.
01.05.2024
- Added "po" positions key in /v2/user_trades websocket private channel.
- Removed "fok" type for orders, as they are no longer supported.
V2 Rest Api
Our v2 Api is significantly faster than the v1 api. Our focus while rebuilding v2 Apis was on the following
- Remove Api gateway overheads as much as possible.
- Remove overheads due to deep nesting in response payload.
- Better Api structure to query only required data.
New Response Format
// The new format supports sending meta data alongside response body.
// Success format
{
success: true,
result: ...., // response body
meta: {
after: "...", // cursor for pagination, is returned in meta
before: null,
},
}
// Error Format
{
success: false,
error: {
code: :insufficient_margin, // error code
context: { // error context
additional_margin_required: "0.121"
}
}
}
Key Api changes
- We have completely removed nested product/asset payloads from live orders and live positions. This ensures the payload is light.
- Rate limiting now works on a fixed window instead of a rolling window.
- Ticker Api - now includes turnover in USD, mark price, spot price.
- Orderbook and trades are now returned in separate Apis.
- For supporting trading strategies which require latest positions, Now we have two different Apis to query position.
/v2/positions - returns only size and entry price. This should be used when you want to get the latest position, but dont need the margin dependent fields like liquidation price, bankruptcy price etc
/v2/positions/margined - returns all fields including margin dependent fields. When the position is updated due to a fill, changes might take some time to reflect in this Api.
- All Apis that support pagination now use cursor based pagination, instead of fixed page size pagination. Check more details in our python rest client docs
New Socket Channels
- Socket Api interface hasn't changed much in terms of connection management and authentication.
- We have deprecated old channels and created new channels which make integration easier.
- To support easy management of live data, all private data channels now support initial snapshots and sequence numbers.
List of new public channels
- v2/ticker - now includes turnover in USD, mark price, spot price
- candlesticks - subscribe to ohlc candle updates for different resolutions
- all_trades - subscribe to all public trades for a symbol
List of new private channels
- orders - subscribe to lifecycle of live orders
- user_trades - subscribe to live user trades/fills feed
- positions - subscribe to position updates
- margins - get margin/wallet updates
Security
We take the security, integrity, availability of our services, and the privacy of our users seriously. We appreciate all security concerns brought forth and are constantly striving to keep on top of the latest threats. Being proactive rather than reactive to emerging security issues is a fundamental belief at Delta Exchange. Every day new security issues and attack vectors are created. Delta Exchange strives to keep abreast of the latest state-of-the-art security developments by working with independent security researchers. We appreciate the community's efforts in creating a more secure world.
Targets In scope
- https://*.delta.exchange
Any domain/property of Delta Exchange Network not listed in the targets section is out of scope. This includes any/all subdomains not listed above.
How to access
- You will access the Delta Exchange service using test accounts and unauthenticated guests.
- Please create a Delta Exchange test account on your own using your test email address. Your email must contain keyword 'test' for example test@gmail.com.
- All emails will go to the email address associated with your account. You will need to activate your account by confirming receipt of the activation email.
- NOTE: Once a vulnerability is found please file a submission immediately. Our security team will investigate and assess the impact.
Reward range
Focus Areas
- User Data / User information Leaks
- Injection attacks (Server/Client side)
- RCE(Remote Code Execution)
- Authentication bypass/validation (Client/Server side)
- Privilege escalation (Vertical/Horizontal)
Technical | Severity | Reward |
---|---|---|
P1 | Critical | Decided by internal team, can be from ($10-$1000) |
P2 | Severe | Decided by internal team, can be from ($10-$1000) |
P3 | Moderate | $10 - $100 |
Rules of engagement
We are interested in hearing about security issues in Production/Dev Delta Exchange environments. There are some things we explicitly ask you not to do
- Do not run automated scans without checking with us first. They are often very noisy.(If running any automated testing tools, be sure to keep well under 75-100 requests per second - otherwise you're likely to get locked out.)
- Do not test the physical security of Delta Exchange offices, employees, equipment, etc.
- Do not run Full fledged exploits which can cause application crashes and affect integrity of our active services. (If you believe you have a exploit that need serious fixes please email us, and we will provide you with said instance for said service.)
- Do not test using social engineering techniques (phishing, vishing, etc.)
- Do not test against any type of customer account without explicit permission from our side.
- Do not access, Destroy or otherwise negatively impact any residential or business customers, or customer data in any way.
- Do not perform DoS or DDoS attacks (Application level, Network Level DOS / DDOS / port flooding attacks are strictly not appreciated as this can cause delay in delivery of our services to our users we suggest you to not to use such methodologies).
- Do not engage In any way attack our end users, or in the trade of stolen user credentials.
- Interacting with real customers or real customer accounts is forbidden.
Rules of reporting
We take our Internal process and workflow seriously, We have a dedicated security team working and testing round the clock, so we would like you to send your reports to only [email protected] and follow below said rules or not following will void you from our bug bounty benefits, Also we would like you to encrypt emails sent to us with a PGP key provided below if the Vulnerability is Severe or Critical.
- We recommend you to use emails which contain test as a keyword in the email address for example test@gmail.com.
- For testing and reporting so that we can identify your activity on our environments, also whitelist for IDS/FDS blocks)
- Do not CC or tag other staff while reporting.
- Do not callout on social media or make blog posts to report or without reporting (this can lead to legal actions to be taken against you.)
- Do not discuss this with any, but only Delta Exchange technical staff.
- Do not send us external-links/executable/scripts in report if possible attach a text file or pdf. Without zipp'ing or rar'ing it.
- Screenshots are accepted if only in PNG and JIF formats for internal security reasons.
- POC Videos are accepted if only in MP4,AVI, WEBM, MOV formats for internal security reasons.
- Any or All reports must only reach [email protected].
Recommended Reporting format
Summary
Help us get an idea of what this vulnerability is about.
(eg. "hey i have found a xss on your server")
Target
Select the vulnerable target Domain name / Subdomain name
(eg. "so and so on https://example.delta.exchange")
Vulnerability details
What is the Bug/Vulnerability. And URL / Location of vulnerability .
(eg. because of unfiltered characters the url [/search.php?q=
Description of Technical severity
Help us understand the bug/vulnerability technical details Describe the vulnerability and its impact.
(eg. client side executes the javascript which is rendering through /search.php?q=somescript)
Recreation
Provide a proof of concept or replication steps.
(eg. steps to be used by our team in order to recreate the attack scenario)
Additional information
Provide us with Request and Response dump / trace dump / HTTP request
Attachments (recommended)
Attach proof-of-concept scripts, screenshots, screen recordings, etc.
Ineligible issues
These issues Will be closed as out of scope hence not rewardable.
- Theoretical vulnerabilities without actual proof of concept
- Open redirects (through headers and parameters) / Lack of security speed bump when leaving the site.
- Internal IP address / version disclosure.
- Email verification deficiencies, expiration of password reset links, and password complexity policies
- Invalid or missing SPF (Sender Policy Framework) records (incomplete or missing SPF/DKIM/DMARC)
- Click jacking/UI redressing with minimal security impact
- Text/code injection without any impact.
- Email or mobile enumeration (E.g. the ability to identify emails via password reset)
- Information disclosure with minimal security impact (E.g. stack traces, path disclosure, directory listings, logs)
- Internally known issues, duplicate issues, or issues which have already been made public
- Rate limiting issues / Tab-nabbing
- Non url Selfless / HTMLi
- Known CVE without proper testing.
- Vulnerabilities only exploitable on out-of-date browsers or platforms
- CSRF issues that don't impact the integrity of an account (e.g. log in or out, contact forms and other publicly accessible forms)
- Vulnerabilities related to auto-fill web forms
- Use of known vulnerable libraries without actual proof of concept
- Lack of security flags in cookies
- Issues related to unsafe SSL/TLS cipher suites or protocol version
- Session expiry / Cookie issues / Content spoofing
- Cache-control related issues
- Missing security headers that do not lead to direct exploitation
- CSRF with negligible security impact (E.g. adding to favorites, adding to cart, subscribing to a non-critical feature)
- Vulnerabilities that require root/jailbreak
- Vulnerabilities that require physical access to a user's device
- Issues that have no security impact (E.g. Failure to load a web page)
- Phishing (E.g. HTTP Basic Authentication Phishing)
- Any activity (like DoS/DDoS) that disrupts our services
- Installation Path Permissions
- Reports from automated tools or scans
Not following any one of the above rule will disqualify you from our bug bounty program.
If any doubts related to your submissions or creative dialogue please feel free to email [email protected] or [email protected].