266 captures
05 Apr 2019 - 13 Mar 2026
Apr MAY Jun
30
2021 2022 2023
success
fail

About this capture

COLLECTED BY

Collection: Save Page Now Outlinks

TIMESTAMPS

The Wayback Machine - http://web.archive.org/web/20220530052757/https://docs.delta.exchange/
  NAV Navbar

Python cURL Ruby




Introduction

General Information

Definitions

Symbology

Pagination

Data Centers



Authentication

Common Errors

Generating an API Key

API Key Permissions

Creating a Request

Signing a Message



Rate Limits

REST API Cost Structure

Increasing your rate limits



Types

Timestamps

Numbers

IDs



Response Formats

Rest Api

Assets

Get list of all assets



Indices

Get indices



Products

 Get list of products

Get product by symbol

Get tickers for products

Get ticker for a product by symbol



Orders

Place Order

Cancel Order

Edit Order

Get Active Orders

Cancel all open orders

Create batch orders

Edit batch orders

Delele batch orders

Change order leverage

Get order leverage



Positions

Get position

Get margined positions

Add/Remove position margin

Close all positions



TradeHistory

Get order history (cancelled and closed)

GET user fills by filters

Download Wallet transactions



Orderbook

Get L2 orderbook



Trades

Get public trades



Wallet

Get Wallet Balances

Get Wallet transactions

Download Wallet transactions



OHLC Candles

GET ohlc candles

GET product history sparkline



Stats

Get volume stats



Schemas

ApiSuccessResponse

ApiErrorResponse

Index

ArrayOfIndices

Asset

ArrayOfAssets

Product

ArrayOfProducts

Order

ArrayOfOrders

CreateOrderRequest

ArrayOfCreateOrderRequest

EditOrderRequest

ArrayOfEditOrderRequest

DeleteOrderRequest

CancelAllFilterObject

ArrayOfDeleteOrderRequest

Position

ArrayOfPositions

Fill

ArrayOfFills

OrderLeverage

L2Orderbook

Trades

Wallet

ArrayOfWallets

Transaction

ArrayOfTransactions

greeks

price_band

quotes

Ticker

ArrayOfTickers

PaginationMeta

OHLCData

ArrayOfOHLCData

SparklineData

Stats



Place order errors

Errors

Rest Clients

CCXT



Websocket Feed

Subscribing to Channels

Subscribe

Unsubscribe

Authenticating a connection



Detecting Connection Drops

Heartbeat (Recommended)

Ping/Pong



Public Channels

v2 ticker

l2_orderbook

all_trades

mark_price

spot_price

funding_rate

product_updates

announcements

candlesticks



Private Channels

Margins

Positions

Orders

UserTrades



Web Socket RPC

Request Message

Response Message



Changelog

V2 Rest Api

New Socket Channels



Security

Targets In scope

How to access

Reward range

Rules of engagement

Rules of reporting

Recommended Reporting format

Ineligible issues









Introduction


Welcome to the Delta Exchange API! You can use this API to place orders on Delta Exchange and listen to market feed.

We have language bindings in Shell, Python, Ruby and Nodejs! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.


Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

General Information

Definitions


Assets: are cryptocurrencies or fiat currencies. Each asset has a 3/4 letter code (e.g. BTC, USDC). A derivative contract on Delta Exchange will entail multiple assets, namely:


Underlying Asset: This is the asset over which a futures or perpetual contract is defined. For e.g. the underlying asset of the BTCUSD perpetual contract is BTC. 

Quoting Asset: The asset in which price of the quoting is called the quoting asset. For e.g. the BTCUSD contract is quoted in USD. Therefore, the quoting asset of the contract is USD.

Settling Asset: The asset in which the margin and Profit/ Loss of a contract is denominated. For e.g. the BTCUSD contract is margined and settled in BTC. Therefore, the settling asset of the contract is BTC.


Products: are the derivative contracts listed on Delta Exchange. Each contract can be referred by either its Product ID (e.g. 27 is the Product ID of BTCUSD contract) or Symbol (BTCUSD is the symbol for BTCUSD contract). It is worth noting that Orders, Orderbook APIs expect Product IDs. e.g
product_id symbol product_type description
27 BTCUSD inverse_future Bitcoin Perpetual futures, quoted in US Dollar and settled & margined in BTC
45 XRPUSDQ future XRP/USD perpetual futures USDC Quanto, quoted in US Dollar and settled & margined in USDC
46 BTCUSD_27Dec inverse_future 27th December Bitcoin future quoted in US Dollar

Symbology


Contract symbol: has the following format

Underlying Asset| Quoting Asset|Q (optional; applicable only to quanto contracts)|_|Matruity Date (optional, applicable only for futures contracts)

e.g. BTCUSD, BTCUSD_27Dec, LEOUSDQ

Mark Price: Each contract has a unique Mark Price which can be referred to by: MARK: Contract_Symbol (MARK:BTCUSD) 

Index Price: The prices of the underlying assets for the contracts listed on Delta Exchange are obtained from various spot exchanges, and are computed by averaging prices from multiple exchanges. Details of all the indices are available on this page.

For a given Underlying Asset/ Quoting Asset pair, the Index price symbol is: .DE|Underlying Asset|Quoting Asset| e.g. .DEBNBXBT It is important to note that the BTCUSD Index price doesn't follow this convention as its symbol is .DEXBTUSD.

Pagination


Pagination allows to fetch data page-wise. We use cursor based pagination where each response metadata contains a before and after cursor. The cursor needs to passed on with the next request to paginate over the result. Please note that the cursors are updated with each new page.

Pagination can be called in following APIs
API End point
Products /products
Orders /orders
Orders History /orders/history
Fills /fills
Wallet transactions /wallet/transactions

Pagination parameters


after

after cursor to fetch the next page


before

before cursor to fetch the previous page


page_size

page size for pagination



In API response, meta data will contain the cursors as show below
{
  success: true,
  result: [ {}, {}, .....],
  meta: {
    after: "an_arbitary_string",
    before: "another_arbitary_string"
  }
}

Example

https://api.delta.exchange/v2/products?page_size=30

https://api.delta.exchange/v2/products?page_size=30&after=after_cursor_from_last_request

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


{ "error: "SignatureExpired", message:"your signature has expired" }


Signature created in the last 5 seconds is allowed. if signature reaches delta system post 5 seconds of generation, then it will fail.


{ "error": "InvalidApiKey", message: "Api Key not found"}


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


{ "error: "UnauthorizedApiAccess", message:"Api Key not authorised to access this endpoint" }


Check api key have required permissions like trading permission

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:


Trading - Allow a key to have trading permissions. This includes placing new orders, cancelling orders, closing positions, changing margin & leverage.

Withdrawals - Allows a key to transfer assets/cryptocurrencies on behalf of an account, including deposits and withdraws. Enable with caution - API key transfers WILL BYPASS two-factor authentication.

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

api_key = 'a207900b7693435a8fa9230a38195d'
api_secret = '7b6f39dcf660ec1c7c664f612c60410a2bd0c258416b498bf0311f94228f'

def generate_signature(secret, message):
    message = bytes(message, 'utf-8')
    secret = bytes(secret, 'utf-8')
    hash = hmac.new(secret, message, hashlib.sha256)
    return hash.hexdigest()

def get_time_stamp():
    d = datetime.datetime.utcnow()
    epoch = datetime.datetime(1970,1,1)
    return str(int((d - epoch).total_seconds()))

url = "https://testnet-api.delta.exchange/orders"

# Get open orders
payload = ''
method = 'GET'
timestamp = get_time_stamp()
path = '/orders'
query_string = '?product_id=1&state=open'
signature_data = method + timestamp + path + query_string + payload
signature = generate_signature(api_secret, signature_data)

req_headers = {
  'api-key': api_key,
  'timestamp': timestamp,
  'signature': signature,
  'User-Agent': 'rest-client',
  'Content-Type': 'application/json'
}
query = {"product_id": 1, "state": 'open'}

response = requests.request(
    method, url, data=payload, params=query, timeout=(3, 27), headers=req_headers
)

# Place new order
method = 'POST'
timestamp = get_time_stamp()
path = '/orders'
query_string = ''
payload = "{\"order_type\":\"limit_order\",\"size\":3,\"side\":\"buy\",\"limit_price\":\"0.0005\",\"product_id\":16}"
signature_data = method + timestamp + path + query_string + payload
signature = generate_signature(api_secret, signature_data)

req_headers = {
  'api-key': api_key,
  'timestamp': timestamp,
  'signature': signature,
  'User-Agent': 'rest-client',
  'Content-Type': 'application/json'
}

response = requests.request(
    method, url, data=payload, params={}, timeout=(3, 27), headers=req_headers
)

Rate Limits


When a rate limit is exceeded, a 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. 

We throttle unauthenticated api requests by IP and authenticated requests by user ID. 

Default Quota is 10000 for a fixed 5 minute window.

REST API Cost Structure


Every rest endpoint has been assigned a cost (weight). When you make an api call, the cost incurred is deducted from your 5 min quota. So, Apis related to reading public data are cheaper whereas Apis related to writing private data (like placing an order) are the costliest. 

Here is the cost structure for various endpoints. Please note that any endpoint not mentioned here has a cost of 1 unit.
Cost Slab API Endpoints
3 Get Products, Get Orderbook, Get Tickers, Get Open Orders, Get Open Postions, Get Balances, OHLC Candles
5 Place/Edit/Delete Order, Add Position Margin
10 Get Order History, Get Fills, Get Txn Logs
25 Batch Order Apis

Increasing your rate limits


If you are running up against our limits and believe that you have a legitimate need, please email us at [email protected] to discuss increasing your rate limits.

Types

Timestamps


Unless otherwise specified, all timestamps from API are returned in ISO 8601 with microseconds. Make sure you can parse the following ISO 8601 format. Most modern languages and libraries will handle this without issues.
2019-09-18T10:41:20Z

Numbers


Big Decimal numbers are returned as strings to save full precision. When making a API request, it is suggested to convert numbers to strings to avoid truncation and precision errors.

e.g. Limit price, stop loss price, trail_amount

Integer numbers (like contract size, product_id and impact size) are unquoted.

IDs


Most identifiers are UUID unless otherwise specified. When making a request which requires a UUID, both forms (with and without dashes) are accepted.

167ja7cg-678e-6876-d6g3-f803ce49qsc9or167ja7cg678e6876d6g3f803ce49qsc9

Response Formats


To ensure that you are effectively using the api, we encourage you to go through this section. 


(一)All responses coming from the server, either from rest api or socket rpc calls will have the following success and error formats.

(二)All timestamps reported in the apis will be in microseconds

(三)All big decimal values are sent as string

// Success format
{
  success: true,
  result: ...,              // response body
  meta: {                   // response meta - like pagination info
    ...
  }
}

// Error format
{
  success: false,
  error: {
    code: ...,                // standard error code
    context: {                // extra context data to explain the cause of error
      ...
    }
  }
}

Rest Api


This section documents the latest(v2) api for trading on Delta Exchange. The REST API has endpoints for account and order management as well as public market data.

If you are looking for the old api documentation, here is the link to v1 api docs (now deprecated). 

REST API ENDPOINT URL


Production - https://api.delta.exchange/v2

Testnet - https://testnet-api.delta.exchange/v2

Assets


Get Asset List

Get list of all assets




Code samples

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

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

}, headers = headers)

print r.json()

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

p JSON.parse(result)


GET /assets


Example responses

200 Response

{
  "success": true,
  "result": [
    {
      "id": 0,
      "symbol": "string",
      "precision": 0,
      "deposit_status": "enabled",
      "withdrawal_status": "enabled",
      "base_withdrawal_fee": "string",
      "min_withdrawal_amount": "string"
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK List of all assets Inline

Response Schema

Enumerated Values

Property Value
deposit_status enabled
deposit_status disabled
withdrawal_status enabled
withdrawal_status disabled

Indices


Get Indices List

Get indices




Code samples

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

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

}, headers = headers)

print r.json()

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

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)


GET /indices


Example responses

200 Response

{
  "success": true,
  "result": [
    {
      "id": 0,
      "symbol": "string",
      "constituent_exchanges": [
        {}
      ],
      "underlying_asset_id": 0,
      "quoting_asset_id": 0,
      "index_type": "spot_pair"
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK List of indices (Spot underlyings, Interest Rates indexes) Inline

Response Schema

Enumerated Values

Property Value
index_type spot_pair
index_type fixed_interest_rate
index_type floating_interest_rate

Products


Get Product List

Get list of products




Code samples

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

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

}, headers = headers)

print r.json()

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

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)


GET /products

Parameters

Parameter In Type Required Description
contract_types query string false Comma separated list of contract types
states query string false Comma separated list of states e.g. to get expired contracts https://api.delta.exchange/v2/products?contract_types=call_options&states=expired
after query string false after cursor for paginated request
before query string false before cursor for paginated request
page_size query string false size of a single page for paginated request, default: 100


Example responses

200 Response

{
  "success": true,
  "result": [
    {
      "id": 0,
      "symbol": "string",
      "description": "string",
      "created_at": "string",
      "updated_at": "string",
      "settlement_time": "string",
      "notional_type": "vanilla",
      "impact_size": 0,
      "initial_margin": 0,
      "maintenance_margin": "string",
      "contract_value": "string",
      "contract_unit_currency": "string",
      "tick_size": "string",
      "product_specs": {},
      "state": "live",
      "trading_status": "operational",
      "max_leverage_notional": "string",
      "default_leverage": "string",
      "initial_margin_scaling_factor": "string",
      "maintenance_margin_scaling_factor": "string",
      "taker_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,
        "deposit_status": "enabled",
        "withdrawal_status": "enabled",
        "base_withdrawal_fee": "string",
        "min_withdrawal_amount": "string"
      },
      "quoting_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0,
        "deposit_status": "enabled",
        "withdrawal_status": "enabled",
        "base_withdrawal_fee": "string",
        "min_withdrawal_amount": "string"
      },
      "settling_asset": {
        "id": 0,
        "symbol": "string",
        "precision": 0,
        "deposit_status": "enabled",
        "withdrawal_status": "enabled",
        "base_withdrawal_fee": "string",
        "min_withdrawal_amount": "string"
      },
      "spot_index": {
        "id": 0,
        "symbol": "string",
        "constituent_exchanges": [
          {}
        ],
        "underlying_asset_id": 0,
        "quoting_asset_id": 0,
        "index_type": "spot_pair"
      }
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK List of products Inline

Response Schema

Enumerated Values

Property Value
notional_type vanilla
notional_type inverse
state live
state expired
state upcoming
trading_status operational
trading_status disrupted_cancel_only
trading_status disrupted_post_only
deposit_status enabled
deposit_status disabled
withdrawal_status enabled
withdrawal_status disabled
index_type spot_pair
index_type fixed_interest_rate
index_type floating_interest_rate

Get product by symbol




Code samples

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

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

}, headers = headers)

print r.json()

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

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)


GET /products/{symbol}

Parameters

Parameter In Type Required Description
symbol path string true symbol of the desired product


Example responses

200 Response

{
  "success": true,
  "result": {
    "id": 0,
    "symbol": "string",
    "description": "string",
    "created_at": "string",
    "updated_at": "string",
    "settlement_time": "string",
    "notional_type": "vanilla",
    "impact_size": 0,
    "initial_margin": 0,
    "maintenance_margin": "string",
    "contract_value": "string",
    "contract_unit_currency": "string",
    "tick_size": "string",
    "product_specs": {},
    "state": "live",
    "trading_status": "operational",
    "max_leverage_notional": "string",
    "default_leverage": "string",
    "initial_margin_scaling_factor": "string",
    "maintenance_margin_scaling_factor": "string",
    "taker_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,
      "deposit_status": "enabled",
      "withdrawal_status": "enabled",
      "base_withdrawal_fee": "string",
      "min_withdrawal_amount": "string"
    },
    "quoting_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0,
      "deposit_status": "enabled",
      "withdrawal_status": "enabled",
      "base_withdrawal_fee": "string",
      "min_withdrawal_amount": "string"
    },
    "settling_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0,
      "deposit_status": "enabled",
      "withdrawal_status": "enabled",
      "base_withdrawal_fee": "string",
      "min_withdrawal_amount": "string"
    },
    "spot_index": {
      "id": 0,
      "symbol": "string",
      "constituent_exchanges": [
        {}
      ],
      "underlying_asset_id": 0,
      "quoting_asset_id": 0,
      "index_type": "spot_pair"
    }
  }
}

Responses

Status Meaning Description Schema
200 OK List of products Inline

Response Schema

Enumerated Values

Property Value
notional_type vanilla
notional_type inverse
state live
state expired
state upcoming
trading_status operational
trading_status disrupted_cancel_only
trading_status disrupted_post_only
deposit_status enabled
deposit_status disabled
withdrawal_status enabled
withdrawal_status disabled
index_type spot_pair
index_type fixed_interest_rate
index_type floating_interest_rate

Get tickers for products




Code samples

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

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

}, headers = headers)

print r.json()

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

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)


GET /tickers

Parameters

Parameter In Type Required Description
contract_types query string false Comma separated list of contract types


Example responses

200 Response

{
  "success": true,
  "result": [
    {
      "close": 0,
      "contract_type": "string",
      "greeks": {
        "delta": "string",
        "gamma": "string",
        "rho": "string",
        "theta": "string",
        "vega": "string"
      },
      "high": 0,
      "low": 0,
      "mark_price": "string",
      "mark_vol": "string",
      "oi": "string",
      "oi_value": "string",
      "oi_value_symbol": "string",
      "oi_value_usd": "string",
      "open": 0,
      "price_band": {
        "lower_limit": "string",
        "upper_limit": "string"
      },
      "product_id": 0,
      "quotes": {
        "ask_iv": "string",
        "ask_size": "string",
        "best_ask": "string",
        "best_bid": "string",
        "bid_iv": "string",
        "bid_size": "string"
      },
      "size": 0,
      "spot_price": "string",
      "strike_price": "string",
      "symbol": "string",
      "timestamp": 0,
      "turnover": 0,
      "turnover_symbol": "string",
      "turnover_usd": 0,
      "volume": 0
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK List of live tickers for all products Inline

Response Schema

Get ticker for a product by symbol




Code samples

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

r = requests.get('https://api.delta.exchange/v2/tickers/{symbol}', params={

}, headers = headers)

print r.json()

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

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)


GET /tickers/{symbol}

Parameters

Parameter In Type Required Description
symbol path string true symbol of the ticker


Example responses

200 Response

{
  "success": true,
  "result": {
    "close": 0,
    "contract_type": "string",
    "greeks": {
      "delta": "string",
      "gamma": "string",
      "rho": "string",
      "theta": "string",
      "vega": "string"
    },
    "high": 0,
    "low": 0,
    "mark_price": "string",
    "mark_vol": "string",
    "oi": "string",
    "oi_value": "string",
    "oi_value_symbol": "string",
    "oi_value_usd": "string",
    "open": 0,
    "price_band": {
      "lower_limit": "string",
      "upper_limit": "string"
    },
    "product_id": 0,
    "quotes": {
      "ask_iv": "string",
      "ask_size": "string",
      "best_ask": "string",
      "best_bid": "string",
      "bid_iv": "string",
      "bid_size": "string"
    },
    "size": 0,
    "spot_price": "string",
    "strike_price": "string",
    "symbol": "string",
    "timestamp": 0,
    "turnover": 0,
    "turnover_symbol": "string",
    "turnover_usd": 0,
    "volume": 0
  }
}

Responses

Status Meaning Description Schema
200 OK ticker data for requested product Inline

Response Schema

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/v2/orders', params={

}, headers = headers)

print r.json()

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

require 'rest-client'
require 'json'

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

result = RestClient.post 'https://api.delta.exchange/v2/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",
  "stop_order_type": "stop_loss_order",
  "stop_price": "string",
  "stop_trigger_method": "mark_price",
  "time_in_force": "gtc",
  "post_only": "true",
  "reduce_only": "true",
  "client_order_id": "string"
}

Parameters

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


Example responses

200 Response

{
  "success": true,
  "result": {
    "id": "ashb1212",
    "client_order_id": "asbasa",
    "product_id": 27,
    "product_symbol": "BTCUSD",
    "limit_price": "9200",
    "side": "buy",
    "size": 100,
    "unfilled_size": 50,
    "user_id": 1,
    "order_type": "limit_order",
    "state": "open",
    "created_at": "..."
  }
}

Responses

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

Response Schema

Enumerated Values

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

Cancel Order




Code samples

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

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

}, headers = headers)

print r.json()

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

require 'rest-client'
require 'json'

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

result = RestClient.delete 'https://api.delta.exchange/v2/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

{
  "success": true,
  "result": {
    "id": "ashb1212",
    "client_order_id": "asbasa",
    "product_id": 27,
    "product_symbol": "BTCUSD",
    "limit_price": "9200",
    "side": "buy",
    "size": 100,
    "unfilled_size": 50,
    "user_id": 1,
    "order_type": "limit_order",
    "state": "open",
    "created_at": "..."
  }
}

Responses

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

Response Schema

Enumerated Values

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

Edit Order




Code samples

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

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

}, headers = headers)

print r.json()

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

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)


PUT /orders


Body parameter

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

Parameters

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


Example responses

200 Response

{
  "success": true,
  "result": {
    "id": "ashb1212",
    "client_order_id": "asbasa",
    "product_id": 27,
    "product_symbol": "BTCUSD",
    "limit_price": "9200",
    "side": "buy",
    "size": 100,
    "unfilled_size": 50,
    "user_id": 1,
    "order_type": "limit_order",
    "state": "open",
    "created_at": "..."
  }
}

Responses

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

Response Schema

Enumerated Values

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

Get Active Orders




Code samples

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

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

}, headers = headers)

print r.json()

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

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)


GET /orders

Parameters

Parameter In Type Required Description
product_ids query string false comma separated product ids
states query string false comma separated list of states - open,pending
contract_types query string false comma separated list of desired contract types, if not specified any parameters then, all the orders will be returned
order_types query string false comma separated order types
start_time query integer false from time in micro-seconds in epoc
end_time query integer false from time in micro-seconds in epoc
after query string false after cursor for pagination
before query string false before cursor for pagination
page_size query integer false number of records per page

Enumerated Values

Parameter Value
contract_types futures
contract_types perpetual_futures
contract_types call_options
contract_types put_options
order_types market
order_types limit
order_types stop_market
order_types stop_limit
order_types all_stop


Example responses

200 Response

{
  "success": true,
  "result": [
    {
      "id": "ashb1212",
      "client_order_id": "asbasa",
      "product_id": 27,
      "product_symbol": "BTCUSD",
      "limit_price": "9200",
      "side": "buy",
      "size": 100,
      "unfilled_size": 50,
      "user_id": 1,
      "order_type": "limit_order",
      "state": "open",
      "created_at": "..."
    }
  ],
  "meta": {
    "after": "string",
    "before": "string"
  }
}

Responses

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

Response Schema

Enumerated Values

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

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

}, headers = headers)

print r.json()

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

require 'rest-client'
require 'json'

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

result = RestClient.delete 'https://api.delta.exchange/v2/orders/all',
  params: {
  }, headers: headers

p JSON.parse(result)


DELETE /orders/all


Body parameter

{
  "product_id": 0,
  "contract_types": "string",
  "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

{
  "success": true
}

Responses

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

Create batch orders




Code samples

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

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

}, headers = headers)

print r.json()

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

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)


POST /orders/batch


Body parameter

{
  "orders": [
    {
      "product_id": 0,
      "limit_price": "string",
      "size": 0,
      "side": "buy",
      "order_type": "limit_order",
      "stop_order_type": "stop_loss_order",
      "stop_price": "string",
      "stop_trigger_method": "mark_price",
      "time_in_force": "gtc",
      "post_only": "true",
      "reduce_only": "true",
      "client_order_id": "string"
    }
  ],
  "product_id": 0
}

Parameters

Parameter In Type Required Description
body body object 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
» orders body [CreateOrderRequest] false [A create order object]
»» product_id body integer true none
»» limit_price body string false none
»» size body integer false none
»» side body string false side for which to place order
»» order_type body string false none
»» stop_order_type body string false none
»» stop_price body string false none
»» stop_trigger_method body string false none
»» time_in_force body string false none
»» post_only body string false none
»» reduce_only body string false none
»» client_order_id body string false none
» product_id body integer false none

Enumerated Values

Parameter Value
»» side buy
»» side sell
»» order_type limit_order
»» order_type market_order
»» stop_order_type stop_loss_order
»» stop_order_type take_profit_order
»» stop_trigger_method mark_price
»» stop_trigger_method last_traded_price
»» stop_trigger_method spot_price
»» time_in_force gtc
»» time_in_force ioc
»» time_in_force fok
»» post_only true
»» post_only false
»» reduce_only true
»» reduce_only false


Example responses

200 Response

{
  "success": true,
  "result": [
    {
      "id": "ashb1212",
      "client_order_id": "asbasa",
      "product_id": 27,
      "product_symbol": "BTCUSD",
      "limit_price": "9200",
      "side": "buy",
      "size": 100,
      "unfilled_size": 50,
      "user_id": 1,
      "order_type": "limit_order",
      "state": "open",
      "created_at": "..."
    }
  ]
}

Responses

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

Response Schema

Enumerated Values

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

Edit batch orders




Code samples

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

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

}, headers = headers)

print r.json()

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

require 'rest-client'
require 'json'

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

result = RestClient.put 'https://api.delta.exchange/v2/orders/batch',
  params: {
  }, headers: headers

p JSON.parse(result)


PUT /orders/batch

batch order edit 


Body parameter

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

Parameters

Parameter In Type Required Description
body body object true none
» orders body [EditOrderRequest] false [edit order object]
»» id body integer false none
»» product_id body integer false none
»» limit_price body string false none
»» size body integer false total size after editing order
» product_id body integer false none


Example responses

200 Response

{
  "success": true,
  "result": [
    {
      "id": "ashb1212",
      "client_order_id": "asbasa",
      "product_id": 27,
      "product_symbol": "BTCUSD",
      "limit_price": "9200",
      "side": "buy",
      "size": 100,
      "unfilled_size": 50,
      "user_id": 1,
      "order_type": "limit_order",
      "state": "open",
      "created_at": "..."
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK List of edited orders Inline
400 Bad Request returns error if orders couldnt be edited ApiErrorResponse

Response Schema

Enumerated Values

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

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/v2/orders/batch', params={

}, headers = headers)

print r.json()

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

require 'rest-client'
require 'json'

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

result = RestClient.delete 'https://api.delta.exchange/v2/orders/batch',
  params: {
  }, headers: headers

p JSON.parse(result)


DELETE /orders/batch


Body parameter

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

Parameters

Parameter In Type Required Description
body body object true none
» orders body [DeleteOrderRequest] false [A delete order object]
»» id body integer false none
»» product_id body integer false none
» product_id body integer false none


Example responses

200 Response

{
  "success": true,
  "result": [
    {
      "id": "ashb1212",
      "client_order_id": "asbasa",
      "product_id": 27,
      "product_symbol": "BTCUSD",
      "limit_price": "9200",
      "side": "buy",
      "size": 100,
      "unfilled_size": 50,
      "user_id": 1,
      "order_type": "limit_order",
      "state": "open",
      "created_at": "..."
    }
  ]
}

Responses

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

Response Schema

Enumerated Values

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

Change order leverage




Code samples

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

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

}, headers = headers)

print r.json()

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

p JSON.parse(result)


POST /products/{product_id}/orders/leverage


Body parameter

{
  "leverage": "string"
}

Parameters

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


Example responses

200 Response

Responses

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

Response Schema

Get order leverage




Code samples

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

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

}, headers = headers)

print r.json()

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

p JSON.parse(result)


GET /products/{product_id}/orders/leverage

Parameters

Parameter In Type Required Description
product_id path integer true none


Example responses

200 Response

Responses

Status Meaning Description Schema
200 OK returns the OrderLeverage object Inline

Response Schema

Positions


Get Open positions, Change Position Margin, Close Position, Close All Position

Get position




Code samples

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

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

print r.json()

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

p JSON.parse(result)


GET /positions

Parameters

Parameter In Type Required Description
product_id query integer true id of the product


Example responses

200 Response

{
  "success": true,
  "result": {
    "size": 0,
    "entry_price": "string"
  }
}

Responses

Status Meaning Description Schema
200 OK Open position for the give product id Inline

Response Schema

Get margined positions




Code samples

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

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

}, headers = headers)

print r.json()

# You can also use wget
curl -X GET https://api.delta.exchange/v2/positions/margined \
  -H 'Accept: application/json' \
  -H 'api-key: ****' \
  -H 'signature: ****' \
  -H 'timestamp: ****'

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)


GET /positions/margined

Parameters

Parameter In Type Required Description
product_ids query string false comma separated product ids
contract_types query string false comma separated list of desired contract types, if not specified any parameters then, all the open positions will be returned

Enumerated Values

Parameter Value
contract_types futures
contract_types perpetual_futures
contract_types call_options
contract_types put_options


Example responses

200 Response

{
  "success": true,
  "result": [
    {
      "user_id": 0,
      "size": 0,
      "entry_price": "string",
      "margin": "string",
      "liquidation_price": "string",
      "bankruptcy_price": "string",
      "adl_level": 0,
      "product_id": 0,
      "product_symbol": "string",
      "commission": "string",
      "realized_pnl": "string",
      "realized_funding": "string"
    }
  ]
}

Responses

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

Response Schema

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

}, headers = headers)

print r.json()

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

require 'rest-client'
require 'json'

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

result = RestClient.post 'https://api.delta.exchange/v2/positions/change_margin',
  params: {
  }, headers: headers

p JSON.parse(result)


POST /positions/change_margin


Body parameter

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

Parameters

Parameter In Type Required Description
body body object true none
» product_id body integer true none
» delta_margin body string true Delta in the position margin, positive in case of adding margin & negative in case of removing margin


Example responses

200 Response

{
  "success": true,
  "result": {
    "user_id": 0,
    "size": 0,
    "entry_price": "string",
    "margin": "string",
    "liquidation_price": "string",
    "bankruptcy_price": "string",
    "adl_level": 0,
    "product_id": 0,
    "product_symbol": "string",
    "commission": "string",
    "realized_pnl": "string",
    "realized_funding": "string"
  }
}

Responses

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

Response Schema

Close all positions




Code samples

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

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

}, headers = headers)

print r.json()

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

require 'rest-client'
require 'json'

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

result = RestClient.post 'https://api.delta.exchange/v2/positions/close_all',
  params: {
  }, headers: headers

p JSON.parse(result)


POST /positions/close_all


Body parameter

{
  "close_all_portfolio": true,
  "close_all_isolated": true,
  "user_id": 0
}

Parameters

Parameter In Type Required Description
body body object true none
» close_all_portfolio body boolean true none
» close_all_isolated body boolean true none
» user_id body integer true none


Example responses

200 Response

{
  "success": true
}

Responses

Status Meaning Description Schema
200 OK returns back success response ApiSuccessResponse
400 Bad Request Returns error if not able to close all positions ApiErrorResponse

TradeHistory


Get Orders History, Get Fill History

Get order history (cancelled and closed)




Code samples

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

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

}, headers = headers)

print r.json()

# You can also use wget
curl -X GET https://api.delta.exchange/v2/orders/history \
  -H 'Accept: application/json' \
  -H 'api-key: ****' \
  -H 'signature: ****' \
  -H 'timestamp: ****'

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)


GET /orders/history

Parameters

Parameter In Type Required Description
product_ids query string false comma separated product ids
contract_types query string false comma separated list of desired contract types
order_types query string false comma separated order types
start_time query integer false from time in micro-seconds in epoc
end_time query integer false from time in micro-seconds in epoc
after query string false after cursor for pagination
before query string false before cursor for pagination
page_size query integer false number of records per page

Enumerated Values

Parameter Value
order_types market
order_types limit
order_types stop_market
order_types stop_limit
order_types all_stop


Example responses

200 Response

{
  "success": true,
  "result": [
    {
      "id": "ashb1212",
      "client_order_id": "asbasa",
      "product_id": 27,
      "product_symbol": "BTCUSD",
      "limit_price": "9200",
      "side": "buy",
      "size": 100,
      "unfilled_size": 50,
      "user_id": 1,
      "order_type": "limit_order",
      "state": "open",
      "created_at": "..."
    }
  ],
  "meta": {
    "after": "string",
    "before": "string"
  }
}

Responses

Status Meaning Description Schema
200 OK List of closed and cancelled orders Inline

Response Schema

Enumerated Values

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

GET user fills by filters




Code samples

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

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

}, headers = headers)

print r.json()

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

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)


GET /fills

Parameters

Parameter In Type Required Description
product_ids query string false comma separated product ids
contract_types query string false comma separated list of desired contract types
start_time query integer false from time in micro-seconds in epoc
end_time query integer false from time in micro-seconds in epoc
after query string false after cursor for pagination
before query string false before cursor for pagination
page_size query integer false number of records per page


Example responses

200 Response

{
  "success": true,
  "result": [
    {
      "id": 0,
      "size": 0,
      "side": "buy",
      "price": "string",
      "role": "taker",
      "commission": "string",
      "created_at": "string",
      "product_id": 0,
      "product_symbol": "string"
    }
  ],
  "meta": {
    "after": "string",
    "before": "string"
  }
}

Responses

Status Meaning Description Schema
200 OK fills Inline

Response Schema

Enumerated Values

Property Value
side buy
side sell
role taker
role maker

Download Wallet transactions




Code samples

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

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

}, headers = headers)

print r.json()

# You can also use wget
curl -X GET https://api.delta.exchange/v2/fills/history/download/csv \
  -H 'api-key: ****' \
  -H 'signature: ****' \
  -H 'timestamp: ****'

require 'rest-client'
require 'json'

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

result = RestClient.get 'https://api.delta.exchange/v2/fills/history/download/csv',
  params: {
  }, headers: headers

p JSON.parse(result)


GET /fills/history/download/csv

Parameters

Parameter In Type Required Description
product_ids query string false comma separated product ids
contract_types query string false comma separated list of desired contract types
start_time query integer false from time in micro-seconds in epoc
end_time query integer false from time in micro-seconds in epoc

Responses

Status Meaning Description Schema
200 OK csv of fills for the filter query None

Orderbook


L2Orderbook

Get L2 orderbook




Code samples

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

r = requests.get('https://api.delta.exchange/v2/l2orderbook/{symbol}', params={

}, headers = headers)

print r.json()

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

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)


GET /l2orderbook/{symbol}

Parameters

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


Example responses

200 Response

{
  "success": true,
  "result": {
    "buy": [
      {
        "price": "9187.5",
        "size": 205640
      }
    ],
    "sell": [
      {
        "price": "9188.0",
        "size": 113752
      }
    ]
  }
}

Responses

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

Response Schema

Trades


Get Trades of a contract

Get public trades




Code samples

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

r = requests.get('https://api.delta.exchange/v2/trades/{symbol}', params={

}, headers = headers)

print r.json()

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

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)


GET /trades/{symbol}

Parameters

Parameter In Type Required Description
symbol path string true none


Example responses

200 Response

{
  "success": true,
  "result": {
    "trades": [
      {
        "side": "buy",
        "size": 0,
        "price": "string",
        "timestamp": 0
      }
    ]
  }
}

Responses

Status Meaning Description Schema
200 OK List of recent trades of the product Inline

Response Schema

Enumerated Values

Property Value
side buy
side sell

Wallet


Get balances, Get transaction history

Get Wallet Balances




Code samples

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

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

}, headers = headers)

print r.json()

# You can also use wget
curl -X GET https://api.delta.exchange/v2/wallet/balances \
  -H 'Accept: application/json' \
  -H 'api-key: ****' \
  -H 'signature: ****' \
  -H 'timestamp: ****'

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)


GET /wallet/balances


Example responses

200 Response

{
  "success": true,
  "result": [
    {
      "balance": "string",
      "order_margin": "string",
      "position_margin": "string",
      "commission": "string",
      "available_balance": "string",
      "interest_credit": "string",
      "asset_id": 0,
      "asset_symbol": "string"
    }
  ]
}

Responses

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

Response Schema

Get Wallet transactions




Code samples

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

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

}, headers = headers)

print r.json()

# You can also use wget
curl -X GET https://api.delta.exchange/v2/wallet/transactions \
  -H 'Accept: application/json' \
  -H 'api-key: ****' \
  -H 'signature: ****' \
  -H 'timestamp: ****'

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)


GET /wallet/transactions

Parameters

Parameter In Type Required Description
asset_ids query integer false comma separated list of asset_ids for which to get txns logs
start_time query integer false from time in micro-seconds in epoc
end_time query integer false from time in micro-seconds in epoc
after query string false after cursor for pagination
before query string false before cursor for pagination
page_size query integer false number of records per page


Example responses

200 Response

{
  "success": true,
  "result": [
    {
      "id": 0,
      "amount": "string",
      "balance": "string",
      "transaction_type": "pnl",
      "meta_data": {},
      "product_id": 0,
      "asset_id": 0,
      "asset_symbol": 0,
      "created_at": "string"
    }
  ],
  "meta": {
    "after": "string",
    "before": "string"
  }
}

Responses

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

Response Schema

Enumerated Values

Property Value
transaction_type pnl
transaction_type deposit
transaction_type withdrawal
transaction_type commission
transaction_type conversion
transaction_type funding
transaction_type withdrawal_cancellation
transaction_type referral_bonus
transaction_type commission_rebate
transaction_type promo_credit
transaction_type trading_credits
transaction_type trading_credits_forfeited
transaction_type trading_credits_paid
transaction_type liquidation_fee
transaction_type interest_credit

Download Wallet transactions




Code samples

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

r = requests.get('https://api.delta.exchange/v2/wallet/transactions/download', params={

}, headers = headers)

print r.json()

# You can also use wget
curl -X GET https://api.delta.exchange/v2/wallet/transactions/download \
  -H 'api-key: ****' \
  -H 'signature: ****' \
  -H 'timestamp: ****'

require 'rest-client'
require 'json'

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

result = RestClient.get 'https://api.delta.exchange/v2/wallet/transactions/download',
  params: {
  }, headers: headers

p JSON.parse(result)


GET /wallet/transactions/download

Parameters

Parameter In Type Required Description
asset_ids query integer false comma separated list of asset_ids
start_time query integer false from time in micro-seconds in epoc
end_time query integer false from time in micro-seconds in epoc
after query string false after cursor for pagination
before query string false before cursor for pagination
page_size query integer false number of records per page

Responses

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

OHLC Candles


Get price data

GET ohlc candles




Code samples

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

r = requests.get('https://api.delta.exchange/v2/history/candles', params={
  'resolution': '1m',  'symbol': 'string',  'start': '0',  'end': '0'
}, headers = headers)

print r.json()

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

require 'rest-client'
require 'json'

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

result = RestClient.get 'https://api.delta.exchange/v2/history/candles',
  params: {
  'resolution' => 'string',
'symbol' => 'string',
'start' => 'integer',
'end' => 'integer'
}, headers: headers

p JSON.parse(result)


GET /history/candles

Parameters

Parameter In Type Required Description
resolution query string true none
symbol query string true product symbol needs to pass to get data, to get funding history in the same api pass symbol as FUNDING:${symbol} and for mark price MARK:${symbol}
start query integer true Start time
end query integer true End time

Enumerated Values

Parameter Value
resolution 1m
resolution 3m
resolution 5m
resolution 15m
resolution 30m
resolution 1h
resolution 2h
resolution 4h
resolution 6h
resolution 1d
resolution 7d
resolution 30d
resolution 1w
resolution 2w


Example responses

200 Response

{
  "success": true,
  "result": [
    {
      "time": 0,
      "open": 0,
      "high": 0,
      "low": 0,
      "close": 0,
      "volume": 0
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK ohlc Inline

Response Schema

GET product history sparkline




Code samples

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

r = requests.get('https://api.delta.exchange/v2/history/sparklines', params={
  'symbols': 'string'
}, headers = headers)

print r.json()

# You can also use wget
curl -X GET https://api.delta.exchange/v2/history/sparklines?symbols=string \
  -H 'Accept: application/json'

require 'rest-client'
require 'json'

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

result = RestClient.get 'https://api.delta.exchange/v2/history/sparklines',
  params: {
  'symbols' => 'string'
}, headers: headers

p JSON.parse(result)


GET /history/sparklines

Parameters

Parameter In Type Required Description
symbols query string true comma separated product symbols


Example responses

200 Response

{
  "success": true,
  "result": {
    "MARK:BTCUSD_31Oct": [
      [
        1594214051,
        0.00003826
      ],
      [
        1594214051,
        0.00003826
      ]
    ],
    "SPOT:BTCUSD_31Oct": [
      [
        1594215270,
        0.00003826
      ]
    ]
  }
}

Responses

Status Meaning Description Schema
200 OK product history sparkline Inline

Response Schema

Stats


Get Volume Stats

Get volume stats




Code samples

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

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

}, headers = headers)

print r.json()

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

require 'rest-client'
require 'json'

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

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

p JSON.parse(result)


GET /stats


Example responses

200 Response

{
  "success": true,
  "result": {
    "last_30_days_volume": 0,
    "last_7_days_volume": 0,
    "total_volume": 0
  }
}

Responses

Status Meaning Description Schema
200 OK sum of turnover in the last 7 and 30 days along with Total Volume in the last 24 hours (in USD) Inline

Response Schema

Schemas

ApiSuccessResponse


{
  "success": true
}

Properties

Name Type Required Restrictions Description
success boolean false none none

ApiErrorResponse


{
  "success": false,
  "error": {}
}

Properties

Name Type Required Restrictions Description
success boolean false none none
error object false none none

Index


{
  "id": 0,
  "symbol": "string",
  "constituent_exchanges": [
    {}
  ],
  "underlying_asset_id": 0,
  "quoting_asset_id": 0,
  "index_type": "spot_pair"
}

Properties

Name Type Required Restrictions Description
id integer(int64) false none none
symbol string false none none
constituent_exchanges [object] false none none
underlying_asset_id integer false none Asset ID for base symbol
quoting_asset_id integer false none Asset ID for quoting symbol
index_type string false none Type of index

Enumerated Values

Property Value
index_type spot_pair
index_type fixed_interest_rate
index_type floating_interest_rate

ArrayOfIndices


[
  {
    "id": 0,
    "symbol": "string",
    "constituent_exchanges": [
      {}
    ],
    "underlying_asset_id": 0,
    "quoting_asset_id": 0,
    "index_type": "spot_pair"
  }
]

Properties

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

Asset


{
  "id": 0,
  "symbol": "string",
  "precision": 0,
  "deposit_status": "enabled",
  "withdrawal_status": "enabled",
  "base_withdrawal_fee": "string",
  "min_withdrawal_amount": "string"
}

Properties

Name Type Required Restrictions Description
id integer(int64) false none none
symbol string false none none
precision integer false none none
deposit_status string false none none
withdrawal_status string false none none
base_withdrawal_fee string false none none
min_withdrawal_amount string false none Minimum value of allowed withdrawal

Enumerated Values

Property Value
deposit_status enabled
deposit_status disabled
withdrawal_status enabled
withdrawal_status disabled

ArrayOfAssets


[
  {
    "id": 0,
    "symbol": "string",
    "precision": 0,
    "deposit_status": "enabled",
    "withdrawal_status": "enabled",
    "base_withdrawal_fee": "string",
    "min_withdrawal_amount": "string"
  }
]

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",
  "notional_type": "vanilla",
  "impact_size": 0,
  "initial_margin": 0,
  "maintenance_margin": "string",
  "contract_value": "string",
  "contract_unit_currency": "string",
  "tick_size": "string",
  "product_specs": {},
  "state": "live",
  "trading_status": "operational",
  "max_leverage_notional": "string",
  "default_leverage": "string",
  "initial_margin_scaling_factor": "string",
  "maintenance_margin_scaling_factor": "string",
  "taker_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,
    "deposit_status": "enabled",
    "withdrawal_status": "enabled",
    "base_withdrawal_fee": "string",
    "min_withdrawal_amount": "string"
  },
  "quoting_asset": {
    "id": 0,
    "symbol": "string",
    "precision": 0,
    "deposit_status": "enabled",
    "withdrawal_status": "enabled",
    "base_withdrawal_fee": "string",
    "min_withdrawal_amount": "string"
  },
  "settling_asset": {
    "id": 0,
    "symbol": "string",
    "precision": 0,
    "deposit_status": "enabled",
    "withdrawal_status": "enabled",
    "base_withdrawal_fee": "string",
    "min_withdrawal_amount": "string"
  },
  "spot_index": {
    "id": 0,
    "symbol": "string",
    "constituent_exchanges": [
      {}
    ],
    "underlying_asset_id": 0,
    "quoting_asset_id": 0,
    "index_type": "spot_pair"
  }
}

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
notional_type string false none whether notional is calculated using vanilla math or inverse math
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.
product_specs object false none Specs related to specific contract types (IRS indices, options volatility limits)
state string false none current state of the product
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
taker_commission_rate string false none rate at which commission fee will be calculated for a taker 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 the 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
spot_index Index false none none

Enumerated Values

Property Value
notional_type vanilla
notional_type inverse
state live
state expired
state upcoming
trading_status operational
trading_status disrupted_cancel_only
trading_status disrupted_post_only

ArrayOfProducts


[
  {
    "id": 0,
    "symbol": "string",
    "description": "string",
    "created_at": "string",
    "updated_at": "string",
    "settlement_time": "string",
    "notional_type": "vanilla",
    "impact_size": 0,
    "initial_margin": 0,
    "maintenance_margin": "string",
    "contract_value": "string",
    "contract_unit_currency": "string",
    "tick_size": "string",
    "product_specs": {},
    "state": "live",
    "trading_status": "operational",
    "max_leverage_notional": "string",
    "default_leverage": "string",
    "initial_margin_scaling_factor": "string",
    "maintenance_margin_scaling_factor": "string",
    "taker_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,
      "deposit_status": "enabled",
      "withdrawal_status": "enabled",
      "base_withdrawal_fee": "string",
      "min_withdrawal_amount": "string"
    },
    "quoting_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0,
      "deposit_status": "enabled",
      "withdrawal_status": "enabled",
      "base_withdrawal_fee": "string",
      "min_withdrawal_amount": "string"
    },
    "settling_asset": {
      "id": 0,
      "symbol": "string",
      "precision": 0,
      "deposit_status": "enabled",
      "withdrawal_status": "enabled",
      "base_withdrawal_fee": "string",
      "min_withdrawal_amount": "string"
    },
    "spot_index": {
      "id": 0,
      "symbol": "string",
      "constituent_exchanges": [
        {}
      ],
      "underlying_asset_id": 0,
      "quoting_asset_id": 0,
      "index_type": "spot_pair"
    }
  }
]

Properties

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

Order


{
  "id": "ashb1212",
  "client_order_id": "asbasa",
  "product_id": 27,
  "product_symbol": "BTCUSD",
  "limit_price": "9200",
  "side": "buy",
  "size": 100,
  "unfilled_size": 50,
  "user_id": 1,
  "order_type": "limit_order",
  "state": "open",
  "created_at": "..."
}


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
paid_commission string false none net commission paid for the order
close_on_trigger string false none none
client_order_id string false none client order id provided by the user while creating order
state string false none Order Status
created_at string false none none
product_id integer false none none
product_symbol string 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": "ashb1212",
    "client_order_id": "asbasa",
    "product_id": 27,
    "product_symbol": "BTCUSD",
    "limit_price": "9200",
    "side": "buy",
    "size": 100,
    "unfilled_size": 50,
    "user_id": 1,
    "order_type": "limit_order",
    "state": "open",
    "created_at": "..."
  }
]

Properties

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

CreateOrderRequest


{
  "product_id": 0,
  "limit_price": "string",
  "size": 0,
  "side": "buy",
  "order_type": "limit_order",
  "stop_order_type": "stop_loss_order",
  "stop_price": "string",
  "stop_trigger_method": "mark_price",
  "time_in_force": "gtc",
  "post_only": "true",
  "reduce_only": "true",
  "client_order_id": "string"
}


A create order object

Properties

Name Type Required Restrictions Description
product_id integer true 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
stop_order_type string false none none
stop_price string false none none
stop_trigger_method string false none none
time_in_force string false none none
post_only string false none none
reduce_only string false none none
client_order_id string 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
stop_order_type take_profit_order
stop_trigger_method mark_price
stop_trigger_method last_traded_price
stop_trigger_method spot_price
time_in_force gtc
time_in_force ioc
time_in_force fok
post_only true
post_only false
reduce_only true
reduce_only false

ArrayOfCreateOrderRequest


[
  {
    "product_id": 0,
    "limit_price": "string",
    "size": 0,
    "side": "buy",
    "order_type": "limit_order",
    "stop_order_type": "stop_loss_order",
    "stop_price": "string",
    "stop_trigger_method": "mark_price",
    "time_in_force": "gtc",
    "post_only": "true",
    "reduce_only": "true",
    "client_order_id": "string"
  }
]

Properties

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

EditOrderRequest


{
  "id": 0,
  "product_id": 0,
  "limit_price": "string",
  "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
size integer false none total size after editing order

ArrayOfEditOrderRequest


[
  {
    "id": 0,
    "product_id": 0,
    "limit_price": "string",
    "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,
  "contract_types": "string",
  "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
contract_types string false none comma separated list of desired contract types
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,
  "product_symbol": "string",
  "commission": "string",
  "realized_pnl": "string",
  "realized_funding": "string"
}


A position object

Properties

Name Type Required Restrictions Description
user_id integer false none none
size integer false none Position size, negative for short and positive for long
entry_price string false none none
margin string false none none
liquidation_price string false none none
bankruptcy_price string false none none
adl_level integer false none none
product_id integer false none none
product_symbol string false none none
commission string false none commissions blocked in the position
realized_pnl string false none Net realized pnl since the position was opened
realized_funding string false none Net realized funding since the position was opened

ArrayOfPositions


[
  {
    "user_id": 0,
    "size": 0,
    "entry_price": "string",
    "margin": "string",
    "liquidation_price": "string",
    "bankruptcy_price": "string",
    "adl_level": 0,
    "product_id": 0,
    "product_symbol": "string",
    "commission": "string",
    "realized_pnl": "string",
    "realized_funding": "string"
  }
]

Properties

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

Fill


{
  "id": 0,
  "size": 0,
  "side": "buy",
  "price": "string",
  "role": "taker",
  "commission": "string",
  "created_at": "string",
  "product_id": 0,
  "product_symbol": "string"
}


A fill object

Properties

Name Type Required Restrictions Description
id integer false none none
size integer false none none
side string false none none
price string false none Price at which the fill happened, BigDecimal sent as string
role string false none none
commission string false none Commission paid on this fill, negative value means commission was earned because of maker role
created_at string false none none
product_id integer false none none
product_symbol string false none none

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,
    "product_symbol": "string"
  }
]

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": [
    {
      "price": "9187.5",
      "size": 205640
    }
  ],
  "sell": [
    {
      "price": "9188.0",
      "size": 113752
    }
  ]
}


L2 orderbook

Properties

Name Type Required Restrictions Description
buy [object] false none none
» price string false none none
» size integer false none none
sell [object] false none none
» price string false none none
» size integer false none none

Trades


{
  "trades": [
    {
      "side": "buy",
      "size": 0,
      "price": "string",
      "timestamp": 0
    }
  ]
}


trades of a symbol

Properties

Name Type Required Restrictions Description
trades [object] false none none
» side string false none none
» size integer false none none
» price string false none none
» timestamp integer false none none

Enumerated Values

Property Value
side buy
side sell

Wallet


{
  "balance": "string",
  "order_margin": "string",
  "position_margin": "string",
  "commission": "string",
  "available_balance": "string",
  "interest_credit": "string",
  "asset_id": 0,
  "asset_symbol": "string"
}

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
interest_credit string false none Interest credit earned till now
asset_id integer false none none
asset_symbol string false none none

ArrayOfWallets


[
  {
    "balance": "string",
    "order_margin": "string",
    "position_margin": "string",
    "commission": "string",
    "available_balance": "string",
    "interest_credit": "string",
    "asset_id": 0,
    "asset_symbol": "string"
  }
]

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,
  "asset_id": 0,
  "asset_symbol": 0,
  "created_at": "string"
}

Properties

Name Type Required Restrictions Description
id integer false none none
amount string false none amount credited/debited in this transaction (+ for credited, - for debited)
balance string false none net wallet balance after this transaction
transaction_type string false none none
meta_data object false none none
product_id integer false none none
asset_id integer false none none
asset_symbol integer false none none
created_at string false none none

Enumerated Values

Property Value
transaction_type pnl
transaction_type deposit
transaction_type withdrawal
transaction_type commission
transaction_type conversion
transaction_type funding
transaction_type withdrawal_cancellation
transaction_type referral_bonus
transaction_type commission_rebate
transaction_type promo_credit
transaction_type trading_credits
transaction_type trading_credits_forfeited
transaction_type trading_credits_paid
transaction_type liquidation_fee
transaction_type interest_credit

ArrayOfTransactions


[
  {
    "id": 0,
    "amount": "string",
    "balance": "string",
    "transaction_type": "pnl",
    "meta_data": {},
    "product_id": 0,
    "asset_id": 0,
    "asset_symbol": 0,
    "created_at": "string"
  }
]

Properties

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

greeks


{
  "delta": "string",
  "gamma": "string",
  "rho": "string",
  "theta": "string",
  "vega": "string"
}

Properties

Name Type Required Restrictions Description
delta string false none none
gamma string false none none
rho string false none none
theta string false none none
vega string false none none

price_band


{
  "lower_limit": "string",
  "upper_limit": "string"
}

Properties

Name Type Required Restrictions Description
lower_limit string false none none
upper_limit string false none none

quotes


{
  "ask_iv": "string",
  "ask_size": "string",
  "best_ask": "string",
  "best_bid": "string",
  "bid_iv": "string",
  "bid_size": "string"
}

Properties

Name Type Required Restrictions Description
ask_iv string false none none
ask_size string false none none
best_ask string false none none
best_bid string false none none
bid_iv string false none none
bid_size string false none none

Ticker


{
  "close": 0,
  "contract_type": "string",
  "greeks": {
    "delta": "string",
    "gamma": "string",
    "rho": "string",
    "theta": "string",
    "vega": "string"
  },
  "high": 0,
  "low": 0,
  "mark_price": "string",
  "mark_vol": "string",
  "oi": "string",
  "oi_value": "string",
  "oi_value_symbol": "string",
  "oi_value_usd": "string",
  "open": 0,
  "price_band": {
    "lower_limit": "string",
    "upper_limit": "string"
  },
  "product_id": 0,
  "quotes": {
    "ask_iv": "string",
    "ask_size": "string",
    "best_ask": "string",
    "best_bid": "string",
    "bid_iv": "string",
    "bid_size": "string"
  },
  "size": 0,
  "spot_price": "string",
  "strike_price": "string",
  "symbol": "string",
  "timestamp": 0,
  "turnover": 0,
  "turnover_symbol": "string",
  "turnover_usd": 0,
  "volume": 0
}

Properties

Name Type Required Restrictions Description
close integer false none none
contract_type string false none none
greeks greeks false none none
high number false none none
low number false none none
mark_price string false none none
mark_vol string false none none
oi string false none none
oi_value string false none none
oi_value_symbol string false none none
oi_value_usd string false none none
open number false none none
price_band price_band false none none
product_id number false none none
quotes quotes false none none
size number false none none
spot_price string false none none
strike_price string false none none
symbol string false none none
timestamp number false none none
turnover number false none none
turnover_symbol string false none none
turnover_usd number false none none
volume integer false none none

ArrayOfTickers


[
  {
    "close": 0,
    "contract_type": "string",
    "greeks": {
      "delta": "string",
      "gamma": "string",
      "rho": "string",
      "theta": "string",
      "vega": "string"
    },
    "high": 0,
    "low": 0,
    "mark_price": "string",
    "mark_vol": "string",
    "oi": "string",
    "oi_value": "string",
    "oi_value_symbol": "string",
    "oi_value_usd": "string",
    "open": 0,
    "price_band": {
      "lower_limit": "string",
      "upper_limit": "string"
    },
    "product_id": 0,
    "quotes": {
      "ask_iv": "string",
      "ask_size": "string",
      "best_ask": "string",
      "best_bid": "string",
      "bid_iv": "string",
      "bid_size": "string"
    },
    "size": 0,
    "spot_price": "string",
    "strike_price": "string",
    "symbol": "string",
    "timestamp": 0,
    "turnover": 0,
    "turnover_symbol": "string",
    "turnover_usd": 0,
    "volume": 0
  }
]

Properties

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

PaginationMeta


{
  "after": "string",
  "before": "string"
}

Properties

Name Type Required Restrictions Description
after string false none none
before string false none none

OHLCData


{
  "time": 0,
  "open": 0,
  "high": 0,
  "low": 0,
  "close": 0,
  "volume": 0
}


A ohlc object

Properties

Name Type Required Restrictions Description
time integer false none none
open number(float) false none none
high number false none none
low number false none none
close number false none none
volume number false none none

ArrayOfOHLCData


[
  {
    "time": 0,
    "open": 0,
    "high": 0,
    "low": 0,
    "close": 0,
    "volume": 0
  }
]

Properties

Name Type Required Restrictions Description
anonymous [OHLCData] false none [A ohlc object]

SparklineData


{
  "MARK:BTCUSD_31Oct": [
    [
      1594214051,
      0.00003826
    ],
    [
      1594214051,
      0.00003826
    ]
  ],
  "SPOT:BTCUSD_31Oct": [
    [
      1594215270,
      0.00003826
    ]
  ]
}

Properties

Name Type Required Restrictions Description
additionalProperties [integer] false none array of timestamp and closing value

Stats


{
  "last_30_days_volume": 0,
  "last_7_days_volume": 0,
  "total_volume": 0
}

Properties

Name Type Required Restrictions Description
last_30_days_volume integer false none sum of turnover usd in the last 30 days
last_7_days_volume integer false none sum of turnover usd in the last 7 days
total_volume integer false none sum of turnover usd in the last 24 hours

Place order errors


This section lists various errors returned by the system while placing order. The error format looks like this 
{
  success: false,
  error: {
    code: ...,        // error code
    context: {
      ...
    }
  }
}

Here is a list of error codes and their explanation
error code description
insufficient_margin Margin required to place order with selected leverage and quantity is insufficient.
order_size_exceed_available Rhe order book doesn't have sufficient liquidity, hence the order couldnt be filled (for ex - ioc orders).
risk_limits_breached orders couldn't be placed as it will breach allowed risk limits.
invalid_contract The contract/product is either doesn\'t exist or has already expired.
immediate_liquidation Order will cause immediate liquidation.
out_of_bankruptcy Order prices are out of position bankruptcy limits.
self_matching_disrupted_post_only Self matching is not allowed during auction.
immediate_execution_post_only orders couldn't be placed as it includes post only orders which will be immediately executed.

Errors


Delta API uses the following error codes:
Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key/Signature is wrong.
404 Not Found -- The specified resource could not be found.
405 Method Not Allowed -- You tried to access a resource with an invalid method.
406 Not Acceptable -- You requested a format that isn't json.
429 Too Many Requests -- You have exhausted your rate limits! Slow down!
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.

Rest Clients


Delta API conforms to the Swagger spec for REST endpoints. Any Swagger-compatible client can connect to the Delta API and execute commands.

You can find the swagger spec json for Delta Api here

We also have Rest Api Clients available for the following languages


Nodejs

Python

CCXT


CCXT is our authorized SDK provider and you may access our API through CCXT. 

For more information, please visit ccxt website.

Websocket Feed


Websocket api can be used for the following use cases


Get real time feed of market data, this includes L2 and L3 orderbook and recent trades.

Get price feeds - Mark prices of different contracts, price feed of underlying indexes etc.

Get account specific notifications like fills, liquidations, ADL and PnL updates.


Access url


Production - wss://socket.delta.exchange

Testnet - wss://testnet-socket.delta.exchange


You will be disconnected, if there is no activity within 60 after making connection.

Subscribing to Channels

Subscribe


To begin receiving feed messages, you must first send a subscribe message to the server indicating which channels and contracts to subscribe for.

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

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 (check sample code) after each successful socket connection

Set a timer with duration of 35 seconds (We take 5 seconds buffer for heartbeat to arrive).

When you receive a new heartbeat message, you reset the timer

If the timer is called, that means the client didn't receive any heartbeat in last 35 seconds. In this case, the client should exit the existing connection and try to reconnect. 

// Enable Heartbeat on successful connection
ws.send({
    "type": "enable_heartbeat"
})

// Disable Heartbeat
ws.send({
    "type": "disable_heartbeat"
})

// Sample Heartbeat message received periodically by client
{
    "type": "heartbeat"
}

Ping/Pong


The client can periodically (~ every 30 seconds) send a ping frame or a raw ping message and the server will respond back with a pong frame or a raw pong response. If the client doesn't receive a pong response in next 5 seconds, the client should exit the existing connection and try to reconnect. 
// Ping Request
ws.send({
    "type": "ping"
})

// Pong Response
ws.send({
    "type": "pong"
})

Public Channels

v2 ticker


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

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


Ticker Sample

// Response
{
    "close": 0.00001327,
    "high": 0.00001359,
    "low": 0.00001323,
    "mark_price": "0.00001325",
    "open": 0.00001347,
    "product_id": 56,
    "size": 1254631,                        // num of contracts traded
    "spot_price": "0.00001326",             
    "symbol": "ADABTC",
    timestamp: 1595242187705121,            // in us
    "turnover": 16.805033569999996,         // turnover reported in settling symbol
    "turnover_symbol": "BTC",               // settling symbol
    "turnover_usd": 154097.09108233,        // turnover in usd
    "volume": 1254631                       // volume is defined as contract_value * size 
}

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

all_trades


all_trades channel provides a real time feed of all trades (fills).
// All Trades Response
{
    symbol: "BNBBTC_30Nov",
    price: "0.0014579",
    size: 100,
    type: "all_trades",
    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,
}

candlesticks


This channel provides last ohlc candle for given time resolution.

Subscribe to candlestick_${resolution} channel for updates. 

List of supported resolutions ["1m","3m","5m","15m","30m","1h","2h","4h","6h","12h","1d","1w","2w","30d"]


OHLC candles update sample

Sample Subscribe Request
{
  "name": "candlestick_1m",                 // "candlestick_" + resolution
  "symbols": [ "BTCUSD", "ETHUSDT" ]        // product symbol
}



Sample feed response

{
    "candle_start_time": 1596015240000000,
    "close": 9223,
    "high": 9228,
    "low": 9220,
    "open": 9221,
    "resolution": "1m",
    "symbol": "BTCUSD_P",
    "timestamp": 1596015289339699,
    "type": "candlestick_1m",
    "volume": 1.2
}

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.

A snapshot of current open position will be sent after subscribing a symbol, incremental updates will be sent on trade executions.
// Position update
{
    "type": "positions",
    "action": "",                       // "create"/"update"/"delete"
    "reason": "",                       // null, "auto_topup"
    "symbol": "BTCUSD_29Mar",           // Product Symbol
    "product_id": 1,                    // Product ID
    "size": -100,                       // Position size, if > 0 -> long else short
    "margin": "0.0121",                 // Margin blocked in the position
    "entry_price": "3500.0",            // Avg Entry price of the position
    "liquidation_price": "3356.0",      // Liquidation trigger price
    "bankruptcy_price": "3300.0",       // Bankruptcy Price
    "commission": "0.00001212"          // Commissions blocked for closing the position
}

//Snapshot 
{
   "result":[
      {
         "adl_level":"4.3335",
         "auto_topup":false,
         "bankruptcy_price":"261.82",
         "commission":"17.6571408",
         "created_at":"2021-04-29T07:25:59Z",
         "entry_price":"238.023457888493475682",
         "liquidation_price":"260.63",
         "margin":"4012.99",
         "product_id":357,
         "product_symbol":"ZECUSDT",
         "realized_funding":"-3.08",
         "realized_pnl":"6364.57",
         "size":-1686,
         "updated_at":"2021-04-29T10:00:05Z",
         "user_id":1,
         "symbol":"ZECUSDT"
      }
   ],
   "success":true,
   "type":"positions",
   "action":"snapshot"
}

Orders


Channel provides updates when any order is updated for any action such as fill, quantity change. Need to pass list of product symbols while subscribing.

A snapshot of all open/pending orders will be sent after subscribing a symbol. And all incremental updates will be sent on create/update/delete of orders

All updates including snapshot will have incremental seq_id. seq_id is separate for each symbol.

Any of the following events can be tracked by the reason field in this channel


fill

stop_update

stop_trigger

stop_cancel

liquidation

self_trade

// Order update

{
    "type": "orders",
    "action": "create",                 // "create"/"update"/"delete"
    "reason": "",                       // "fill"/"stop_update"/"stop_trigger"/"stop_cancel"/"liquidation"/"self_trade"/null
    "symbol": "BTCUSD_29Mar",           // Product Symbol
    "product_id": 1,                    // Product ID
    "order_id": 1234                    // Order id
    "client_order_id": ""               // Client order id
    "size": 100,                        // Order size
    "unfilled_size": 55,                // Unfilled size
    "limit_price": "9000.00"                  // Price of the order
    "side": "buy"                       // Order side (buy or sell)
    "cancellation_reason": "cancelled_by_user"        // Cancellation reason in case of cancelled order, null otherwise
    "stop_order_type": "stop_loss_order",             // If a Stop Order -> "stop_loss_order"/"take_profit_order", null otherwise
    "bracket_order": false              // true for a bracket_order, false otherwise
    "state": "open"                     // "open"/"pending"/"closed"/"cancelled"
    "seq_no": 1                         // Incremental sequence number
    "timestamp": 1594105083998848       // Unix timestamp in microseconds
    "stop_price": "9010.00"                             // stop_price of stop order        
    "trigger_price_max_or_min": "9020.00"               // for trailing stop orders
    "bracket_stop_loss_price": "8090.00"
    "bracket_stop_loss_limit_price": "8090.00"
    "bracket_take_profit_price": "9020"      
    "bracket_take_profit_limit_price": "9020"
    "bracket_trail_amount": "10.00"
}

// Snapshot
{
  "meta": {
    "seq_no": 7,
    "timestamp": 1594149235554045
  },
  "result": [
    {
      "id": 1592130,
      "limit_price": "9000",
      "order_type": "limit_order",
      "product_id": 13,
      "reduce_only": false,
      "side": "buy",
      "size": 1,
      "state": "open",
      "stop_order_type": null,
      "stop_price": null,
      "time_in_force": "gtc",
      "trail_amount": null,
      "unfilled_size": 1,
      "user_id": 1132
    }
  ],
  "success": true,
  "symbol": "BTCUSD",
  "type": "orders",
  "action": "snapshot"
}

UserTrades


Channel provides updates for fills. Need to pass list of product symbols while subscribing.

All updates will have incremental seq_id. seq_id is separate for each symbol.

Auto Deleverage Liquidations of a position can be tracked by reason: "adl" in the user_trades channel.
// user_trades
{
    "symbol": "BNBBTC_30Nov",
    "fill_id": "1234-abcd-qwer-3456",
    "reason": "normal"                      // "normal" or "adl"
    "product_id": 7,
    "type": "user_trades",
    "user_id": 1998,
    "order_id": 3283999,
    "side": "buy",
    "size": 190,
    "price": "0.00145791",
    "role": "taker",
    "client_order_id": "GA123",
    "timestamp": 1544091555086559,
    "seq_no": 1
}

Web Socket RPC


You can make requests over rpc (Remote Procedure Call) using the socket api. Almost all rest endpoints can be invoked as rpc calls to the Web Socket Server.

Remote Procedure Call (RPC) is a protocol that one program can use to request a service from a program located in another computer in a network without having to understand network details. RPC uses the client/server model. The requesting program is a client and the service-providing program is the server.

The client sends request message to the server and then waits for the response. Socket connection needs to be authenticated to make RPC requests.

Request Message


The request message must be JSON object with the following fields.
Name Type Description
type string Type of request message.
payload object The payload object contains method, params and id.
method string The method to be invoked.
params object The parameters for the method that needs to be invoked.
id string An identifier of the request. If it is included, then the response will contain the same identifier

// Socket RPC request message sample
{
    "type": "rpc",
    "payload" : {
        "method": "post/orders",
        "params" : {
            "order_type":"limit_order",
            "size":1,
            "side":"buy",
            "limit_price":"4200",
            "product_id":16,
            "post_only":"false",
            "reduce_only":"false",
            "time_in_force":"gtc"
        },
        "id": "1234"
    } 
}

Response Message


The response message will be similar to the REST API.

Changelog

V2 Rest Api


Our v2 Api is significantly faster than the v1 api. Our focus while rebuilding v2 Apis was on the following


(一)Remove Api gateway overheads as much as possible.

(二)Remove overheads due to deep nesting in response payload.

(三)Better Api structure to query only required data.



New Response Format

// The new format supports sending meta data alongside response body. 
// Success format
{
  success: true,
  result: ....,         // response body
  meta: {
    after: "...",       // cursor for pagination, is returned in meta
    before: null,
  },
}

// Error Format
{
  success: false,
  error: {
    code: :insufficient_margin,             // error code
    context: {                              // error context
      additional_margin_required: "0.121"
    }
  }
}

Key Api changes



We have completely removed nested product/asset payloads from live orders and live positions. This ensures the payload is light.

Rate limiting now works on a fixed window instead of a rolling window.

Ticker Api - now includes turnover in USD, mark price, spot price.

Orderbook and trades are now returned in separate Apis.

For supporting trading strategies which require latest positions, Now we have two different Apis to query position. 


/v2/positions - returns only size and entry price. This should be used when you want to get the latest position, but dont need the margin dependent fields like liquidation price, bankruptcy price etc

/v2/positions/margined - returns all fields including margin dependent fields. When the position is updated due to a fill, changes might take some time to reflect in this Api.


All Apis that support pagination now use cursor based pagination, instead of fixed page size pagination. Check more details in our python rest client docs

New Socket Channels



Socket Api interface hasn't changed much in terms of connection management and authentication. 

We have deprecated old channels and created new channels which make integration easier. 

To support easy management of live data, all private data channels now support initial snapshots and sequence numbers.

List of new public channels



v2/ticker - now includes turnover in USD, mark price, spot price

candlesticks - subscribe to ohlc candle updates for different resolutions

all_trades - subscribe to all public trades for a symbol

List of new private channels



orders - subscribe to lifecycle of live orders

user_trades - subscribe to live user trades/fills feed

positions - subscribe to position updates

margins - get margin/wallet updates

Security


We take the security, integrity, availability of our services, and the privacy of our users seriously. We appreciate all security concerns brought forth and are constantly striving to keep on top of the latest threats. Being proactive rather than reactive to emerging security issues is a fundamental belief at Delta Exchange. Every day new security issues and attack vectors are created. Delta Exchange strives to keep abreast of the latest state-of-the-art security developments by working with independent security researchers. We appreciate the community's efforts in creating a more secure world.

Targets In scope



https://*.delta.exchange


Any domain/property of Delta Exchange Network not listed in the targets section is out of scope. This includes any/all subdomains not listed above.

How to access



You will access the Delta Exchange service using test accounts and unauthenticated guests.

Please create a Delta Exchange test account on your own using your test email address. Your email must contain keyword 'test' for example test@gmail.com. 

All emails will go to the email address associated with your account. You will need to activate your account by confirming receipt of the activation email.

NOTE: Once a vulnerability is found please file a submission immediately. Our security team will investigate and assess the impact.

Reward range


Focus Areas


User Data / User information Leaks

Injection attacks (Server/Client side)

RCE(Remote Code Execution)

Authentication bypass/validation (Client/Server side)

Privilege escalation (Vertical/Horizontal)

Technical Severity Reward
P1 Critical Decided by internal team, can be from ($10-$1000)
P2 Severe Decided by internal team, can be from ($10-$1000)
P3 Moderate $10 - $100

Rules of engagement


We are interested in hearing about security issues in Production/Dev Delta Exchange environments. There are some things we explicitly ask you not to do


Do not run automated scans without checking with us first. They are often very noisy.(If running any automated testing tools, be sure to keep well under 75-100 requests per second - otherwise you're likely to get locked out.)

Do not test the physical security of Delta Exchange offices, employees, equipment, etc.

Do not run Full fledged exploits which can cause application crashes and affect integrity of our active services. (If you believe you have a exploit that need serious fixes please email us, and we will provide you with said instance for said service.)

Do not test using social engineering techniques (phishing, vishing, etc.)

Do not test against any type of customer account without explicit permission from our side.

Do not access, Destroy or otherwise negatively impact any residential or business customers, or customer data in any way. 

Do not perform DoS or DDoS attacks (Application level, Network Level DOS / DDOS / port flooding attacks are strictly not appreciated as this can cause delay in delivery of our services to our users we suggest you to not to use such methodologies).

Do not engage In any way attack our end users, or in the trade of stolen user credentials.

Interacting with real customers or real customer accounts is forbidden.

Rules of reporting


We take our Internal process and workflow seriously, We have a dedicated security team working and testing round the clock, so we would like you to send your reports to only [email protected] and follow below said rules or not following will void you from our bug bounty benefits, Also we would like you to encrypt emails sent to us with a PGP key provided below if the Vulnerability is Severe or Critical.


We recommend you to use emails which contain test as a keyword in the email address for example test@gmail.com.

For testing and reporting so that we can identify your activity on our environments, also whitelist for IDS/FDS blocks)

Do not CC or tag other staff while reporting.

Do not callout on social media or make blog posts to report or without reporting (this can lead to legal actions to be taken against you.)

Do not discuss this with any, but only Delta Exchange technical staff.

Do not send us external-links/executable/scripts in report if possible attach a text file or pdf. Without zipp'ing or rar'ing it.

Screenshots are accepted if only in PNG and JIF formats for internal security reasons.

POC Videos are accepted if only in MP4,AVI, WEBM, MOV formats for internal security reasons.

Any or All reports must only reach [email protected]


Summary

Help us get an idea of what this vulnerability is about.

(eg. "hey i have found a xss on your server")

Target

Select the vulnerable target Domain name / Subdomain name

(eg. "so and so on https://example.delta.exchange")

Vulnerability details

What is the Bug/Vulnerability. And URL / Location of vulnerability .

(eg. because of unfiltered characters the url [/search.php?q=] path /search.php on q parameter)

Description of Technical severity

Help us understand the bug/vulnerability technical details Describe the vulnerability and its impact.

(eg. client side executes the javascript which is rendering through /search.php?q=somescript)

Recreation

Provide a proof of concept or replication steps.

(eg. steps to be used by our team in order to recreate the attack scenario)

Additional information

Provide us with Request and Response dump / trace dump / HTTP request 

Attachments (recommended)

Attach proof-of-concept scripts, screenshots, screen recordings, etc.

Ineligible issues


These issues Will be closed as out of scope hence not rewardable.


Theoretical vulnerabilities without actual proof of concept

Open redirects (through headers and parameters) / Lack of security speed bump when leaving the site.

Internal IP address / version disclosure.

Email verification deficiencies, expiration of password reset links, and password complexity policies

Invalid or missing SPF (Sender Policy Framework) records (incomplete or missing SPF/DKIM/DMARC)

Click jacking/UI redressing with minimal security impact

Text/code injection without any impact.

Email or mobile enumeration (E.g. the ability to identify emails via password reset)

Information disclosure with minimal security impact (E.g. stack traces, path disclosure, directory listings, logs)

Internally known issues, duplicate issues, or issues which have already been made public

Rate limiting issues / Tab-nabbing

Non url Selfless / HTMLi 

Known CVE without proper testing.

Vulnerabilities only exploitable on out-of-date browsers or platforms

CSRF issues that don't impact the integrity of an account (e.g. log in or out, contact forms and other publicly accessible forms)

Vulnerabilities related to auto-fill web forms

Use of known vulnerable libraries without actual proof of concept

Lack of security flags in cookies

Issues related to unsafe SSL/TLS cipher suites or protocol version

Session expiry / Cookie issues / Content spoofing

Cache-control related issues

Missing security headers that do not lead to direct exploitation

CSRF with negligible security impact (E.g. adding to favorites, adding to cart, subscribing to a non-critical feature)

Vulnerabilities that require root/jailbreak

Vulnerabilities that require physical access to a user's device

Issues that have no security impact (E.g. Failure to load a web page)

Phishing (E.g. HTTP Basic Authentication Phishing)

Any activity (like DoS/DDoS) that disrupts our services

Installation Path Permissions

Reports from automated tools or scans


Not following any one of the above rule will disqualify you from our bug bounty program.

If any doubts related to your submissions or creative dialogue please feel free to email [email protected]or[email protected]



Python cURL Ruby