NAV Navbar
Python Shell Ruby

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:

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. Pagination can be called in following APIs

API End point
Orders /orders
Orders History /orders/history
Fills /fills
Wallet transactions /wallet/transactions

Pagination parameters

In API response following headers will be received

Example

https://api.delta.exchange/orders?state=open&page_num=1&page_size=30

Data Centers

Delta Exchange data centers are in AWS Ireland

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 inorder to avoid following issue:

above error will be thrown if you are not using correct key, please check hostname e.g. errorneouly Testnet.Delta.exchange api key have been used insted of Delta.exchange api key

Check api key have required permissions like trading permission

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

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:

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.

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

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 = '/orders'
query = '?product_id=1&state=open'
signature_data = method + timestamp + path + query + 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'
}

# Place new order
method = 'POST'
timestamp = get_time_stamp()
path = '/orders'
query = ''
payload = "{\"order_type\":\"limit_order\",\"size\":3,\"side\":\"buy\",\"limit_price\":\"0.0005\",\"product_id\":1}"

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'
}

Rate Limits

When a rate limit is exceeded, a status of 429 Too Many Requests will be returned. 'X-RATE-LIMIT-RESET' is returned in response header with time left in milisecond after which next API request can be hit.

REST API

Limits

We throttle unauthenticated api requests by IP and authenticated requests by user ID. These are the limits for different categories of requests in a 5 minute rolling window.

Request Type Limit Description
Chart data 1000 Requests for chart data
Public read requests 500 Requests to get list of live products, L2 orderbook etc
Private read requests 200 Requests to get open orders, fills, positions etc
Private write requests 150 Requests to place orders, change leverage, cancel orders etc
Account requests 200 Requests to change password, create api keys etc
Others 300 All other requests

Increasing your rate limits

If you are running up against our limits and believe that you have a legitimate need, please email us at (support@delta.exchange)[mailto:support@delta.exchange] 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

Place order error description

various errors returned by system while placing order

error description
InsufficientMargin Margin required to place order with selected leverage and quantity is insufficient.
OrderSizeExceededAvailable order size more than available, the order book doesn't have sufficient liquidity.
OrderExceedsSizeLimit orders couldn't be placed as it will breach allowed risk limits.
OrderLeverageNotSet Order leverage is not set for this order, set any order leverage.
InvalidProduct The contract/product is either doesn\'t exist or has already expired.
ImmediateLiquidationOrder Order will cause immediate liquidation.
LowerthanBankruptcy Order prices are out of position bankruptcy limits.
SelfMatchingPostOnlyMode Self matching is not allowed in post only mode.
ImmediateExecutionPostOnlyOrder orders couldn't be placed as it includes post only orders which will be immediately executed.
BracketOrderPositionExists Cannot add bracket order when position already exists.
InvalidBracketOrder Cannot add bracket order because either the stop loss price or take profit price is incorrect.

title: Delta Exchange Api language_tabs: - python: Python - shell: Shell - ruby: Ruby toc_footers: [] includes: [] search: true highlight_theme: darkula headingLevel: 2


API

The REST API has endpoints for account and order management as well as public market data.

REST API ENDPOINT URL

Assets

Get Asset List

Get list of all assets

Code samples

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('https://api.delta.exchange/assets', params={

}, headers = headers)

print r.json()

# You can also use wget
curl -X GET https://api.delta.exchange/assets \
  -H 'Accept: application/json'

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get 'https://api.delta.exchange/assets',
  params: {
  }, headers: headers

p JSON.parse(result)

GET /assets

Example responses

200 Response

[
  {
    "id": 0,
    "symbol": "string",
    "precision": 0
  }
]

Responses

Status Meaning Description Schema
200 OK List of all assets ArrayOfAssets

Products

Get Product List, 24hr Ticker

Get live products

Code samples

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('https://api.delta.exchange/products', params={

}, headers = headers)

print r.json()

# You can also use wget
curl -X GET https://api.delta.exchange/products \
  -H 'Accept: application/json'

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get 'https://api.delta.exchange/products',
  params: {
  }, headers: headers

p JSON.parse(result)

GET /products

Example responses

200 Response

[
  {
    "id": 0,
    "symbol": "string",
    "description": "string",
    "created_at": "string",
    "updated_at": "string",
    "settlement_time": "string",
    "product_type": "future",
    "pricing_source": "string",
    "impact_size": 0,
    "initial_margin": 0,
    "maintenance_margin": "string",
    "contract_value": "string",
    "contract_unit_currency": "string",
    "tick_size": "string",
    "trading_status": "operational",
    "max_leverage_notional": "string",
    "default_leverage": "string",
    "initial_margin_scaling_factor": "string",
    "maintenance_margin_scaling_factor": "string",
    "commission_rate": "string",
    "maker_commission_rate": "string",
    "liquidation_penalty_factor": "string",
    "contract_type": "string",
    "position_size_limit": 0,
    "basis_factor_max_limit": "string",
    "is_quanto": true,
    "funding_method": "string",
    "annualized_funding": "string",
    "price_band": "string",
    "underlying_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    },
    "quoting_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    },
    "settling_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    }
  }
]

Responses

Status Meaning Description Schema
200 OK List of live products ArrayOfProducts

Get 24hr ticker

Code samples

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('https://api.delta.exchange/products/ticker/24hr', params={
  'symbol': 'string'
}, headers = headers)

print r.json()

# You can also use wget
curl -X GET https://api.delta.exchange/products/ticker/24hr?symbol=string \
  -H 'Accept: application/json'

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get 'https://api.delta.exchange/products/ticker/24hr',
  params: {
  'symbol' => 'string'
}, headers: headers

p JSON.parse(result)

GET /products/ticker/24hr

Parameters

Parameter In Type Required Description
symbol query string true product symbol

Example responses

200 Response

{
  "symbol": "string",
  "timestamp": 0,
  "open": 0,
  "high": 0,
  "low": 0,
  "close": 0,
  "volume": 0
}

Responses

Status Meaning Description Schema
200 OK Ticker Date 24hrTicker

Orders

Placing Orders, Cancelling Orders, Placing batch orders, Cancelling batch orders, Get Open orders, Change Orders Leverage

Place Order

Code samples

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'api-key': '****',
  'signature': '****',
  'timestamp': '****'
}

r = requests.post('https://api.delta.exchange/orders', params={

}, headers = headers)

print r.json()

# You can also use wget
curl -X POST https://api.delta.exchange/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.delta.exchange/orders',
  params: {
  }, headers: headers

p JSON.parse(result)

POST /orders

Body parameter

{
  "product_id": 0,
  "limit_price": "string",
  "size": 0,
  "side": "buy",
  "order_type": "limit_order",
  "time_in_force": "gtc",
  "bracket_order": {
    "stop_loss_price": "string",
    "take_profit_price": "string",
    "trail_amount": "string"
  }
}

Parameters

Parameter In Type Required Description
body body CreateOrderRequest true Order which needs to be created

Example responses

200 Response

{
  "id": 0,
  "user_id": 0,
  "size": 0,
  "unfilled_size": 0,
  "side": "buy",
  "order_type": "limit_order",
  "limit_price": "string",
  "stop_order_type": "stop_loss_order",
  "stop_price": "string",
  "close_on_trigger": "false",
  "state": "open",
  "created_at": "string",
  "product": {
    "id": 0,
    "symbol": "string",
    "description": "string",
    "created_at": "string",
    "updated_at": "string",
    "settlement_time": "string",
    "product_type": "future",
    "pricing_source": "string",
    "impact_size": 0,
    "initial_margin": 0,
    "maintenance_margin": "string",
    "contract_value": "string",
    "contract_unit_currency": "string",
    "tick_size": "string",
    "trading_status": "operational",
    "max_leverage_notional": "string",
    "default_leverage": "string",
    "initial_margin_scaling_factor": "string",
    "maintenance_margin_scaling_factor": "string",
    "commission_rate": "string",
    "maker_commission_rate": "string",
    "liquidation_penalty_factor": "string",
    "contract_type": "string",
    "position_size_limit": 0,
    "basis_factor_max_limit": "string",
    "is_quanto": true,
    "funding_method": "string",
    "annualized_funding": "string",
    "price_band": "string",
    "underlying_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    },
    "quoting_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    },
    "settling_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    }
  }
}

Responses

Status Meaning Description Schema
200 OK Returns back the order object with assigned id and latest state Order
400 Bad Request Returns error if order could not be placed Inline

Response Schema

Status Code 400

Name Type Required Restrictions Description
» error string false none none
» message string false none A more verbose error message

Enumerated Values

Property Value
error InsufficientMargin
error OrderSizeExceededAvailable
error OrderExceedsSizeLimit
error OrderLeverageNotSet
error InvalidProduct
error ImmediateLiquidationOrder
error LowerthanBankruptcy
error SelfMatchingPostOnlyMode
error ImmediateExecutionPostOnlyOrder
error BracketOrderPositionExists
error InvalidBracketOrder

Cancel Order

Code samples

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'api-key': '****',
  'signature': '****',
  'timestamp': '****'
}

r = requests.delete('https://api.delta.exchange/orders', params={

}, headers = headers)

print r.json()

# You can also use wget
curl -X DELETE https://api.delta.exchange/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.delta.exchange/orders',
  params: {
  }, headers: headers

p JSON.parse(result)

DELETE /orders

Body parameter

{
  "id": 0,
  "product_id": 0
}

Parameters

Parameter In Type Required Description
body body DeleteOrderRequest true Order which needs to be cancelled

Example responses

200 Response

{
  "id": 0,
  "user_id": 0,
  "size": 0,
  "unfilled_size": 0,
  "side": "buy",
  "order_type": "limit_order",
  "limit_price": "string",
  "stop_order_type": "stop_loss_order",
  "stop_price": "string",
  "close_on_trigger": "false",
  "state": "open",
  "created_at": "string",
  "product": {
    "id": 0,
    "symbol": "string",
    "description": "string",
    "created_at": "string",
    "updated_at": "string",
    "settlement_time": "string",
    "product_type": "future",
    "pricing_source": "string",
    "impact_size": 0,
    "initial_margin": 0,
    "maintenance_margin": "string",
    "contract_value": "string",
    "contract_unit_currency": "string",
    "tick_size": "string",
    "trading_status": "operational",
    "max_leverage_notional": "string",
    "default_leverage": "string",
    "initial_margin_scaling_factor": "string",
    "maintenance_margin_scaling_factor": "string",
    "commission_rate": "string",
    "maker_commission_rate": "string",
    "liquidation_penalty_factor": "string",
    "contract_type": "string",
    "position_size_limit": 0,
    "basis_factor_max_limit": "string",
    "is_quanto": true,
    "funding_method": "string",
    "annualized_funding": "string",
    "price_band": "string",
    "underlying_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    },
    "quoting_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    },
    "settling_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    }
  }
}

Responses

Status Meaning Description Schema
200 OK Returns back the order object Order
400 Bad Request Returns error if order could not be cancelled Inline

Response Schema

Status Code 400

Name Type Required Restrictions Description
» error string false none none
» message string false none A more verbose error message

Enumerated Values

Property Value
error ALREADY_FILLED
error InvalidOrder
error InvalidProduct

Get Orders

Code samples

import requests
headers = {
  'Accept': 'application/json',
  'api-key': '****',
  'signature': '****',
  'timestamp': '****'
}

r = requests.get('https://api.delta.exchange/orders', params={

}, headers = headers)

print r.json()

# You can also use wget
curl -X GET https://api.delta.exchange/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.delta.exchange/orders',
  params: {
  }, headers: headers

p JSON.parse(result)

GET /orders

Parameters

Parameter In Type Required Description
product_id query integer false get orders for a particular product id
state query string false get orders with a particular state
stop_order_type query string false get stop orders with stop_order_type
page_num query integer false page number for pagination
page_size query integer false page size for pagination

Enumerated Values

Parameter Value
state open
state closed
state cancelled
stop_order_type stop_loss_order

Example responses

200 Response

[
  {
    "id": 0,
    "user_id": 0,
    "size": 0,
    "unfilled_size": 0,
    "side": "buy",
    "order_type": "limit_order",
    "limit_price": "string",
    "stop_order_type": "stop_loss_order",
    "stop_price": "string",
    "close_on_trigger": "false",
    "state": "open",
    "created_at": "string",
    "product": {
      "id": 0,
      "symbol": "string",
      "description": "string",
      "created_at": "string",
      "updated_at": "string",
      "settlement_time": "string",
      "product_type": "future",
      "pricing_source": "string",
      "impact_size": 0,
      "initial_margin": 0,
      "maintenance_margin": "string",
      "contract_value": "string",
      "contract_unit_currency": "string",
      "tick_size": "string",
      "trading_status": "operational",
      "max_leverage_notional": "string",
      "default_leverage": "string",
      "initial_margin_scaling_factor": "string",
      "maintenance_margin_scaling_factor": "string",
      "commission_rate": "string",
      "maker_commission_rate": "string",
      "liquidation_penalty_factor": "string",
      "contract_type": "string",
      "position_size_limit": 0,
      "basis_factor_max_limit": "string",
      "is_quanto": true,
      "funding_method": "string",
      "annualized_funding": "string",
      "price_band": "string",
      "underlying_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      },
      "quoting_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      },
      "settling_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      }
    }
  }
]

Responses

Status Meaning Description Schema
200 OK List of orders as per the query ArrayOfOrders

Edit Order

Code samples

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'api-key': '****',
  'signature': '****',
  'timestamp': '****'
}

r = requests.put('https://api.delta.exchange/orders', params={

}, headers = headers)

print r.json()

# You can also use wget
curl -X PUT https://api.delta.exchange/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.delta.exchange/orders',
  params: {
  }, headers: headers

p JSON.parse(result)

PUT /orders

Body parameter

{
  "id": 0,
  "product_id": 0,
  "limit_price": "string",
  "unfilled_size": 0
}

Parameters

Parameter In Type Required Description
body body EditOrderRequest true Order which needs to be edited

Example responses

200 Response

{
  "id": 0,
  "user_id": 0,
  "size": 0,
  "unfilled_size": 0,
  "side": "buy",
  "order_type": "limit_order",
  "limit_price": "string",
  "stop_order_type": "stop_loss_order",
  "stop_price": "string",
  "close_on_trigger": "false",
  "state": "open",
  "created_at": "string",
  "product": {
    "id": 0,
    "symbol": "string",
    "description": "string",
    "created_at": "string",
    "updated_at": "string",
    "settlement_time": "string",
    "product_type": "future",
    "pricing_source": "string",
    "impact_size": 0,
    "initial_margin": 0,
    "maintenance_margin": "string",
    "contract_value": "string",
    "contract_unit_currency": "string",
    "tick_size": "string",
    "trading_status": "operational",
    "max_leverage_notional": "string",
    "default_leverage": "string",
    "initial_margin_scaling_factor": "string",
    "maintenance_margin_scaling_factor": "string",
    "commission_rate": "string",
    "maker_commission_rate": "string",
    "liquidation_penalty_factor": "string",
    "contract_type": "string",
    "position_size_limit": 0,
    "basis_factor_max_limit": "string",
    "is_quanto": true,
    "funding_method": "string",
    "annualized_funding": "string",
    "price_band": "string",
    "underlying_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    },
    "quoting_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    },
    "settling_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    }
  }
}

Responses

Status Meaning Description Schema
200 OK Returns back the order object with assigned id and latest state Order
400 Bad Request Returns error if order could not be placed Inline

Response Schema

Status Code 400

Name Type Required Restrictions Description
» error string false none none
» message string false none A more verbose error message

Enumerated Values

Property Value
error InsufficientMargin
error OrderSizeExceededAvailable
error OrderExceedsSizeLimit
error OrderLeverageNotSet
error InvalidProduct
error ImmediateLiquidationOrder
error LowerthanBankruptcy
error SelfMatchingPostOnlyMode
error ImmediateExecutionPostOnlyOrder

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.delta.exchange/orders/all', params={

}, headers = headers)

print r.json()

# You can also use wget
curl -X DELETE https://api.delta.exchange/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.delta.exchange/orders/all',
  params: {
  }, headers: headers

p JSON.parse(result)

DELETE /orders/all

Body parameter

{
  "product_id": 0,
  "cancel_limit_orders": "true",
  "cancel_stop_orders": "true"
}

Parameters

Parameter In Type Required Description
body body CancelAllFilterObject false Filters for selecting orders that needs to be cancelled

Example responses

200 Response

{}

Responses

Status Meaning Description Schema
200 OK returns back success response Inline
400 Bad Request Returns error if orders could not be cancelled Inline

Response Schema

Status Code 400

Name Type Required Restrictions Description
» error string false none none
» message string false none A more verbose error message

Enumerated Values

Property Value
error InvalidProduct

Place Bracket Order

Code samples

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'api-key': '****',
  'signature': '****',
  'timestamp': '****'
}

r = requests.post('https://api.delta.exchange/orders/bracket', params={

}, headers = headers)

print r.json()

# You can also use wget
curl -X POST https://api.delta.exchange/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.delta.exchange/orders/bracket',
  params: {
  }, headers: headers

p JSON.parse(result)

POST /orders/bracket

Body parameter

{
  "product_id": 0,
  "stop_loss_order": {
    "order_type": "market_order",
    "stop_price": "string"
  },
  "take_profit_order": {
    "order_type": "market_order",
    "stop_price": "string"
  }
}

Parameters

Parameter In Type Required Description
body body CreateBracketOrderRequest true Bracket order which needs to be created

Example responses

200 Response

{
  "stop_loss_order": {
    "id": 0,
    "user_id": 0,
    "size": 0,
    "unfilled_size": 0,
    "side": "buy",
    "order_type": "limit_order",
    "limit_price": "string",
    "stop_order_type": "stop_loss_order",
    "stop_price": "string",
    "close_on_trigger": "false",
    "state": "open",
    "created_at": "string",
    "product": {
      "id": 0,
      "symbol": "string",
      "description": "string",
      "created_at": "string",
      "updated_at": "string",
      "settlement_time": "string",
      "product_type": "future",
      "pricing_source": "string",
      "impact_size": 0,
      "initial_margin": 0,
      "maintenance_margin": "string",
      "contract_value": "string",
      "contract_unit_currency": "string",
      "tick_size": "string",
      "trading_status": "operational",
      "max_leverage_notional": "string",
      "default_leverage": "string",
      "initial_margin_scaling_factor": "string",
      "maintenance_margin_scaling_factor": "string",
      "commission_rate": "string",
      "maker_commission_rate": "string",
      "liquidation_penalty_factor": "string",
      "contract_type": "string",
      "position_size_limit": 0,
      "basis_factor_max_limit": "string",
      "is_quanto": true,
      "funding_method": "string",
      "annualized_funding": "string",
      "price_band": "string",
      "underlying_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      },
      "quoting_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      },
      "settling_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      }
    }
  },
  "take_profit_order": {
    "id": 0,
    "user_id": 0,
    "size": 0,
    "unfilled_size": 0,
    "side": "buy",
    "order_type": "limit_order",
    "limit_price": "string",
    "stop_order_type": "stop_loss_order",
    "stop_price": "string",
    "close_on_trigger": "false",
    "state": "open",
    "created_at": "string",
    "product": {
      "id": 0,
      "symbol": "string",
      "description": "string",
      "created_at": "string",
      "updated_at": "string",
      "settlement_time": "string",
      "product_type": "future",
      "pricing_source": "string",
      "impact_size": 0,
      "initial_margin": 0,
      "maintenance_margin": "string",
      "contract_value": "string",
      "contract_unit_currency": "string",
      "tick_size": "string",
      "trading_status": "operational",
      "max_leverage_notional": "string",
      "default_leverage": "string",
      "initial_margin_scaling_factor": "string",
      "maintenance_margin_scaling_factor": "string",
      "commission_rate": "string",
      "maker_commission_rate": "string",
      "liquidation_penalty_factor": "string",
      "contract_type": "string",
      "position_size_limit": 0,
      "basis_factor_max_limit": "string",
      "is_quanto": true,
      "funding_method": "string",
      "annualized_funding": "string",
      "price_band": "string",
      "underlying_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      },
      "quoting_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      },
      "settling_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      }
    }
  }
}

Responses

Status Meaning Description Schema
200 OK Returns back the stop loss and take profit orders with assigned ids and latest states BracketOrder
400 Bad Request Returns error if order could not be placed Inline

Response Schema

Status Code 400

Name Type Required Restrictions Description
» error string false none none
» message string false none A more verbose error message

Enumerated Values

Property Value
error ImmediateExecutionStopOrder
error CloseOnTriggerExists
error NoOpenPosition

Create batch orders

Code samples

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'api-key': '****',
  'signature': '****',
  'timestamp': '****'
}

r = requests.post('https://api.delta.exchange/orders/batch', params={

}, headers = headers)

print r.json()

# You can also use wget
curl -X POST https://api.delta.exchange/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.delta.exchange/orders/batch',
  params: {
  }, headers: headers

p JSON.parse(result)

POST /orders/batch

Body parameter

[
  {
    "product_id": 0,
    "limit_price": "string",
    "size": 0,
    "side": "buy",
    "order_type": "limit_order",
    "time_in_force": "gtc",
    "bracket_order": {
      "stop_loss_price": "string",
      "take_profit_price": "string",
      "trail_amount": "string"
    }
  }
]

Parameters

Parameter In Type Required Description
body body ArrayOfCreateOrderRequest 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

{
  "id": 0,
  "user_id": 0,
  "size": 0,
  "unfilled_size": 0,
  "side": "buy",
  "order_type": "limit_order",
  "limit_price": "string",
  "stop_order_type": "stop_loss_order",
  "stop_price": "string",
  "close_on_trigger": "false",
  "state": "open",
  "created_at": "string",
  "product": {
    "id": 0,
    "symbol": "string",
    "description": "string",
    "created_at": "string",
    "updated_at": "string",
    "settlement_time": "string",
    "product_type": "future",
    "pricing_source": "string",
    "impact_size": 0,
    "initial_margin": 0,
    "maintenance_margin": "string",
    "contract_value": "string",
    "contract_unit_currency": "string",
    "tick_size": "string",
    "trading_status": "operational",
    "max_leverage_notional": "string",
    "default_leverage": "string",
    "initial_margin_scaling_factor": "string",
    "maintenance_margin_scaling_factor": "string",
    "commission_rate": "string",
    "maker_commission_rate": "string",
    "liquidation_penalty_factor": "string",
    "contract_type": "string",
    "position_size_limit": 0,
    "basis_factor_max_limit": "string",
    "is_quanto": true,
    "funding_method": "string",
    "annualized_funding": "string",
    "price_band": "string",
    "underlying_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    },
    "quoting_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    },
    "settling_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    }
  }
}

Responses

Status Meaning Description Schema
200 OK returns the orders placed Order
400 Bad Request returns error if orders couldnt be placed Inline

Response Schema

Status Code 400

Name Type Required Restrictions Description
» error string false none none
» message string false none A more verbose error message

Enumerated Values

Property Value
error InsufficientMargin
error OrderSizeExceededAvailable
error OrderExceedsSizeLimit
error OrderLeverageNotSet
error InvalidProduct
error ImmediateLiquidationOrder
error LowerthanBankruptcy

Delele batch orders

Code samples

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'api-key': '****',
  'signature': '****',
  'timestamp': '****'
}

r = requests.delete('https://api.delta.exchange/orders/batch', params={

}, headers = headers)

print r.json()

# You can also use wget
curl -X DELETE https://api.delta.exchange/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.delta.exchange/orders/batch',
  params: {
  }, headers: headers

p JSON.parse(result)

DELETE /orders/batch

Body parameter

[
  {
    "id": 0,
    "product_id": 0
  }
]

Parameters

Parameter In Type Required Description
body body ArrayOfDeleteOrderRequest true none

Example responses

200 Response

{
  "id": 0,
  "user_id": 0,
  "size": 0,
  "unfilled_size": 0,
  "side": "buy",
  "order_type": "limit_order",
  "limit_price": "string",
  "stop_order_type": "stop_loss_order",
  "stop_price": "string",
  "close_on_trigger": "false",
  "state": "open",
  "created_at": "string",
  "product": {
    "id": 0,
    "symbol": "string",
    "description": "string",
    "created_at": "string",
    "updated_at": "string",
    "settlement_time": "string",
    "product_type": "future",
    "pricing_source": "string",
    "impact_size": 0,
    "initial_margin": 0,
    "maintenance_margin": "string",
    "contract_value": "string",
    "contract_unit_currency": "string",
    "tick_size": "string",
    "trading_status": "operational",
    "max_leverage_notional": "string",
    "default_leverage": "string",
    "initial_margin_scaling_factor": "string",
    "maintenance_margin_scaling_factor": "string",
    "commission_rate": "string",
    "maker_commission_rate": "string",
    "liquidation_penalty_factor": "string",
    "contract_type": "string",
    "position_size_limit": 0,
    "basis_factor_max_limit": "string",
    "is_quanto": true,
    "funding_method": "string",
    "annualized_funding": "string",
    "price_band": "string",
    "underlying_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    },
    "quoting_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    },
    "settling_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    }
  }
}

Responses

Status Meaning Description Schema
200 OK returns the orders deleted Order
400 Bad Request returns error if orders couldnt be deleted Inline

Response Schema

Status Code 400

Name Type Required Restrictions Description
» error string false none none
» message string false none A more verbose error message

Enumerated Values

Property Value
error ALREADY_FILLED
error InvalidOrder
error InvalidProduct

Change order leverage

Code samples

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': '*/*',
  'api-key': '****',
  'signature': '****',
  'timestamp': '****'
}

r = requests.post('https://api.delta.exchange/orders/leverage', params={

}, headers = headers)

print r.json()

# You can also use wget
curl -X POST https://api.delta.exchange/orders/leverage \
  -H 'Content-Type: application/json' \
  -H 'Accept: */*' \
  -H 'api-key: ****' \
  -H 'signature: ****' \
  -H 'timestamp: ****'

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => '*/*',
  'api-key' => '****',
  'signature' => '****',
  'timestamp' => '****'
}

result = RestClient.post 'https://api.delta.exchange/orders/leverage',
  params: {
  }, headers: headers

p JSON.parse(result)

POST /orders/leverage

Body parameter

{
  "product_id": 0,
  "leverage": "string"
}

Parameters

Parameter In Type Required Description
body body object true none
» product_id body integer true none
» leverage body string true none

Example responses

200 Response

Responses

Status Meaning Description Schema
200 OK returns the OrderLeverage object OrderLeverage
400 Bad Request Returns error if leverage couldnt be changed Inline

Response Schema

Status Code 400

Name Type Required Restrictions Description
» error string false none none
» message string false none A more verbose error message

Enumerated Values

Property Value
error InsufficientMargin
error LeverageLimitExceeded

Get order leverage

Code samples

import requests
headers = {
  'Accept': '*/*',
  'api-key': '****',
  'signature': '****',
  'timestamp': '****'
}

r = requests.get('https://api.delta.exchange/orders/leverage', params={
  'product_id': '0'
}, headers = headers)

print r.json()

# You can also use wget
curl -X GET https://api.delta.exchange/orders/leverage?product_id=0 \
  -H 'Accept: */*' \
  -H 'api-key: ****' \
  -H 'signature: ****' \
  -H 'timestamp: ****'

require 'rest-client'
require 'json'

headers = {
  'Accept' => '*/*',
  'api-key' => '****',
  'signature' => '****',
  'timestamp' => '****'
}

result = RestClient.get 'https://api.delta.exchange/orders/leverage',
  params: {
  'product_id' => 'integer'
}, headers: headers

p JSON.parse(result)

GET /orders/leverage

Parameters

Parameter In Type Required Description
product_id query integer true none

Example responses

200 Response

Responses

Status Meaning Description Schema
200 OK returns the OrderLeverage object OrderLeverage

Positions

Get Open positions, Change Position Margin, Close Position

Get open positions

Code samples

import requests
headers = {
  'Accept': 'application/json',
  'api-key': '****',
  'signature': '****',
  'timestamp': '****'
}

r = requests.get('https://api.delta.exchange/positions', params={

}, headers = headers)

print r.json()

# You can also use wget
curl -X GET https://api.delta.exchange/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.delta.exchange/positions',
  params: {
  }, headers: headers

p JSON.parse(result)

GET /positions

Example responses

200 Response

[
  {
    "user_id": 0,
    "size": 0,
    "entry_price": "string",
    "margin": "string",
    "liquidation_price": "string",
    "bankruptcy_price": "string",
    "adl_level": 0,
    "product": {
      "id": 0,
      "symbol": "string",
      "description": "string",
      "created_at": "string",
      "updated_at": "string",
      "settlement_time": "string",
      "product_type": "future",
      "pricing_source": "string",
      "impact_size": 0,
      "initial_margin": 0,
      "maintenance_margin": "string",
      "contract_value": "string",
      "contract_unit_currency": "string",
      "tick_size": "string",
      "trading_status": "operational",
      "max_leverage_notional": "string",
      "default_leverage": "string",
      "initial_margin_scaling_factor": "string",
      "maintenance_margin_scaling_factor": "string",
      "commission_rate": "string",
      "maker_commission_rate": "string",
      "liquidation_penalty_factor": "string",
      "contract_type": "string",
      "position_size_limit": 0,
      "basis_factor_max_limit": "string",
      "is_quanto": true,
      "funding_method": "string",
      "annualized_funding": "string",
      "price_band": "string",
      "underlying_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      },
      "quoting_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      },
      "settling_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      }
    }
  }
]

Responses

Status Meaning Description Schema
200 OK List of all open positions ArrayOfPositions

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.delta.exchange/positions/change_margin', params={

}, headers = headers)

print r.json()

# You can also use wget
curl -X POST https://api.delta.exchange/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.delta.exchange/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

{
  "user_id": 0,
  "size": 0,
  "entry_price": "string",
  "margin": "string",
  "liquidation_price": "string",
  "bankruptcy_price": "string",
  "adl_level": 0,
  "product": {
    "id": 0,
    "symbol": "string",
    "description": "string",
    "created_at": "string",
    "updated_at": "string",
    "settlement_time": "string",
    "product_type": "future",
    "pricing_source": "string",
    "impact_size": 0,
    "initial_margin": 0,
    "maintenance_margin": "string",
    "contract_value": "string",
    "contract_unit_currency": "string",
    "tick_size": "string",
    "trading_status": "operational",
    "max_leverage_notional": "string",
    "default_leverage": "string",
    "initial_margin_scaling_factor": "string",
    "maintenance_margin_scaling_factor": "string",
    "commission_rate": "string",
    "maker_commission_rate": "string",
    "liquidation_penalty_factor": "string",
    "contract_type": "string",
    "position_size_limit": 0,
    "basis_factor_max_limit": "string",
    "is_quanto": true,
    "funding_method": "string",
    "annualized_funding": "string",
    "price_band": "string",
    "underlying_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    },
    "quoting_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    },
    "settling_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    }
  }
}

Responses

Status Meaning Description Schema
200 OK returns the position object Position
400 Bad Request Returns error if position margin could not be changed Inline

Response Schema

Status Code 400

Name Type Required Restrictions Description
» error string false none none
» message string false none A more verbose error message

Enumerated Values

Property Value
error PositionNotSet
error LeverageLimitExceeded
error InsufficientMargin
error ExistingOrderWithLowerThanBankruptcy

Trade History

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.delta.exchange/orders/history', params={

}, headers = headers)

print r.json()

# You can also use wget
curl -X GET https://api.delta.exchange/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.delta.exchange/orders/history',
  params: {
  }, headers: headers

p JSON.parse(result)

GET /orders/history

Parameters

Parameter In Type Required Description
page_num query integer false page number for pagination
page_size query integer false page size for pagination

Example responses

200 Response

[
  {
    "id": 0,
    "user_id": 0,
    "size": 0,
    "unfilled_size": 0,
    "side": "buy",
    "order_type": "limit_order",
    "limit_price": "string",
    "stop_order_type": "stop_loss_order",
    "stop_price": "string",
    "close_on_trigger": "false",
    "state": "open",
    "created_at": "string",
    "product": {
      "id": 0,
      "symbol": "string",
      "description": "string",
      "created_at": "string",
      "updated_at": "string",
      "settlement_time": "string",
      "product_type": "future",
      "pricing_source": "string",
      "impact_size": 0,
      "initial_margin": 0,
      "maintenance_margin": "string",
      "contract_value": "string",
      "contract_unit_currency": "string",
      "tick_size": "string",
      "trading_status": "operational",
      "max_leverage_notional": "string",
      "default_leverage": "string",
      "initial_margin_scaling_factor": "string",
      "maintenance_margin_scaling_factor": "string",
      "commission_rate": "string",
      "maker_commission_rate": "string",
      "liquidation_penalty_factor": "string",
      "contract_type": "string",
      "position_size_limit": 0,
      "basis_factor_max_limit": "string",
      "is_quanto": true,
      "funding_method": "string",
      "annualized_funding": "string",
      "price_band": "string",
      "underlying_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      },
      "quoting_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      },
      "settling_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      }
    }
  }
]

Responses

Status Meaning Description Schema
200 OK List of orders ArrayOfOrders

Get fills

Code samples

import requests
headers = {
  'Accept': 'application/json',
  'api-key': '****',
  'signature': '****',
  'timestamp': '****'
}

r = requests.get('https://api.delta.exchange/fills', params={

}, headers = headers)

print r.json()

# You can also use wget
curl -X GET https://api.delta.exchange/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.delta.exchange/fills',
  params: {
  }, headers: headers

p JSON.parse(result)

GET /fills

Parameters

Parameter In Type Required Description
product_id query integer false product id for fill query
start_time query integer false Start time for the fill query
end_time query integer false End time for the fill query
page_num query integer false page number for pagination
page_size query integer false page size for pagination

Example responses

200 Response

[
  {
    "id": 0,
    "size": 0,
    "side": "buy",
    "price": "string",
    "role": "taker",
    "commission": "string",
    "created_at": "string",
    "product": {
      "id": 0,
      "symbol": "string",
      "description": "string",
      "created_at": "string",
      "updated_at": "string",
      "settlement_time": "string",
      "product_type": "future",
      "pricing_source": "string",
      "impact_size": 0,
      "initial_margin": 0,
      "maintenance_margin": "string",
      "contract_value": "string",
      "contract_unit_currency": "string",
      "tick_size": "string",
      "trading_status": "operational",
      "max_leverage_notional": "string",
      "default_leverage": "string",
      "initial_margin_scaling_factor": "string",
      "maintenance_margin_scaling_factor": "string",
      "commission_rate": "string",
      "maker_commission_rate": "string",
      "liquidation_penalty_factor": "string",
      "contract_type": "string",
      "position_size_limit": 0,
      "basis_factor_max_limit": "string",
      "is_quanto": true,
      "funding_method": "string",
      "annualized_funding": "string",
      "price_band": "string",
      "underlying_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      },
      "quoting_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      },
      "settling_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      }
    }
  }
]

Responses

Status Meaning Description Schema
200 OK List of Fills ArrayOfFills

Orderbook

L2Orderbook

Get L2 orderbook

Code samples

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('https://api.delta.exchange/orderbook/{product_id}/l2', params={

}, headers = headers)

print r.json()

# You can also use wget
curl -X GET https://api.delta.exchange/orderbook/{product_id}/l2 \
  -H 'Accept: application/json'

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get 'https://api.delta.exchange/orderbook/{product_id}/l2',
  params: {
  }, headers: headers

p JSON.parse(result)

GET /orderbook/{product_id}/l2

Parameters

Parameter In Type Required Description
product_id path integer true none
depth query integer false number of levels on each side

Example responses

200 Response

{
  "buy_book": [
    {
      "price": "string",
      "size": 0
    }
  ],
  "sell_book": [
    {
      "price": "string",
      "size": 0
    }
  ],
  "recent_trades": [
    {
      "side": "buy",
      "size": 0,
      "price": "string",
      "timestamp": 0
    }
  ],
  "spot_price": "string",
  "mark_price": "string",
  "product_id": 0
}

Responses

Status Meaning Description Schema
200 OK L2 orderbook for the product L2Orderbook

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.delta.exchange/wallet/balances', params={

}, headers = headers)

print r.json()

# You can also use wget
curl -X GET https://api.delta.exchange/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.delta.exchange/wallet/balances',
  params: {
  }, headers: headers

p JSON.parse(result)

GET /wallet/balances

Example responses

200 Response

[
  {
    "balance": "string",
    "order_margin": "string",
    "position_margin": "string",
    "commission": "string",
    "available_balance": "string",
    "asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    }
  }
]

Responses

Status Meaning Description Schema
200 OK List of wallets attached to the user account ArrayOfWallets

Get Wallet transactions

Code samples

import requests
headers = {
  'Accept': 'application/json',
  'api-key': '****',
  'signature': '****',
  'timestamp': '****'
}

r = requests.get('https://api.delta.exchange/wallet/transactions', params={
  'asset_id': '0'
}, headers = headers)

print r.json()

# You can also use wget
curl -X GET https://api.delta.exchange/wallet/transactions?asset_id=0 \
  -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.delta.exchange/wallet/transactions',
  params: {
  'asset_id' => 'integer'
}, headers: headers

p JSON.parse(result)

GET /wallet/transactions

Parameters

Parameter In Type Required Description
asset_id query integer true asset_id for that particular Wallet
product_id query integer false product_id filter for the transaction query
transaction_type query integer false transaction_type filter for the transaction query
start_time query integer false Start time for the transaction query
end_time query integer false End time for the transaction query
page_num query integer false page number for pagination
page_size query integer false page size for pagination

Example responses

200 Response

[
  {
    "id": 0,
    "amount": "string",
    "balance": "string",
    "transaction_type": "pnl",
    "meta_data": {},
    "product": {
      "id": 0,
      "symbol": "string",
      "description": "string",
      "created_at": "string",
      "updated_at": "string",
      "settlement_time": "string",
      "product_type": "future",
      "pricing_source": "string",
      "impact_size": 0,
      "initial_margin": 0,
      "maintenance_margin": "string",
      "contract_value": "string",
      "contract_unit_currency": "string",
      "tick_size": "string",
      "trading_status": "operational",
      "max_leverage_notional": "string",
      "default_leverage": "string",
      "initial_margin_scaling_factor": "string",
      "maintenance_margin_scaling_factor": "string",
      "commission_rate": "string",
      "maker_commission_rate": "string",
      "liquidation_penalty_factor": "string",
      "contract_type": "string",
      "position_size_limit": 0,
      "basis_factor_max_limit": "string",
      "is_quanto": true,
      "funding_method": "string",
      "annualized_funding": "string",
      "price_band": "string",
      "underlying_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      },
      "quoting_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      },
      "settling_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      }
    },
    "created_at": "string"
  }
]

Responses

Status Meaning Description Schema
200 OK list of transactions for that wallet ArrayOfTransactions

Download Wallet transactions

Code samples

import requests
headers = {
  'Accept': 'application/json',
  'api-key': '****',
  'signature': '****',
  'timestamp': '****'
}

r = requests.get('https://api.delta.exchange/wallet/download/transactions', params={
  'asset_id': '0'
}, headers = headers)

print r.json()

# You can also use wget
curl -X GET https://api.delta.exchange/wallet/download/transactions?asset_id=0 \
  -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.delta.exchange/wallet/download/transactions',
  params: {
  'asset_id' => 'integer'
}, headers: headers

p JSON.parse(result)

GET /wallet/download/transactions

Parameters

Parameter In Type Required Description
asset_id query integer true asset_id for that particular Wallet
product_id query integer false product_id filter for the transaction query
transaction_type query integer false transaction_type filter for the transaction query
start_time query integer false Start time for the transaction query
end_time query integer false End time for the transaction query

Example responses

200 Response

[
  {
    "id": 0,
    "amount": "string",
    "balance": "string",
    "transaction_type": "pnl",
    "meta_data": {},
    "product": {
      "id": 0,
      "symbol": "string",
      "description": "string",
      "created_at": "string",
      "updated_at": "string",
      "settlement_time": "string",
      "product_type": "future",
      "pricing_source": "string",
      "impact_size": 0,
      "initial_margin": 0,
      "maintenance_margin": "string",
      "contract_value": "string",
      "contract_unit_currency": "string",
      "tick_size": "string",
      "trading_status": "operational",
      "max_leverage_notional": "string",
      "default_leverage": "string",
      "initial_margin_scaling_factor": "string",
      "maintenance_margin_scaling_factor": "string",
      "commission_rate": "string",
      "maker_commission_rate": "string",
      "liquidation_penalty_factor": "string",
      "contract_type": "string",
      "position_size_limit": 0,
      "basis_factor_max_limit": "string",
      "is_quanto": true,
      "funding_method": "string",
      "annualized_funding": "string",
      "price_band": "string",
      "underlying_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      },
      "quoting_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      },
      "settling_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      }
    },
    "created_at": "string"
  }
]

Responses

Status Meaning Description Schema
200 OK csv of transactions for that wallet ArrayOfTransactions

Raise withdrawals request

Code samples

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'api-key': '****',
  'signature': '****',
  'timestamp': '****'
}

r = requests.post('https://api.delta.exchange/wallet/withdrawals', params={

}, headers = headers)

print r.json()

# You can also use wget
curl -X POST https://api.delta.exchange/wallet/withdrawals \
  -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.delta.exchange/wallet/withdrawals',
  params: {
  }, headers: headers

p JSON.parse(result)

POST /wallet/withdrawals

Body parameter

{
  "release_promo_credit": "string",
  "amount": "string",
  "address": "string"
}

Parameters

Parameter In Type Required Description
body body object true none
» release_promo_credit body string false none
» amount body string true none
» address body string true none

Example responses

200 Response

{
  "address": "string",
  "amount": "string",
  "fee": "string",
  "id": 0,
  "state": "string",
  "transaction_meta": "string",
  "user_id": 0
}

Responses

Status Meaning Description Schema
200 OK returns the WithdrawalsResponse object WithdrawalsResponse
400 Bad Request Returns error if Withdrawal limit exceeded, ammount or address is missing or invalid Inline

Response Schema

Status Code 400

Name Type Required Restrictions Description
» error string false none none
» message string false none A more verbose error message

Enumerated Values

Property Value
error WithdrawalLimitExceeded

Cancel withdrawals request

Code samples

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'api-key': '****',
  'signature': '****',
  'timestamp': '****'
}

r = requests.post('https://api.delta.exchange/wallet/withdrawals/cancel', params={

}, headers = headers)

print r.json()

# You can also use wget
curl -X POST https://api.delta.exchange/wallet/withdrawals/cancel \
  -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.delta.exchange/wallet/withdrawals/cancel',
  params: {
  }, headers: headers

p JSON.parse(result)

POST /wallet/withdrawals/cancel

Body parameter

{
  "withdrawal_id": 0
}

Parameters

Parameter In Type Required Description
body body object true none
» withdrawal_id body integer true none

Example responses

200 Response

{
  "success": true
}

Responses

Status Meaning Description Schema
200 OK returns success true or false Inline
400 Bad Request Returns error if Withdrawal Withdrawal Already Processed Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
» success boolean false none none

Status Code 400

Name Type Required Restrictions Description
» error string false none none
» message string false none A more verbose error message

Enumerated Values

Property Value
error WithdrawalAlreadyProcessed

OHLC Candles

Get OHLC candles

Code samples

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('https://api.delta.exchange/chart/history', params={
  'symbol': 'string',  'from': '0',  'to': '0',  'resolution': '1'
}, headers = headers)

print r.json()

# You can also use wget
curl -X GET https://api.delta.exchange/chart/history?symbol=string&from=0&to=0&resolution=1 \
  -H 'Accept: application/json'

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get 'https://api.delta.exchange/chart/history',
  params: {
  'symbol' => 'string',
'from' => 'integer',
'to' => 'integer',
'resolution' => 'string'
}, headers: headers

p JSON.parse(result)

GET /chart/history

Parameters

Parameter In Type Required Description
symbol query string true symbol should be anyone of following 1. product symbol to get OHLC for given product e.g BTCUSD 2. Spot index symbol to get spot index price. e.g. .DEXBTUSD 3. Mark and symbol to get mark price OHLC data e.g. MARK:BTCUSD 4. Funding and product symbol to get Funding data for given product e.g. FUNDING:BTCUSD
from query integer true start time for the interval ( in seconds )
to query integer true end time for the interval ( in seconds )
resolution query string true resolution for the candles

Enumerated Values

Parameter Value
resolution 1
resolution 3
resolution 5
resolution 15
resolution 30
resolution 60
resolution 120
resolution 240
resolution 360
resolution D
resolution 7D
resolution 30D
resolution 1W
resolution 2W

Example responses

200 Response

{
  "t": [
    0
  ],
  "o": [
    "string"
  ],
  "h": [
    "string"
  ],
  "l": [
    "string"
  ],
  "c": [
    "string"
  ],
  "v": [
    0
  ]
}

Responses

Status Meaning Description Schema
200 OK OHLC candles OHLCData

Schemas

Asset

{
  "id": 0,
  "symbol": "string",
  "precision": 0
}

Properties

Name Type Required Restrictions Description
id integer(int64) false none none
symbol string false none none
precision integer false none none

ArrayOfAssets

[
  {
    "id": 0,
    "symbol": "string",
    "precision": 0
  }
]

Properties

Name Type Required Restrictions Description
anonymous [Asset] false none none

Product

{
  "id": 0,
  "symbol": "string",
  "description": "string",
  "created_at": "string",
  "updated_at": "string",
  "settlement_time": "string",
  "product_type": "future",
  "pricing_source": "string",
  "impact_size": 0,
  "initial_margin": 0,
  "maintenance_margin": "string",
  "contract_value": "string",
  "contract_unit_currency": "string",
  "tick_size": "string",
  "trading_status": "operational",
  "max_leverage_notional": "string",
  "default_leverage": "string",
  "initial_margin_scaling_factor": "string",
  "maintenance_margin_scaling_factor": "string",
  "commission_rate": "string",
  "maker_commission_rate": "string",
  "liquidation_penalty_factor": "string",
  "contract_type": "string",
  "position_size_limit": 0,
  "basis_factor_max_limit": "string",
  "is_quanto": true,
  "funding_method": "string",
  "annualized_funding": "string",
  "price_band": "string",
  "underlying_asset": {
    "id": 0,
    "symbol": "string",
    "precision": 0
  },
  "quoting_asset": {
    "id": 0,
    "symbol": "string",
    "precision": 0
  },
  "settling_asset": {
    "id": 0,
    "symbol": "string",
    "precision": 0
  }
}

Properties

Name Type Required Restrictions Description
id integer(int64) false none id of a product or a contract
symbol string false none symbol of a product or a contract e.g. LINKBTC, XRPUSDQ
description string false none description of a product or a contract
created_at string false none product/contract creation date and time
updated_at string false none product/contract update date and time
settlement_time string false none settlement Timestamp of futures contract
product_type string false none contract type 'future' or 'inverse_future'
pricing_source string false none source and method of contract pricing
impact_size integer false none size of a typical trade. Used in the computation of mark price
initial_margin integer false none The amount required to enter into a new position
maintenance_margin string false none The amount necessary when a loss on a futures position requires you to allocate more funds to return the margin to the initial margin level.
contract_value string false none The notional value of a futures contract is simply the spot price of the asset multiplied by the amount of the asset specified in the contract
contract_unit_currency string false none This is the unit of 1 contract, for vanilla futures, its underlying asset. for inverse, it is settling asset. for quanto, its settling asset / quoting asset
tick_size string false none The minimum gap between 2 consecutive prices.
trading_status string false none trading status of the contract e.g. 'operational','disrupted_cancel_only' or 'disrupted_post_only'
max_leverage_notional string false none maximum notional position size (in settling asset terms) that can be acquired at highest allowed leverage for a given contract.
default_leverage string false none default leverage
initial_margin_scaling_factor string false none none
maintenance_margin_scaling_factor string false none none
commission_rate string false none rate at which commission fee will be calculated for a trade in given contract
maker_commission_rate string false none rate at which maker rebate will be calculated
liquidation_penalty_factor string false none Determines liquidation charge as per the following formula: liquidation_penalty_factor * minimum maintenance margin
contract_type string false none Type of contracts e.g. futures, perpetual futures,
position_size_limit integer false none Maximum size of contracts in a single order can be placed
basis_factor_max_limit string false none Maximum allowed value of annualized basis
is_quanto boolean false none Flag which denotes whether future contract is quanto or not
funding_method string false none Method used to calculate funding for given contract. e.g. Fixed or mark price
annualized_funding string false none Maximum allowed value of funding, expressed as annual rate.
price_band string false none he range around mark price in which trading is allowed. This number is in percentage.
underlying_asset Asset false none none
quoting_asset Asset false none none
settling_asset Asset false none none

Enumerated Values

Property Value
product_type future
product_type inverse_future
trading_status operational
trading_status disrupted_cancel_only
trading_status disrupted_post_only

ArrayOfProducts

[
  {
    "id": 0,
    "symbol": "string",
    "description": "string",
    "created_at": "string",
    "updated_at": "string",
    "settlement_time": "string",
    "product_type": "future",
    "pricing_source": "string",
    "impact_size": 0,
    "initial_margin": 0,
    "maintenance_margin": "string",
    "contract_value": "string",
    "contract_unit_currency": "string",
    "tick_size": "string",
    "trading_status": "operational",
    "max_leverage_notional": "string",
    "default_leverage": "string",
    "initial_margin_scaling_factor": "string",
    "maintenance_margin_scaling_factor": "string",
    "commission_rate": "string",
    "maker_commission_rate": "string",
    "liquidation_penalty_factor": "string",
    "contract_type": "string",
    "position_size_limit": 0,
    "basis_factor_max_limit": "string",
    "is_quanto": true,
    "funding_method": "string",
    "annualized_funding": "string",
    "price_band": "string",
    "underlying_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    },
    "quoting_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    },
    "settling_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    }
  }
]

Properties

Name Type Required Restrictions Description
anonymous [Product] false none none

Order

{
  "id": 0,
  "user_id": 0,
  "size": 0,
  "unfilled_size": 0,
  "side": "buy",
  "order_type": "limit_order",
  "limit_price": "string",
  "stop_order_type": "stop_loss_order",
  "stop_price": "string",
  "close_on_trigger": "false",
  "state": "open",
  "created_at": "string",
  "product": {
    "id": 0,
    "symbol": "string",
    "description": "string",
    "created_at": "string",
    "updated_at": "string",
    "settlement_time": "string",
    "product_type": "future",
    "pricing_source": "string",
    "impact_size": 0,
    "initial_margin": 0,
    "maintenance_margin": "string",
    "contract_value": "string",
    "contract_unit_currency": "string",
    "tick_size": "string",
    "trading_status": "operational",
    "max_leverage_notional": "string",
    "default_leverage": "string",
    "initial_margin_scaling_factor": "string",
    "maintenance_margin_scaling_factor": "string",
    "commission_rate": "string",
    "maker_commission_rate": "string",
    "liquidation_penalty_factor": "string",
    "contract_type": "string",
    "position_size_limit": 0,
    "basis_factor_max_limit": "string",
    "is_quanto": true,
    "funding_method": "string",
    "annualized_funding": "string",
    "price_band": "string",
    "underlying_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    },
    "quoting_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    },
    "settling_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    }
  }
}

An Order object

Properties

Name Type Required Restrictions Description
id integer false none none
user_id integer false none none
size integer false none none
unfilled_size integer false none none
side string false none side for which to place order
order_type string false none none
limit_price string false none none
stop_order_type string false none none
stop_price string false none none
close_on_trigger string false none none
state string false none Order Status
created_at string false none none
product Product false none none

Enumerated Values

Property Value
side buy
side sell
order_type limit_order
order_type market_order
stop_order_type stop_loss_order
close_on_trigger false
close_on_trigger true
state open
state pending
state closed
state cancelled

ArrayOfOrders

[
  {
    "id": 0,
    "user_id": 0,
    "size": 0,
    "unfilled_size": 0,
    "side": "buy",
    "order_type": "limit_order",
    "limit_price": "string",
    "stop_order_type": "stop_loss_order",
    "stop_price": "string",
    "close_on_trigger": "false",
    "state": "open",
    "created_at": "string",
    "product": {
      "id": 0,
      "symbol": "string",
      "description": "string",
      "created_at": "string",
      "updated_at": "string",
      "settlement_time": "string",
      "product_type": "future",
      "pricing_source": "string",
      "impact_size": 0,
      "initial_margin": 0,
      "maintenance_margin": "string",
      "contract_value": "string",
      "contract_unit_currency": "string",
      "tick_size": "string",
      "trading_status": "operational",
      "max_leverage_notional": "string",
      "default_leverage": "string",
      "initial_margin_scaling_factor": "string",
      "maintenance_margin_scaling_factor": "string",
      "commission_rate": "string",
      "maker_commission_rate": "string",
      "liquidation_penalty_factor": "string",
      "contract_type": "string",
      "position_size_limit": 0,
      "basis_factor_max_limit": "string",
      "is_quanto": true,
      "funding_method": "string",
      "annualized_funding": "string",
      "price_band": "string",
      "underlying_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      },
      "quoting_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      },
      "settling_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      }
    }
  }
]

Properties

Name Type Required Restrictions Description
anonymous [Order] false none [An Order object]

BracketOrder

{
  "stop_loss_order": {
    "id": 0,
    "user_id": 0,
    "size": 0,
    "unfilled_size": 0,
    "side": "buy",
    "order_type": "limit_order",
    "limit_price": "string",
    "stop_order_type": "stop_loss_order",
    "stop_price": "string",
    "close_on_trigger": "false",
    "state": "open",
    "created_at": "string",
    "product": {
      "id": 0,
      "symbol": "string",
      "description": "string",
      "created_at": "string",
      "updated_at": "string",
      "settlement_time": "string",
      "product_type": "future",
      "pricing_source": "string",
      "impact_size": 0,
      "initial_margin": 0,
      "maintenance_margin": "string",
      "contract_value": "string",
      "contract_unit_currency": "string",
      "tick_size": "string",
      "trading_status": "operational",
      "max_leverage_notional": "string",
      "default_leverage": "string",
      "initial_margin_scaling_factor": "string",
      "maintenance_margin_scaling_factor": "string",
      "commission_rate": "string",
      "maker_commission_rate": "string",
      "liquidation_penalty_factor": "string",
      "contract_type": "string",
      "position_size_limit": 0,
      "basis_factor_max_limit": "string",
      "is_quanto": true,
      "funding_method": "string",
      "annualized_funding": "string",
      "price_band": "string",
      "underlying_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      },
      "quoting_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      },
      "settling_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      }
    }
  },
  "take_profit_order": {
    "id": 0,
    "user_id": 0,
    "size": 0,
    "unfilled_size": 0,
    "side": "buy",
    "order_type": "limit_order",
    "limit_price": "string",
    "stop_order_type": "stop_loss_order",
    "stop_price": "string",
    "close_on_trigger": "false",
    "state": "open",
    "created_at": "string",
    "product": {
      "id": 0,
      "symbol": "string",
      "description": "string",
      "created_at": "string",
      "updated_at": "string",
      "settlement_time": "string",
      "product_type": "future",
      "pricing_source": "string",
      "impact_size": 0,
      "initial_margin": 0,
      "maintenance_margin": "string",
      "contract_value": "string",
      "contract_unit_currency": "string",
      "tick_size": "string",
      "trading_status": "operational",
      "max_leverage_notional": "string",
      "default_leverage": "string",
      "initial_margin_scaling_factor": "string",
      "maintenance_margin_scaling_factor": "string",
      "commission_rate": "string",
      "maker_commission_rate": "string",
      "liquidation_penalty_factor": "string",
      "contract_type": "string",
      "position_size_limit": 0,
      "basis_factor_max_limit": "string",
      "is_quanto": true,
      "funding_method": "string",
      "annualized_funding": "string",
      "price_band": "string",
      "underlying_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      },
      "quoting_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      },
      "settling_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      }
    }
  }
}

Properties

Name Type Required Restrictions Description
stop_loss_order Order false none An Order object
take_profit_order Order false none An Order object

CreateOrderRequest

{
  "product_id": 0,
  "limit_price": "string",
  "size": 0,
  "side": "buy",
  "order_type": "limit_order",
  "time_in_force": "gtc",
  "bracket_order": {
    "stop_loss_price": "string",
    "take_profit_price": "string",
    "trail_amount": "string"
  }
}

A create order object

Properties

Name Type Required Restrictions Description
product_id integer false none none
limit_price string false none none
size integer false none none
side string false none side for which to place order
order_type string false none none
time_in_force string false none none
bracket_order object false none none
» stop_loss_price string false none none
» take_profit_price string false none none
» trail_amount string false none none

Enumerated Values

Property Value
side buy
side sell
order_type limit_order
order_type market_order
time_in_force gtc
time_in_force ioc
time_in_force fok

CreateBracketOrderRequest

{
  "product_id": 0,
  "stop_loss_order": {
    "order_type": "market_order",
    "stop_price": "string"
  },
  "take_profit_order": {
    "order_type": "market_order",
    "stop_price": "string"
  }
}

bracket order object

Properties

Name Type Required Restrictions Description
product_id integer false none none
stop_loss_order object false none none
» order_type string false none none
» stop_price string false none none
take_profit_order object false none none
» order_type string false none none
» stop_price string false none none

Enumerated Values

Property Value
order_type market_order
order_type market_order

ArrayOfCreateOrderRequest

[
  {
    "product_id": 0,
    "limit_price": "string",
    "size": 0,
    "side": "buy",
    "order_type": "limit_order",
    "time_in_force": "gtc",
    "bracket_order": {
      "stop_loss_price": "string",
      "take_profit_price": "string",
      "trail_amount": "string"
    }
  }
]

Properties

Name Type Required Restrictions Description
anonymous [CreateOrderRequest] false none [A create order object]

EditOrderRequest

{
  "id": 0,
  "product_id": 0,
  "limit_price": "string",
  "unfilled_size": 0
}

edit order object

Properties

Name Type Required Restrictions Description
id integer false none none
product_id integer false none none
limit_price string false none none
unfilled_size integer false none Remaining total unfilled size after editing order

ArrayOfEditOrderRequest

[
  {
    "id": 0,
    "product_id": 0,
    "limit_price": "string",
    "unfilled_size": 0
  }
]

Properties

Name Type Required Restrictions Description
anonymous [EditOrderRequest] false none [edit order object]

DeleteOrderRequest

{
  "id": 0,
  "product_id": 0
}

A delete order object

Properties

Name Type Required Restrictions Description
id integer false none none
product_id integer false none none

CancelAllFilterObject

{
  "product_id": 0,
  "cancel_limit_orders": "true",
  "cancel_stop_orders": "true"
}

Cancel all request filter object

Properties

Name Type Required Restrictions Description
product_id integer false none cancel all orders for particular product, cancels orders for all products if not provided
cancel_limit_orders string false none set as true to cancel open limit orders
cancel_stop_orders string false none set as true to cancel stop orders

Enumerated Values

Property Value
cancel_limit_orders true
cancel_limit_orders false
cancel_stop_orders true
cancel_stop_orders false

ArrayOfDeleteOrderRequest

[
  {
    "id": 0,
    "product_id": 0
  }
]

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,
    "symbol": "string",
    "description": "string",
    "created_at": "string",
    "updated_at": "string",
    "settlement_time": "string",
    "product_type": "future",
    "pricing_source": "string",
    "impact_size": 0,
    "initial_margin": 0,
    "maintenance_margin": "string",
    "contract_value": "string",
    "contract_unit_currency": "string",
    "tick_size": "string",
    "trading_status": "operational",
    "max_leverage_notional": "string",
    "default_leverage": "string",
    "initial_margin_scaling_factor": "string",
    "maintenance_margin_scaling_factor": "string",
    "commission_rate": "string",
    "maker_commission_rate": "string",
    "liquidation_penalty_factor": "string",
    "contract_type": "string",
    "position_size_limit": 0,
    "basis_factor_max_limit": "string",
    "is_quanto": true,
    "funding_method": "string",
    "annualized_funding": "string",
    "price_band": "string",
    "underlying_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    },
    "quoting_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    },
    "settling_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    }
  }
}

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 Product false none none

ArrayOfPositions

[
  {
    "user_id": 0,
    "size": 0,
    "entry_price": "string",
    "margin": "string",
    "liquidation_price": "string",
    "bankruptcy_price": "string",
    "adl_level": 0,
    "product": {
      "id": 0,
      "symbol": "string",
      "description": "string",
      "created_at": "string",
      "updated_at": "string",
      "settlement_time": "string",
      "product_type": "future",
      "pricing_source": "string",
      "impact_size": 0,
      "initial_margin": 0,
      "maintenance_margin": "string",
      "contract_value": "string",
      "contract_unit_currency": "string",
      "tick_size": "string",
      "trading_status": "operational",
      "max_leverage_notional": "string",
      "default_leverage": "string",
      "initial_margin_scaling_factor": "string",
      "maintenance_margin_scaling_factor": "string",
      "commission_rate": "string",
      "maker_commission_rate": "string",
      "liquidation_penalty_factor": "string",
      "contract_type": "string",
      "position_size_limit": 0,
      "basis_factor_max_limit": "string",
      "is_quanto": true,
      "funding_method": "string",
      "annualized_funding": "string",
      "price_band": "string",
      "underlying_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      },
      "quoting_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      },
      "settling_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      }
    }
  }
]

Properties

Name Type Required Restrictions Description
anonymous [Position] false none [A position object]

Fill

{
  "id": 0,
  "size": 0,
  "side": "buy",
  "price": "string",
  "role": "taker",
  "commission": "string",
  "created_at": "string",
  "product": {
    "id": 0,
    "symbol": "string",
    "description": "string",
    "created_at": "string",
    "updated_at": "string",
    "settlement_time": "string",
    "product_type": "future",
    "pricing_source": "string",
    "impact_size": 0,
    "initial_margin": 0,
    "maintenance_margin": "string",
    "contract_value": "string",
    "contract_unit_currency": "string",
    "tick_size": "string",
    "trading_status": "operational",
    "max_leverage_notional": "string",
    "default_leverage": "string",
    "initial_margin_scaling_factor": "string",
    "maintenance_margin_scaling_factor": "string",
    "commission_rate": "string",
    "maker_commission_rate": "string",
    "liquidation_penalty_factor": "string",
    "contract_type": "string",
    "position_size_limit": 0,
    "basis_factor_max_limit": "string",
    "is_quanto": true,
    "funding_method": "string",
    "annualized_funding": "string",
    "price_band": "string",
    "underlying_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    },
    "quoting_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    },
    "settling_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    }
  }
}

A fill object

Properties

Name Type Required Restrictions Description
id integer false none none
size integer false none none
side integer 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 Product false none none

Enumerated Values

Property Value
side buy
side sell
role taker
role maker

ArrayOfFills

[
  {
    "id": 0,
    "size": 0,
    "side": "buy",
    "price": "string",
    "role": "taker",
    "commission": "string",
    "created_at": "string",
    "product": {
      "id": 0,
      "symbol": "string",
      "description": "string",
      "created_at": "string",
      "updated_at": "string",
      "settlement_time": "string",
      "product_type": "future",
      "pricing_source": "string",
      "impact_size": 0,
      "initial_margin": 0,
      "maintenance_margin": "string",
      "contract_value": "string",
      "contract_unit_currency": "string",
      "tick_size": "string",
      "trading_status": "operational",
      "max_leverage_notional": "string",
      "default_leverage": "string",
      "initial_margin_scaling_factor": "string",
      "maintenance_margin_scaling_factor": "string",
      "commission_rate": "string",
      "maker_commission_rate": "string",
      "liquidation_penalty_factor": "string",
      "contract_type": "string",
      "position_size_limit": 0,
      "basis_factor_max_limit": "string",
      "is_quanto": true,
      "funding_method": "string",
      "annualized_funding": "string",
      "price_band": "string",
      "underlying_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      },
      "quoting_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      },
      "settling_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      }
    }
  }
]

Properties

Name Type Required Restrictions Description
anonymous [Fill] false none [A fill object]

OrderLeverage

{
  "leverage": "string",
  "order_margin": "string",
  "product_id": 0
}

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 none

L2Orderbook

{
  "buy_book": [
    {
      "price": "string",
      "size": 0
    }
  ],
  "sell_book": [
    {
      "price": "string",
      "size": 0
    }
  ],
  "recent_trades": [
    {
      "side": "buy",
      "size": 0,
      "price": "string",
      "timestamp": 0
    }
  ],
  "spot_price": "string",
  "mark_price": "string",
  "product_id": 0
}

L2 orderbook

Properties

Name Type Required Restrictions Description
buy_book [object] false none none
» price string false none none
» size integer false none none
sell_book [object] false none none
» price string false none none
» size integer false none none
recent_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
spot_price string false none none
mark_price string false none none
product_id integer false none none

Enumerated Values

Property Value
side buy
side sell

Wallet

{
  "balance": "string",
  "order_margin": "string",
  "position_margin": "string",
  "commission": "string",
  "available_balance": "string",
  "asset": {
    "id": 0,
    "symbol": "string",
    "precision": 0
  }
}

Properties

Name Type Required Restrictions Description
balance string false none Total wallet balance
order_margin string false none Margin blocked in open orders
position_margin string false none Margin blocked in open positions
commission string false none Commissions blocked in open orders and open positions
available_balance string false none Amount available for withdrawals
asset Asset false none none

ArrayOfWallets

[
  {
    "balance": "string",
    "order_margin": "string",
    "position_margin": "string",
    "commission": "string",
    "available_balance": "string",
    "asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    }
  }
]

Properties

Name Type Required Restrictions Description
anonymous [Wallet] false none none

Transaction

{
  "id": 0,
  "amount": "string",
  "balance": "string",
  "transaction_type": "pnl",
  "meta_data": {},
  "product": {
    "id": 0,
    "symbol": "string",
    "description": "string",
    "created_at": "string",
    "updated_at": "string",
    "settlement_time": "string",
    "product_type": "future",
    "pricing_source": "string",
    "impact_size": 0,
    "initial_margin": 0,
    "maintenance_margin": "string",
    "contract_value": "string",
    "contract_unit_currency": "string",
    "tick_size": "string",
    "trading_status": "operational",
    "max_leverage_notional": "string",
    "default_leverage": "string",
    "initial_margin_scaling_factor": "string",
    "maintenance_margin_scaling_factor": "string",
    "commission_rate": "string",
    "maker_commission_rate": "string",
    "liquidation_penalty_factor": "string",
    "contract_type": "string",
    "position_size_limit": 0,
    "basis_factor_max_limit": "string",
    "is_quanto": true,
    "funding_method": "string",
    "annualized_funding": "string",
    "price_band": "string",
    "underlying_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    },
    "quoting_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0
    },
    "settling_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 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 string false none none
meta_data object false none none
product Product false none none
created_at string false none none

Enumerated Values

Property Value
transaction_type pnl
transaction_type deposit
transaction_type withdrawal
transaction_type commission
transaction_type conversion
transaction_type perpetual_futures_funding
transaction_type withdrawal_cancellation
transaction_type referral_bonus
transaction_type commission_rebate
transaction_type promo_credit

ArrayOfTransactions

[
  {
    "id": 0,
    "amount": "string",
    "balance": "string",
    "transaction_type": "pnl",
    "meta_data": {},
    "product": {
      "id": 0,
      "symbol": "string",
      "description": "string",
      "created_at": "string",
      "updated_at": "string",
      "settlement_time": "string",
      "product_type": "future",
      "pricing_source": "string",
      "impact_size": 0,
      "initial_margin": 0,
      "maintenance_margin": "string",
      "contract_value": "string",
      "contract_unit_currency": "string",
      "tick_size": "string",
      "trading_status": "operational",
      "max_leverage_notional": "string",
      "default_leverage": "string",
      "initial_margin_scaling_factor": "string",
      "maintenance_margin_scaling_factor": "string",
      "commission_rate": "string",
      "maker_commission_rate": "string",
      "liquidation_penalty_factor": "string",
      "contract_type": "string",
      "position_size_limit": 0,
      "basis_factor_max_limit": "string",
      "is_quanto": true,
      "funding_method": "string",
      "annualized_funding": "string",
      "price_band": "string",
      "underlying_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      },
      "quoting_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      },
      "settling_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0
      }
    },
    "created_at": "string"
  }
]

Properties

Name Type Required Restrictions Description
anonymous [Transaction] false none none

24hrTicker

{
  "symbol": "string",
  "timestamp": 0,
  "open": 0,
  "high": 0,
  "low": 0,
  "close": 0,
  "volume": 0
}

Properties

Name Type Required Restrictions Description
symbol string false none none
timestamp 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 integer false none none

OHLCData

{
  "t": [
    0
  ],
  "o": [
    "string"
  ],
  "h": [
    "string"
  ],
  "l": [
    "string"
  ],
  "c": [
    "string"
  ],
  "v": [
    0
  ]
}

Properties

Name Type Required Restrictions Description
t [integer] false none array of timestamps for which candles are returned
o [string] false none open prices for candles
h [string] false none high prices for candles
l [string] false none low prices for candles
c [string] false none close prices for candles
v [integer] false none volumes for candles

WithdrawalsResponse

{
  "address": "string",
  "amount": "string",
  "fee": "string",
  "id": 0,
  "state": "string",
  "transaction_meta": "string",
  "user_id": 0
}

Properties

Name Type Required Restrictions Description
address string false none BTC Destination Address
amount string false none Amount to be Withdrawn
fee string false none Withdrawal Fee
id integer(int64) false none Trasaction id
state string false none state of withdrawal request
transaction_meta string false none Amount to be Withdrawn
user_id integer(int64) false none User id

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

Websocket Feed

Websocket api can be used for the following use cases

Access url

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. This message is mandatory — you will be disconnected if no subscribe has been received within 60 seconds.

To specify contracts within each channel, just pass a list of symbols inside the channel payload.

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"
                ]
            }
        ]
    }
}

// Response
{
    "type": "subscriptions",
    "channels": [
        {
            "name": "l2_orderbook",
            "symbols": [
                "BTCUSD_28Dec"
            ],
        },
        {
            "name": "ticker",
            "symbols": [
                "BTCUSD_28Dec",
                "ETHBTC_28Dec"
            ]
        }
    ]
}

// 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://api.delta.exchange:2096')
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.

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 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

ticker

The ticker channel provides price change data for the last 24 hrs (rolling window). It is published every 5 seconds.

On subscribing to ticker channel, socket server will emit messages with type 'ticker' in response.

Ticker Sample

// Response
{
    "symbol": "BNBBTC_30Nov",
    "product_id": 7,
    "type": "ticker",
    "timestamp": 1561634049751430,
    "open": 0.0014622,
    "high": 0.0014622,
    "low": 0.0014622,
    "close": 0.0014622,
    "volume": 1
}

l2_orderbook

l2_orderbook channel provides snapshot of the latest level2 orderbook.

L2 Orderbook Sample

// l2 orderbook Response
{
    "symbol": "BTCUSD_28Dec",
    "product_id": 3,
    "type": "l2_orderbook",
    "timestamp": 1561634049751430,
    "buy": [{"limit_price":"0.0014577","size":62},{"limit_price":"0.0014571","size":28}],
    "sell": [{"limit_price":"6229.0","size":15964},{"limit_price":"6229.5","size":3504},{"limit_price":"6230.0","size":15964},{"limit_price":"6231.0","size":15957}]
}

recent_trade

recent_trade channel provides a real time feed of all recent trades (fills).

// Trades Response
{
    symbol: "BNBBTC_30Nov",
    price: "0.0014579",
    size: 100,
    "type": "recent_trade",
    buyer_role: "maker",
    seller_role: "taker",
    timestamp: 1561634049751430
}

mark_price

mark_price channel provides a real time feed of mark price. 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.

// Mark Price Response
{
    symbol: "MARK:BNBBTC_30Nov",
    product_id: 7,
    type: "mark_price",
    price: "0.00401010",
    annualized_basis: 25.12,    // in %
    timestamp: 1561634049751430
}

spot_price

spot_price channel provides a real time feed of the underlying index prices.

// Spot Price Response
{
    symbol: ".DEBNBBTC",
    price: "0.0014579",
    type: "spot_price",
    timestamp: 1561634049751430
}

funding_rate

funding_rate channel provides a real time feed of funding rates for perpetual contracts.

// Funding Rate Response
{
    symbol: "BNBBTC_30Nov",
    product_id: 7,
    type: "funding_rate",
    funding_rate: "-0.00401010",  // in %
    timestamp: 1561634049751430   // 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

// 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

// Maintenance Started Response
{
    "type":"announcements",
    "event":"maintenance_started",
    "maintenance_finish_time": 1561638049751430,
    "timestamp": 1561634049751430,
}

// Maintenance Finished Response
{
    "type":"announcements",
    "event":"maintenance_finished",
    "timestamp": 1561634049751430,
}

Private Channels

Private channels require clients to authenticate.

Margins

Channel provides updates for margin blocked for different assets, these updates are provided only on change of margin.

// margin update
{
    "type": "margins",
    "balance": "1.0012",
    "order_margin": "0.121212",     // Margin blocked in open orders
    "position_margin: "0.101212",   // Margin blocked in position
    "commission": "0.00012",        // commissions blocked in position and order
    "asset_id": 2                   // BTC
}

Positions

Channel provides updates for change in position. Need to pass list of product symbols while subscribing. these updates are provided only on change of position.

// Position update
{
    "type": "positions",
    "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
}

Trading Notitifications

trading_notifications channel provides updates of all the private trade notifications.

orderUpdate

Channel provides updates when any order is updated for any action such as fill, quantity change.

// orderUpdate
{
    "type": "orderUpdate",
    "action": "fill",
    "product_id": 3,
    "symbol": "BTCUSD_28Dec",
    "order_id": 3283999,
    "side": "buy",
    "unfilled_size": 1,
    "filled_size": 1,
    "price": "4500.0",
    "state": "open",
    "timestamp": 1544091555086559
}

fill

Channel provides updates when any order is executed.

// Fill
{
    "symbol": "BNBBTC_30Nov",
    "fill_id": "1234-abcd-qwer-3456",
    "product_id": 7,
    "type": "fill",
    "user_id": 1998,
    "order_id": 3283999,
    "side": "buy",
    "size": 190,
    "price": "0.00145791",
    "role": "taker",
    "client_order_id": "GA123",
    "timestamp": 1544091555086559
}

adl

Channel provides updates when open position get auto deleveraged.

// ADL
{
    "symbol": "BNBBTC_30Nov",
    "product_id": 7,
    "type": "adl",
    "timestamp": 1544091555086559
    "side": 'buy',          // Position side
    "size": 32,             // size by which your position was reduced
    "entry_price": "0.000121",
    "exit_price": "0.0001222",
    "realized_pnl": "0.1",
}

self_trade

Channel provide updates when any of your order get matched with your open order.

// Self Trade
{
    "symbol": "BNBBTC_30Nov",
    "product_id": 7,
    "type": "self_trade",
    "user_id": 1998,
    "size": 199,
    "price": "0.00145791",
    "timestamp": 1544091555086559
}

pnl

Channel provides pnl updates when any position gets close.

// PNL
{
    "symbol": "BNBBTC_30Nov",
    "product_id": 7,
    "type": "pnl",
    "user_id": 1998,
    "side": "sell",
    "size": 180",
    "entry_price": "0.00145797",
    "exit_price": "0.00145791",
    "realized_pnl": "0.00102121",
    "timestamp": 1544091555086559

}

liquidation

Channel provide updates when any position gets liquidated.

// Liquidation
{
    "symbol": "BNBBTC_30Nov",
    "product_id": 7,
    "type": "liquidation",
    "user_id": 1998,
    "timestamp": 1542108684000000,
    "side": "buy",              // side of the position which got liquidated
    "size": 180,            // size of the position which got liquidated, always positive
    "liquidation_price": "0.00145791",
    "bankruptcy_price": "0.00145700",

}

stop_trigger

Channel provide updates when stop order gets triggered.

// Stop Trigger
{
    "symbol": "BNBBTC_30Nov",
    "product_id": 7,
    "user_id": 1998
    "type": "stop_trigger",
    "timestamp": 1542108684000000,
    "side": "buy",
    "size": 180

}

stop_cancel

Channel provide updates when stop order gets cancelled.

// Stop Cancel
{
    "symbol": "BNBBTC_30Nov",
    "product_id": 7,
    "user_id": 1998
    "type": "stop_cancel",
    "timestamp": 1542108684000000,
    "side": "buy",
    "message": "",
    "size": 180
}

auto_topup

Channel provide updates when margin get updated due to auto_topup istrue for that open position.

// Auto Topup