NAV Navbar
API Documentation
python javascript csharp
English 中文

Overview

Welcome to the FTX API documentation. We offer complete REST, Websocket, and FIX APIs to suit your algorithmic trading needs. You can find sample code for each connectivity option at https://github.com/ftexchange/ftx.

REST API

HTTP-based API with full trading and asset management functionality, with public orderbook and trades data as well as private account data and order management.

REST endpoint URL: https://ftx.com/api

Requests and responses use JSON.

We also have sample code for Python, C# and C++.

Authentication

import time
import hmac
from requests import Request

ts = int(time.time() * 1000)
request = Request('GET', '<api_endpoint>')
prepared = request.prepare()
signature_payload = f'{ts}{prepared.method}{prepared.path_url}'.encode()
signature = hmac.new('YOUR_API_SECRET'.encode(), signature_payload, 'sha256').hexdigest()

request.headers[f'FTX-KEY'] = 'YOUR_API_KEY'
request.headers[f'FTX-SIGN'] = signature
request.headers[f'FTX-TS'] = str(ts)

# Only include line if you want to access a subaccount
# request.headers[f'FTX-SUBACCOUNT'] = 'my_subaccount_nickname'
var method = HttpMethod.Get
var endpoint = $"/api/account";
var request = new HttpRequestMessage(method, endpoint);
var _nonce = (DateTime.UtcNow - start).TotalMilliseconds;

var hashMaker = new HMACSHA256(Encoding.UTF8.GetBytes(""YOUR_API_SECRET""));
var signaturePayload = $"{_nonce}{method.ToString().ToUpper()}{endpoint}";
var hash = hashMaker.ComputeHash(Encoding.UTF8.GetBytes(signaturePayload));
var hashString = BitConverter.ToString(hash).Replace("-", string.Empty);
var signature = hashString.ToLower();

request.Headers.Add("FTX-KEY", "YOUR_API_KEY");
request.Headers.Add("FTX-SIGN", signature);
request.Headers.Add("FTX-TS", _nonce.ToString());

For authenticated requests, the following headers should be sent with the request:

Rate limits

Please do not send more than 10 requests per second. Sending requests more frequently will result in HTTP 429 errors.

Subaccounts

To specify a subaccount, send its name in the header FTX-SUBACCOUNT with the request.

Markets

Get markets

Request

GET /markets

Response


{
  "success": true,
  "result": [
    {
      "name": "BTC-0628",
      "baseCurrency": null,
      "quoteCurrency": null,
      "type": "future",
      "underlying": "BTC",
      "enabled": true,
      "ask": 3949.25,
      "bid": 3949,
      "last": 10579.52,
      "priceIncrement": 0.25,
      "sizeIncrement": 0.001
    }
  ]
}

Response format

Name Type Value Description
type string future "future" or "spot"
name string BTC-0628
underlying string BTC future markets only
baseCurrency string BTC spot markets only
quoteCurrency string USD spot markets only
enabled boolean true
ask number 3949.25 best ask
bid number 3949.00 best bid
last number 3949.00 last traded price
priceIncrement number 0.25
sizeIncrement number 0.001

Get single market

Request

GET /markets/{market_name}

Response

See /markets

Get orderbook

Request

GET /markets/{market_name}/orderbook?depth={depth}

Response

{
  "success": true,
  "result": {
    "asks": [
      [
        4114.25,
        6.263
      ]
    ],
    "bids": [
      [
        4112.25,
        49.29
      ]
    ]
  }
}

Parameters

Name Type Value Description
market_name string BTC-0628 Required. Name of the market.
depth number 35 max 100, default 20

Response format

Name Type Value Description
asks array [4114.25, 6.263] Array with price and size
bids array [4112, 49.29] Array with price and size

Get trades

Request

GET /markets/{market_name}/trades?limit={limit}&start_time={start_time}&end_time={end_time}

Response

{
  "success": true,
  "result": [
    {
      "id": 3855995,
      "liquidation": false,
      "price": 3857.75,
      "side": "buy",
      "size": 0.111,
      "time": "2019-03-20T18:16:23.397991+00:00"
    }
  ]
}

Parameters

Name Type Value Description
market_name string BTC-0628 name of the market
limit number 35 optional, max 100, default 20
start_time number 1559881511 optional
end_time number 1559881711 optional

Response format

Name Type Value Description
id number 3855995 trade id
liquidation boolean false if this trade involved a liquidation order
price number 3857.75
side string buy
size number 0.111
time string 2019-03-20T18:16:23.397991+00:00

Get historical prices

Request

GET /markets/{market_name}/candles?resolution={resolution}&limit={limit}&start_time={start_time}&end_time={end_time}

Response

{
  "success": true,
  "result": [
    {
      "close":11055.25,
      "high":11089.0,
      "low":11043.5,
      "open":11059.25,
      "startTime":"2019-06-24T17:15:00+00:00",
      "volume":464193.95725
    }
  ]
}

Parameters

Name Type Value Description
market_name string BTC-0628 name of the market
resolution number 300 window length in seconds. options: 15, 60, 300, 900, 3600, 14400, 86400
limit number 35 optional
start_time number 1559881511 optional
end_time number 1559881711 optional

Response format

Name Type Value Description
startTime string 2019-06-24T17:15:00+00:00 start time of the window
open number 11059.25 mark price at startTime
close number 11055.25 mark price at the end of the window: startTime + resolution
high number 11089.0 highest mark price over the window
low number 11059.25 lowest mark price over the window
volume number 464193.95725 volume traded in the window

Futures

This section covers all types of futures on FTX: perpetual, expiring, and MOVE. Examples for each type are BTC-PERP, BTC1227, and BTC-MOVE-1005.

List all futures

Request

GET /futures

Response

{
  "success": true,
  "result": [
    {
      "ask": 4196,
      "bid": 4114.25,
      "change1h": 0,
      "change24h": 0,
      "description": "Bitcoin March 2019 Futures",
      "enabled": true,
      "expired": false,
      "expiry": "2019-03-29T03:00:00+00:00",
      "index": 3919.58841011,
      "last": 4196,
      "lowerBound": 3663.75,
      "mark": 3854.75,
      "name": "BTC-0329",
      "perpetual": false,
      "postOnly": false,
      "priceIncrement": 0.25,
      "sizeIncrement": 0.001,
      "underlying": "BTC",
      "upperBound": 4112.2,
      "type": "future"
    }
  ]
}

Response format

Name Type Value Description
ask number 4196.0 best ask on the orderbook
bid number 4114.25 best bid on the orderbook
change1h number 0.0 price change in the last hour
change24h number 0.0 price change in the last 24 hours
description string Bitcoin March 2019 Futures
enabled boolean true
expired boolean false
expiry string 2019-03-29T03:00:00+00:00
index number 3919.58841011 average of the Market Prices for the constituent markets in the index
last number 4196.0 last price the future traded at
lowerBound number 3663.75 the lowest price the future can trade at
mark number 3854.75 mark price of the future
name string BTC-0329
perpetual boolean false whether or not this is a perpetual contract
postOnly boolean false
priceIncrement number 0.25
sizeIncrement number 0.001
underlying string BTC
upperBound number 4112.2 the highest price the future can trade at
type string future One of future, perpetual, or move

Get future

Request

GET /futures/{future_name}

Response

{
  "success": true,
  "result": {
    "ask": 4196,
    "bid": 4114.25,
    "change1h": 0,
    "change24h": 0,
    "description": "Bitcoin March 2019 Futures",
    "enabled": true,
    "expired": false,
    "expiry": "2019-03-29T03:00:00+00:00",
    "index": 3919.58841011,
    "last": 4196,
    "lowerBound": 3663.75,
    "mark": 3854.75,
    "name": "BTC-0329",
    "perpetual": false,
    "postOnly": false,
    "priceIncrement": 0.25,
    "sizeIncrement": 0.001,
    "underlying": "BTC",
    "upperBound": 4112.2,
    "type": "future"
  }
}

Response format

Name Type Value Description
ask number 4196.0 best ask on the orderbook
bid number 4114.25 best bid on the orderbook
change1h number 0.0 price change in the last hour
change24h number 0.0 price change in the last 24 hours
description string Bitcoin March 2019 Futures
enabled boolean true
expired boolean false
expiry string 2019-03-29T03:00:00+00:00
index number 3919.58841011 average of the Market Prices for the constituent markets in the index
last number 4196.0 last price the future traded at
lowerBound number 3663.75 the lowest price the future can trade at
mark number 3854.75 mark price of the future
name string BTC-0329
perpetual boolean false whether or not this is a perpetual contract
postOnly boolean false
priceIncrement number 0.25
sizeIncrement number 0.001
underlying string BTC
upperBound number 4112.2 the highest price the future can trade at
type string future One of future, perpetual, or move

Get future stats

Request

GET /futures/{future_name}/stats

Response

{
  "success": true,
  "result": {
    "volume": 1000.23,
    "nextFundingRate": 0.00025,
    "nextFundingTime": "2019-03-29T03:00:00+00:00",
    "expirationPrice": 3992.1,
    "predictedExpirationPrice": 3993.6,
    "strikePrice": 8182.35,
    "openInterest": 21124.583
  }
}

Response format

Name Type Value Description
volume number 1000.23 quantity traded in the last 24 hours
nextFundingRate number 0.00025 upcoming funding rate (only applicable for perpetual contracts)
nextFundingTime string 2019-03-29T03:00:00+00:00 upcoming funding time (only applicable for perpetual contracts)
expirationPrice number 3992.1 price to which the future expired (only applicable if the future has expired)
predictedExpirationPrice number 3993.0 only applicable if the future has not expired
openInterest number 21124.583 number of open contracts in this future
strikePrice number 8182.35009484 price of the underlying at the beginning of the expiration day (only applicable for MOVE contracts)

Get funding rates

Request

GET /funding_rates

Parameters

Name Type Value Description
start_time number 1559881511 optional
end_time number 1559881711 optional

Response


{
  "success": true,
  "result": [
    {
      "future": "BTC-PERP",
      "rate": 0.0025,
      "time": "2019-06-02T08:00:00+00:00"
    }
  ]
}

Response format

Name Type Value Description
future string BTC-PERP
rate number 0.0025
time string 2019-06-02T08:00:00+00:00

Account

Get account information

Request

GET /account

Response

{
  "success": true,
  "result": {
    "backstopProvider": true,
    "collateral": 3568181.02691129,
    "freeCollateral": 1786071.456884368,
    "initialMarginRequirement": 0.12222384240257728,
    "liquidating": false,
    "maintenanceMarginRequirement": 0.07177992558058484,
    "makerFee": 0.0002,
    "marginFraction": 0.5588433331419503,
    "openMarginFraction": 0.2447194090423075,
    "takerFee": 0.0005,
    "totalAccountValue": 3568180.98341129,
    "totalPositionSize": 6384939.6992,
    "username": "[email protected]",
    "positions": [
      {
        "cost": -31.7906,
        "entryPrice": 138.22,
        "future": "ETH-PERP",
        "initialMarginRequirement": 0.1,
        "longOrderSize": 1744.55,
        "maintenanceMarginRequirement": 0.04,
        "netSize": -0.23,
        "openSize": 1744.32,
        "realizedPnl": 3.39441714,
        "shortOrderSize": 1732.09,
        "side": "sell",
        "size": 0.23,
        "unrealizedPnl": 0
      }
    ]
  }
}

Requires authentication.

Response format

Name Type Value Description
backstopProvider boolean true whether or not the account is a registered backstop liquidity provider
collateral number 3568181.02691129 amount of collateral
freeCollateral number 1786071.456884368 amount of free collateral
initialMarginRequirement number 0.12222384240257728 average of initialMarginRequirement for individual futures, weighed by position notional. Cannot open new positions if openMarginFraction falls below this value.
liquidating boolean false True if the account is currently being liquidated
maintenanceMarginRequirement number 0.07177992558058484 Average of maintenanceMarginRequirement for individual futures, weighed by position notional. Account enters liquidation mode if margin fraction falls below this value.
makerFee number 0.0002 -
marginFraction number 0.5588433331419503 - ratio between total account value and total account position notional.
openMarginFraction number 0.2447194090423075 Ratio between total realized account value and total open position notional
takerFee number 0.0005
totalAccountValue number 3568180.98341129 total value of the account, using mark price for positions
totalPositionSize number 6384939.6992 total size of positions held by the account, using mark price
username string [email protected]
positions array See Get positions for details

Get positions

Request

GET /positions

Response

{
  "success": true,
  "result": [
    {
      "cost": -31.7906,
      "entryPrice": 138.22,
      "future": "ETH-PERP",
      "initialMarginRequirement": 0.1,
      "longOrderSize": 1744.55,
      "maintenanceMarginRequirement": 0.04,
      "netSize": -0.23,
      "openSize": 1744.32,
      "realizedPnl": 3.39441714,
      "shortOrderSize": 1732.09,
      "side": "sell",
      "size": 0.23,
      "unrealizedPnl": 0
    }
  ]
}

Requires authentication.

Parameters

Name Type Value Description
showAvgPrice boolean false optional

Response format

Name Type Value Description
cost number -31.7906 Amount that was paid to enter this position, equal to size * entry_price. Positive if long, negative if short.
entryPrice number 138.22 Average cost of this position after pnl was last realized: whenever unrealized pnl gets realized, this field gets set to mark price, unrealizedPnL is set to 0, and realizedPnl changes by the previous value for unrealizedPnl.
future string ETH-PERP future name
initialMarginRequirement number 0.1 Minimum margin fraction for opening new positions
longOrderSize number 1744.55 Cumulative size of all open bids
maintenanceMarginRequirement number 0.04 Minimum margin fraction to avoid liquidations
netSize number -0.23 Size of position. Positive if long, negative if short.
openSize number 1744.32 Maximum possible absolute position size if some subset of open orders are filled
realizedPnl number 3.39441714
shortOrderSize number 1732.09 Cumulative size of all open offers
side string sell sell if short, buy if long
size number 0.23 Absolute value of netSize
unrealizedPnl number 0.0

Change account leverage

Request

POST /account/leverage
{
  "leverage": 10,
}

Requires authentication.

Payload format

Name Type Value Description
leverage number 10 desired acccount-wide leverage setting

Wallet

Get coins

Request

GET /wallet/coins

Response


{
  "success": true,
  "result": [
    {
      "canDeposit": true,
      "canWithdraw": true,
      "hasTag": false,
      "id": "USDTBEAR",
      "name": "3X Short Tether Token"
    }
  ]
}

Requires authentication.

Response format

Name Type Value Description
canDeposit boolean true
canWithdraw boolean true
hasTag boolean false True if addresses for this coin have a tag
id string USDTBEAR
name string 3X Short Tether Token

Get balances

Request

GET /wallet/balances

Response


{
  "success": true,
  "result": [
    {
      "coin": "USDTBEAR",
      "free": 2320.2,
      "total": 2340.2
    }
  ]
}

Requires authentication.

Response format

Name Type Value Description
coin string USDTBEAR coin id
free number 2320.2 free amount
total number 2340.2 total amount

Get deposit address

Request

GET /wallet/deposit_address/{coin}

Response

{
  "success": true,
  "result": {
    "address": "0x83a127952d266A6eA306c40Ac62A4a70668FE3BE",
    "tag": "null"
  }
}

Requires authentication.

Response format

Name Type Value Description
address string 0x83a127952d266A6eA306c40Ac62A4a70668FE3BE
tag string null optional

Get deposit history

Request

GET /wallet/deposits

Response

{
  "success": true,
  "result": {
    "coin": "TUSD",
    "confirmations": 64,
    "confirmedTime": "2019-03-05T09:56:55.728933+00:00",
    "fee": 0,
    "id": 1,
    "sentTime": "2019-03-05T09:56:55.735929+00:00",
    "size": "99.0",
    "status": "confirmed",
    "time": "2019-03-05T09:56:55.728933+00:00",
    "txid": "0x8078356ae4b06a036d64747546c274af19581f1c78c510b60505798a7ffcaf1"
  }
}

Requires authentication.

Response format

Name Type Value Description
coin string TUSD coin id
confirmations number 64 number of blockchain confirmations
confirmedTime string 2019-03-05T09:56:55.728933+00:00
fee number 0.0 fee, not included in size
id number 1 deposit id
sentTime string 2019-03-05T09:56:55.735929+00:00
size string 99.0
status string confirmed one of "confirmed", "unconfirmed", or "cancelled"
time string 2019-03-05T09:56:55.728933+00:00
txid string 0x8078356ae4b06a036d64747546c274af19581f1c78c510b60505798a7ffcaf1

Get withdrawal history

Request

GET /wallet/withdrawals

Response

{
  "success": true,
  "result": {
    "coin": "TUSD",
    "address": "0x83a127952d266A6eA306c40Ac62A4a70668FE3BE",
    "tag": "null",
    "fee": 0,
    "id": 1,
    "size": "99.0",
    "status": "complete",
    "time": "2019-03-05T09:56:55.728933+00:00",
    "txid": "0x8078356ae4b06a036d64747546c274af19581f1c78c510b60505798a7ffcaf1"
  }
}

Requires authentication.

Response format

Name Type Value Description
coin string TUSD coin id
address string 0x83a127952d266A6eA306c40Ac62A4a70668FE3BE deposit address the withdrawal was setnt to
tag string null
fee number 0.0 fee, not included in size
id number 1 withdrawal id
size string 99.0
status string complete one of "requested", "processing", "complete", or "cancelled"
time string 2019-03-05T09:56:55.728933+00:00
txid string 0x8078356ae4b06a036d64747546c274af19581f1c78c510b60505798a7ffcaf1

Request withdrawal

Request

POST /wallet/withdrawals
{
  "coin": "USDTBEAR",
  "size": 20.2,
  "address": "0x83a127952d266A6eA306c40Ac62A4a70668FE3BE",
  "tag": null,
  "password": "my_withdrawal_password",
  "code": "152823
}

Response

{
  "success": true,
  "result": {
    "coin": "USDTBEAR",
    "address": "0x83a127952d266A6eA306c40Ac62A4a70668FE3BE",
    "tag": "null",
    "fee": 0,
    "id": 1,
    "size": "20.2",
    "status": "requested",
    "time": "2019-03-05T09:56:55.728933+00:00",
    "txid": "null"
  }
}

Requires authentication.

Payload format

Name Type Value Description
coin string USDTBEAR coin to withdraw
size number 20.2 amount to withdraw
address string 0x83a127952d266A6eA306c40Ac62A4a70668FE3BE address to send to
tag string null optional
password string null optional; withdrawal password if it is required for your account
code string null optiona; 2fa code if it is required for your account

Response format

Name Type Value Description
coin string USDTBEAR coin id
address string 0x83a127952d266A6eA306c40Ac62A4a70668FE3BE deposit address the withdrawal was setnt to
tag string null
fee number 0.0 fee, not included in size
id number 1 withdrawal id
size string 20.2
status string requested one of "requested", "processing", "complete", or "cancelled"
time string 2019-03-05T09:56:55.728933+00:00
txid string null

Orders

Get open orders

Request

GET /orders?market={market}

Response

{
  "success": true,
  "result": [
    {
      "createdAt": "2019-03-05T09:56:55.728933+00:00",
      "filledSize": 10,
      "future": "XRP-PERP",
      "id": 9596912,
      "market": "XRP-PERP",
      "price": 0.306525,
      "avgFillPrice": 0.306526,
      "remainingSize": 31421,
      "side": "sell",
      "size": 31431,
      "status": "open",
      "type": "limit",
      "reduceOnly": false,
      "ioc": false,
      "postOnly": false,
      "clientId": null
    }
  ]
}

Requires authentication.

Request parameters

Name Type Value Description
market string BTC-0329 optional; market to limit orders

Response format

Name Type Value Description
id number 9596912
market string XRP-PERP
type string limit
side string sell
price number 0.306525
size number 31431.0
filledSize number 10.0
remainingSize number 31421.0
avgFillPrice number 0.306526
status string new (accepted but not processed yet), open, or closed (filled or cancelled)
createdAt string 2019-03-05T09:56:55.728933+00:00
reduceOnly boolean false
ioc boolean false
postOnly boolean false
clientId string optional; client order id

Get order history

Request

GET /orders/history?market={market}

Response

{
  "success": true,
  "result": [
    {
      "avgFillPrice": 10135.25,
      "clientId": null,
      "createdAt": "2019-06-27T15:24:03.101197+00:00",
      "filledSize": 0.001,
      "future": "BTC-PERP",
      "id": 257132591,
      "ioc": false,
      "market": "BTC-PERP",
      "postOnly": false,
      "price": 10135.25,
      "reduceOnly": false,
      "remainingSize": 0.0,
      "side": "buy",
      "size": 0.001,
      "status": "closed",
      "type": "limit"
    }
  "hasMoreData": false,
  ]
}

Requires authentication.

Request parameters

Name Type Value Description
market string BTC-0329 optional; market to limit orders
start_time number 1559881511 optional; only fetch orders created after this time
end_time number 1559901511 optional; only fetch orders created before this time
limit number 100 optional; default 100, maximum 100

Response format

Name Type Value Description
id number 257132591
market string BTC-PERP
type string limit
side string buy
price number 10135.25
size number 0.001
filledSize number 0.001
remainingSize number 0.0
avgFillPrice number 10135.25
status string new (accepted but not processed yet), open, or closed (filled or cancelled)
createdAt string 2019-06-27T15:24:03.101197+00:00
reduceOnly boolean false
ioc boolean false
postOnly boolean false
clientId string optional; client order id

Get open trigger orders

Request

GET /conditional_orders?market={market}

Response

{
  "success": true,
  "result": [
    {
      "createdAt": "2019-03-05T09:56:55.728933+00:00",
      "error": null,
      "future": "XRP-PERP",
      "id": 50001,
      "market": "XRP-PERP",
      "orderId": null,
      "orderPrice": null,
      "reduceOnly": false,
      "side": "buy",
      "size": 0.003,
      "status": "open",
      "trailStart": null,
      "trailValue": null,
      "triggerPrice": 0.49,
      "triggeredAt": null,
      "type": "stop"
  ]
}

Requires authentication.

Request parameters

Name Type Value Description
market string XRP-PERP optional; market to limit orders
type string stop optional; type of trigger order (stop, trailing_stop, or take_profit)

Response format

Name Type Value Description
createdAt string 2019-03-05T09:56:55.728933+00:00
error string null Always null for this endpoint
future string XRP-PERP
id number 50001
market string XRP-PERP
orderId number null Always null for this endpoint
orderPrice number 0.50 Limit price for stop limit and take profit limit orders; otherwise null
reduceOnly boolean false
side string buy
size number 31431.0
status string open Always open for this endpoint
trailStart number null trigger price - trail value; only for trailing stop orders
trailValue number null only for trailing stop orders
triggerPrice number 0.49 market price at which this order will trigger
type string stop Values are stop, trailing_stop, and take_profit

Get trigger order history

Request

GET /conditional_orders/history?market={market}

Response

{
  "success": true,
  "result": [
    {
      "createdAt": "2019-03-05T09:56:55.728933+00:00",
      "error": null,
      "future": "XRP-PERP",
      "id": 50000,
      "market": "XRP-PERP",
      "orderId": 2800000,
      "orderPrice": null,
      "reduceOnly": false,
      "side": "buy",
      "size": 31431,
      "status": "triggered",
      "trailStart": null,
      "trailValue": null,
      "triggerPrice": 0.37,
      "triggeredAt": 2019-03-06T03:26:53.268723+00:00,
      "type": "stop",
      "orderType": "market",
      "filledSize": 31431,
      "avgFillPrice": 0.3701,
      "orderStatus": "closed"
    },
  "hasMoreData": false
  ""
  ]
}

Requires authentication.

Request parameters

Name Type Value Description
market string BTC-0329 optional; market to limit orders
start_time number 1559881511 optional; only fetch orders created after this time
end_time number 1559881511 optional; only fetch orders created before this time
side string buy optional; valid values are buy and sell.
type string trailing_stop optional; valid values are stop, trailing_stop, and take_profit.
orderType string limit optional; valid values are market and limit.
limit number 100 optional; default 100, maximum 100

Response format

Name Type Value Description
createdAt string 2019-03-05T09:56:55.728933+00:00
error string null error that occurred on triggering; otherwise null
future string XRP-PERP
id number 50001
market string XRP-PERP
orderId number null order ID if this order has triggered; otherwise null
orderPrice number 0.50 Limit price for stop limit and take profit limit orders; otherwise null
reduceOnly boolean false
side string buy
size number 31431.0
status string open Values are open, cancelled, and triggered
trailStart number null trigger price - trail value; only for trailing stop orders
trailValue number null only for trailing stop orders
triggerPrice number 0.49 market price at which this order will trigger
type string stop Values are stop, trailing_stop, and take_profit
orderType string market Values are market and limit
filledSize number 31431
avgFillPrice number 0.3701
orderStatus string closed Values are new, openandclosed`

Place order

Request

POST /orders
{
  "market": "XRP-PERP",
  "side": "sell",
  "price": 0.306525,
  "type": "limit",
  "size": 31431.0,
  "reduceOnly": false,
  "ioc": false,
  "postOnly": false,
  "clientId": null,
}

Response

{
  "success": true,
  "result": {
    "createdAt": "2019-03-05T09:56:55.728933+00:00",
    "filledSize": 0,
    "future": "XRP-PERP",
    "id": 9596912,
    "market": "XRP-PERP",
    "price": 0.306525,
    "remainingSize": 31431,
    "side": "sell",
    "size": 31431,
    "status": "open",
    "type": "limit",
    "reduceOnly": false,
    "ioc": false,
    "postOnly": false,
    "clientId": null,
  }
}

Requires authentication.

Payload format

Name Type Value Description
market string XRP-PERP
side string sell "buy" or "sell"
price number 0.306525 Send null for market orders.
type string limit "limit" or "market"
size number 31431.0
reduceOnly boolean false optional; default is false
ioc boolean false optional; default is false
postOnly boolean false optional; default is false
clientId string null optional; client order id

Response format

Name Type Value Description
createdAt string 2019-03-05T09:56:55.728933+00:00
filledSize number 0.0
future string XRP-PERP
id number 9596912
market string XRP-PERP
price number 0.306525
remainingSize number 31431.0
side string sell
size number 31431.0
status string new (accepted but not processed yet), open, or closed (filled or cancelled)
type string limit
reduceOnly boolean false
ioc boolean false
postOnly boolean false
clientId string optional; client order id, if supplied

Place trigger order

Trigger orders include stop, trailing stop, and take profit.

Request

POST /conditional_orders
  • Stop
{
  "market": "XRP-PERP",
  "side": "sell",
  "triggerPrice": 0.306525,
  "size": 31431.0,
  "type": "stop",
  "reduceOnly": false
}
  • Trailing stop
{
  "market": "XRP-PERP",
  "side": "sell",
  "trailValue": -0.05,
  "size": 31431.0,
  "type": "trailingStop",
  "reduceOnly": false
}
  • Take profit
{
  "market": "XRP-PERP",
  "side": "buy",
  "triggerPrice": 0.367895,
  "size": 31431.0,
  "type": "takeProfit",
  "reduceOnly": false
}

Response

{
  "success": true,
  "result": {
    "createdAt": "2019-03-05T09:56:55.728933+00:00",
    "future": "XRP-PERP",
    "id": 9596912,
    "market": "XRP-PERP",
    "triggerPrice": 0.306525,
    "orderId": null,
    "side": "sell",
    "size": 31431,
    "status": "open",
    "type": "stop",
    "orderPrice": null,
    "error": null,
    "triggeredAt": null,
    "reduceOnly": false
  }
}

Requires authentication.

Payload format

Name Type Value Description
market string XRP-PERP
side string sell "buy" or "sell"
size number 31431.0
type string stop one of "stop", "trailingStop", or "takeProfit"; default is stop
reduceOnly boolean false optional; default is false

Additional parameters for stop loss orders

Name Type Value Description
triggerPrice number 0.306525
orderPrice number 0.3063 optional; order type is limit if this is specified; otherwise market

Additional parameters for trailing stop orders

Name Type Value Description
trailValue number -0.05 negative for "sell"; positive for "buy"

Additional parameters for take profit orders

Name Type Value Description
triggerPrice number 0.306525
orderPrice number 0.3067 optional; order type is limit if this is specified; otherwise market

Response format

Name Type Value Description
createdAt string 2019-03-05T09:56:55.728933+00:00
future string XRP-PERP
id number 9596912
market string XRP-PERP
triggerPrice number 0.306525
orderId number 123123 ID of the order sent when this stop loss order triggered
side string sell
size number 31431.0
status string new (accepted but not processed yet), open, or closed (filled or cancelled)
type string stop
orderPrice number null price of the order sent when this stop loss triggered
error string null error message for unsuccessful order placement when this stop loss triggered
triggeredAt string null time at which this stop loss order triggered
reduceOnly boolean false

Get order status

Request

GET /orders/{order_id}

Response

{
  "success": true,
  "result": {
    "createdAt": "2019-03-05T09:56:55.728933+00:00",
    "filledSize": 10,
    "future": "XRP-PERP",
    "id": 9596912,
    "market": "XRP-PERP",
    "price": 0.306525,
    "avgFillPrice": 0.306526,
    "remainingSize": 31421,
    "side": "sell",
    "size": 31431,
    "status": "open",
    "type": "limit",
    "reduceOnly": false,
    "ioc": false,
    "postOnly": false,
    "clientId": null
  }
}

Get order status by client id

Request

GET /orders/by_client_id/{client_order_id}

Response

{
  "success": true,
  "result": {
    "createdAt": "2019-03-05T09:56:55.728933+00:00",
    "filledSize": 10,
    "future": "XRP-PERP",
    "id": 9596912,
    "market": "XRP-PERP",
    "price": 0.306525,
    "avgFillPrice": 0.306526,
    "remainingSize": 31421,
    "side": "sell",
    "size": 31431,
    "status": "open",
    "type": "limit",
    "reduceOnly": false,
    "ioc": false,
    "postOnly": false,
    "clientId": "your_client_order_id"
  }
}

Requires authentication.

Response format

Name Type Value Description
id number 9596912
market string XRP-PERP
type string limit
side string sell
price number 0.306525
size number 31431.0
filledSize number 10.0
remainingSize number 31421.0
avgFillPrice number 0.306526
status string new (accepted but not processed yet), open, or closed (filled or cancelled)
createdAt string 2019-03-05T09:56:55.728933+00:00
reduceOnly boolean false
ioc boolean false
postOnly boolean false
clientId string client order id

Cancel order

Request

DELETE /orders/{order_id}

Response

{
  "success": true,
  "result": "Order queued for cancelation"
}

Requires authentication.

Cancel order by client id

Request

DELETE /orders/by_client_id/{client_order_id}

Response

{
  "success": true,
  "result": "Order queued for cancellation"
}

Requires authentication.

Cancel open trigger order

Request

DELETE /conditional_orders/{id}

Response

{
  "success": true,
  "result": "Order cancelled"
}

Requires authentication.

Cancel all orders

This will also cancel conditional orders (stop loss and trailing stop orders).

Request

DELETE /orders
{
  "market": "BTC-PERP",
}

Response

{
  "success": true,
  "result": "Orders queued for cancelation"
}

Requires authentication.

Payload format

Name Type Value Description
market string USDTBEAR optional; restrict to cancelling orders only on this market
conditionalOrdersOnly boolean false optional; restrict to cancelling conditional orders only
limitOrdersOnly boolean false optional; restrict to cancelling existing limit orders (non-conditional orders) only

Fills

Request

GET /fills?market={market}

Response

{
  "success": true,
  "result": [
    {
      "fee": 20.1374935,
      "feeRate": 0.0005,
      "future": "EOS-0329",
      "id": 11215,
      "liquidity": "taker",
      "market": "EOS-0329",
      "baseCurrency": null,
      "quoteCurrency": null,
      "orderId": 8436981,
      "price": 4.201,
      "side": "buy",
      "size": 9587,
      "time": "2019-03-27T19:15:10.204619+00:00",
      "type": "order"
    }
  ]
}

Requires authentication.

Request parameters

Name Type Value Description
market string BTC-0329 optional; market to limit fills
limit number 20 optional; number of fills to return
start_time number 1564146934 optional; minimum time of fills to return, in Unix time (seconds since 1970-01-01)
end_time number 1564233334 optional; maximum time of fills to return, in Unix time (seconds since 1970-01-01)

Response format

Name Type Value Description
fee number 20.1374935
feeRate number 0.0005
future string EOS-0329
id number 11215 fill id
liquidity string taker "taker" or "maker"
market string EOS-0329
baseCurrency string BTC spot markets only
quoteCurrency string USD spot markets only
orderId number 8436981
price number 4.201
side string buy
size number 9587.0
time string 2019-03-27T19:15:10.204619+00:00
type string order

Funding Payments

Request

GET /funding_payments
Name Type Value Description
start_time number 1559881511 optional
end_time number 1559881711 optional

Response

{
  "success": true,
  "result": [
    {
      "future": "ETH-PERP",
      "id": 33830,
      "payment": 0.0441342,
      "time": "2019-05-15T18:00:00+00:00",
      "rate": 0.0001
    }
  ]
}

Requires authentication.

Response format

Name Type Value Description
future string ETH-PERP
id number 33830
payment number 0.0441342
time string 2019-05-15T18:00:00+00:00

Leveraged Tokens

List leveraged tokens

Request

GET /lt/tokens

Response

{
  "success": true,
  "result": [
    {
      "name": "HEDGE",
      "description": "1x Short Bitcoin Token",
      "underlying": "BTC-PERP",
      "leverage": -1,
      "outstanding": 1100.72231577,
      "pricePerShare": 2736.375887408888,
      "positionPerShare": -0.35783866135616976,
      "underlyingMark": 7605.25,
      "contractAddress": "0x1FA3bc860bF823d792f04F662f3AA3a500a68814",
      "change1h": 0.00035975425246481245,
      "change24h": 0.02595729864870652
    }
  ]
}

Response format

Name Type Value Description
name string HEDGE name of the token
description string 1x Short Bitcoin Token
underlying string BTC-PERP name of the underlying futures contract used by this token
leverage number -1
outstanding number 1100.72231577 number of outstanding tokens
pricePerShare number 2736.375887408888 price of each token, using the current mark price of the underlying future
positionPerShare number -0.35783866135616976 underlying futures position held by each token
underlyingMark number 7605.25 current mark price of the underlying future
contractAddress string 0x1FA3bc860bF823d792f04F662f3AA3a500a68814 ERC20 smart contract address of the token
change1h number 0.00035975425246481245 change in the price of the token over the past hour
change24h number 0.02595729864870652 change in the price of the token over the past day

Get token info

Request

GET /lt/{token_name}

Response

{
  "success": true,
  "result": {
    "name": "HEDGE",
    "description": "1x Short Bitcoin Token",
    "underlying": "BTC-PERP",
    "leverage": -1,
    "outstanding": 1100.72231577,
    "pricePerShare": 2736.375887408888,
    "positionPerShare": -0.35783866135616976,
    "underlyingMark": 7605.25,
    "contractAddress": "0x1FA3bc860bF823d792f04F662f3AA3a500a68814",
    "change1h": 0.00035975425246481245,
    "change24h": 0.02595729864870652
  }
}

Parameters

Name Type Value Description
token_name string HEDGE Required. Name of the token.

Response format

Name Type Value Description
name string HEDGE name of the token
description string 1x Short Bitcoin Token
underlying string BTC-PERP name of the underlying futures contract used by this token
leverage number -1
outstanding number 1100.72231577 number of outstanding tokens
pricePerShare number 2736.375887408888 price of each token, using the current mark price of the underlying future
positionPerShare number -0.35783866135616976 underlying futures position held by each token
underlyingMark number 7605.25 current mark price of the underlying future
contractAddress string 0x1FA3bc860bF823d792f04F662f3AA3a500a68814 ERC20 smart contract address of the token
change1h number 0.00035975425246481245 change in the price of the token over the past hour
change24h number 0.02595729864870652 change in the price of the token over the past day

Get leveraged token balances

Request

GET /lt/balances

Response

{
  "success": true,
  "result": [
    {
      "token": "HEDGE",
      "balance": 8.8
    }
  ]
}

Requires authentication.

Response format

Name Type Value Description
token string HEDGE
balance number 8.8

List leveraged token creation requests

Request

GET /lt/creations

Response

{
  "success": true,
  "result": [
    {
      "id": 123,
      "token": "HEDGE",
      "requestedSize": 10,
      "pending": false,
      "createdSize": 10,
      "price": 1234,
      "cost": 12340,
      "fee": 12.34,
      "requestedAt": "2019-03-05T09:56:55.728933+00:00",
      "fulfilledAt": "2019-03-05T09:56:55.728933+00:00"
    }
  ]
}

Requires authentication.

Response format

Name Type Value Description
id number 123
token string HEDGE name of the token
requestedSize number 10 number of tokens originally requested
pending boolean false
createdSize number 10 number of tokens created; may be less than the requested number
price number 1234 price at which the creation request was fulfilled
cost number 12340 cost of creating the tokens, not including fees
fee number 12.34 fee for creating the tokens
requestedAt string 2019-03-05T09:56:55.728933+00:00 time the request was submitted
fulfilledAt string 2019-03-05T09:56:55.728933+00:00 time the request was processed

Request leveraged token creation

Request

POST /lt/{token_name}/create
{
  "size": 31431.0
}

Response

{
  "success": true,
  "result": {
    "id": 123,
    "token": "HEDGE",
    "requestedSize": 10,
    "cost": 12340,
    "pending": true,
    "requestedAt": "2019-03-05T09:56:55.728933+00:00"
  }
}

Requires authentication.

Request parameters

Name Type Value Description
token_name string HEDGE required; name of the token

Payload format

Name Type Value Description
size number 31431.0 number of tokens to create

Response format

Name Type Value Description
id number 123
token string HEDGE name of the token
requestedSize number 10 number of tokens requested
cost number 12340 amount of collateral deducted for the creation request
pending boolean true
requestedAt string 2019-03-05T09:56:55.728933+00:00 time the request was submitted

List leveraged token redemption requests

Request

GET /lt/redemptions

Response

{
  "success": true,
  "result": [
    {
      "id": 123,
      "token": "HEDGE",
      "size": 10,
      "pending": false,
      "price": 1234,
      "proceeds": 12340,
      "fee": 12.34,
      "requestedAt": "2019-03-05T09:56:55.728933+00:00",
      "fulfilledAt": "2019-03-05T09:56:55.728933+00:00"
    }
  ]
}

Requires authentication.

Response format

Name Type Value Description
id number 123
token string HEDGE name of the token
size number 10 number of tokens redeemed
pending boolean false
price number 1234 price at which the redemption request was fulfilled
proceeds number 12340 proceeds from the redemption, before fees
fee number 12.34 fee for redeeming the tokens
requestedAt string 2019-03-05T09:56:55.728933+00:00 time the request was submitted
fulfilledAt string 2019-03-05T09:56:55.728933+00:00 time the request was processed

Request leveraged token redemption

Request

POST /lt/{token_name}/redeem
{
  "size": 31431.0
}

Response

{
  "success": true,
  "result": {
    "id": 123,
    "token": "HEDGE",
    "size": 10,
    "projectedProceeds": 12340,
    "pending": true,
    "requestedAt": "2019-03-05T09:56:55.728933+00:00"
  }
}

Requires authentication.

Request parameters

Name Type Value Description
token_name string HEDGE required; name of the token

Payload format

Name Type Value Description
size number 31431.0 number of tokens to create

Response format

Name Type Value Description
id number 123
token string HEDGE - name of the token
size number 10 - number of tokens requsted to be redeemed
projectedProceeds number 12340 - estimated proceeds from the redemption
pending boolean true
requestedAt string 2019-03-05T09:56:55.728933+00:00 - time the request was submitted

Websocket API

Streaming API with the most up-to-date market and account order data. With this API, you can send messages to a server and receive event-driven responses without having to poll the server for a reply.

Websocket endpoint URL: wss://ftx.com/ws/

Requests and responses use JSON.

You can find sample code here: https://github.com/ftexchange/ftx

Request process

Websocket connections go through the following lifecycle:

Request format

Messages sent to the server should contain the following dictionary items:

Response format

Public Channels

Ticker

The ticker channel provides the latest best bid and offer market data. All messages are snapshots (partial), and the data field contains:

Trades

The trades channel provides data on all trades in the market. All messages are snapshots of new trades (partial) and the data field contains:

Orderbooks

The orderbook channel provides data about the orderbook's best 100 orders on either side.

Initial snapshot

Upon subscribing, you will receive one snapshot of the orderbook (partial) with a data field containing:

The bids and asks are formatted like so: [[best price, size at price], [next next best price, size at price], ...]

Updates

After receiving your snapshot, you will be streamed updates (message type is update) that have data fields with:

The bids and asks fields contain updates to the orderbook.

Checksum

Every message contains a signed 32-bit integer checksum of the orderbook. You can run the same checksum on your client orderbook state and compare it to checksum field. If they are the same, your client's state is correct. If not, you have likely lost or mishandled a packet and should re-subscribe to receive the initial snapshot.

The checksum operates on a string that represents the first 100 orders on the orderbook on either side. The format of the string is:

For example, if the orderbook was comprised of the following two bids and asks:

The string would be '5005.5:10:5001.0:6:4995.0:5:5002.0:7'

If there are more orders on one side of the book than the other, then simply omit the information about orders that don't exist.

For example, if the orderbook had the following bids and asks:

The string would be '5005.5:10:5001.0:6:4995.0:5'

The final checksum is the crc32 value of this string.

Private Channels

Authentication

You can log in by sending a message like so %{code}

{
  "args": {
    "key": "<api_key>",
    "sign": "<signature>",
    "time": "<ts>"
  },
  "op": "login"
}

As an example, if:

sign would be d10b5a67a1a941ae9463a60b285ae845cdeac1b11edc7da9977bef0228b96de9

One websocket connection may be logged in to at most one user. If the connection is already authenticated, further attempts to log in will result in 400s.

Fills

You will receive messages so:

{
  "channel": "fills",
  "data": {
    "fee": 78.05799225,
    "feeRate": 0.0014,
    "future": "BTC-PERP",
    "id": 7828307,
    "liquidity": "taker",
    "market": "BTC-PERP",
    "orderId": 38065410,
    "price": 3723.75,
    "side": "buy",
    "size": 14.973,
    "time": "2019-05-07T16:40:58.358438+00:00",
    "type": "order"
  },
  "type": "update"
}

This channel streams your fills across all markets. You can subscribe to it on an authenticated connection by sending {'op': 'subscribe', 'channel': 'fills'}.

Orders

You will receive messages so:

{
  "channel": "orders",
  "data": {
    "id": 24852229,
    "clientId": null,
    "market": "XRP-PERP",
    "type": "limit",
    "side": "buy",
    "size": 42353.0,
    "price": 0.2977,
    "reduceOnly": false,
    "ioc": false,
    "postOnly": false,
    "status": "closed",
    "filledSize": 0.0,
    "remainingSize": 0.0,
    "avgFillPrice": 0.2978
  },
  "type": "update"
}

This channel streams updates to your orders across all markets. You can subscribe to it on an authenticated connection by sending {'op': 'subscribe', 'channel': 'orders'}.

FIX API

FIX (Financial Information eXchange) is a standard electronic messaging protocol which can be used to place orders, receive order updates and executions, and cancel orders. Our FIX api is based on the FIX 4.2 specification and modeled after FIX implementations of other popular cryptocurrency exchanges.

You can find sample client code here: https://github.com/ftexchange/ftx

FIX endpoint URL: tcp+ssl://fix.ftx.com:4363

Clients should connect to the endpoint using SSL.

Sequence numbers are reset for each connection. Resend request and sequence reset messages are not supported.

Messages

8=FIX.4.2|9=162|35=A|49=zyfvB4QPg0A3kkVgqUE9V1fOA-Y6jhdG3seqIIZx|56=FTX

All messages should include the following header:

This documentation uses | to represent the FIX field separator (byte 0x01). It should be replaced by 0x01 in actual messages.

Tag Name Example Description
8 BeginString FIX.4.2 Must be set to "FIX.4.2"
9 BodyLength 162 Length of the message body in bytes
35 MsgType 8 Message type
49 SenderCompID zyfvB4QPg0A3kkVgqUE9V1fOA-Y6jhdG3seqIIZx Client API key (for messages from the client)
56 TargetCompID FTX Must be set to "FTX" (for messages from the client)
34=1|52=20190525-07:17:48

Messages should also include a sequence number MsgSeqNum (34) and a timestamp SendingTime (52). Sequence numbers start at 1 and must be incremented with every message. Messages with duplicate or out-of-order sequence numbers will be rejected. Sequence numbers are reset on new connections.

Logon (A)

Sent by the client to initiate a FIX session. Must be the first message sent after a connection is established. Only one session can be established per connection; additional Logon messages are rejected.

Request

8=FIX.4.2|9=162|35=A|49=zyfvB4QPg0A3kkVgqUE9V1fOA-Y6jhdG3seqIIZx|56=FTX|34=1|52=20190525-07:51:51|98=0|108=30|96=8f7e7d37f8033ad249c1833687c230b6f4663f0dd72752899776bab9aa064783|10=237|
Tag Name Example Description
35 MsgType A
98 EncryptMethod 0 Must be set to "0" (None)
108 HeartBInt 30 Must be set to "30"
96 RawData 8f7e...4783 Signature (see below)
8013 CancelOrdersOnDisconnect Y "Y": all account orders will be cancelled at the end of the session. "S": all orders placed during the session will be cancelled at the end of the session. Default: no orders will be cancelled.
1 Account "my_subaccount" Optional subaccount name; can be omitted if authenticating for main account

Signature

from datetime import datetime
import hmac

api_key = 'YOUR_API_KEY'
api_secret = 'YOUR_API_SECRET'

sending_time = datetime.now().strftime('%Y%m%d-%H:%M:%S')

sign_target = '\x01'.join([
    sending_time,  # SendingTime
    'A',  # MsgType
    '1',  # MsgSeqNum
    api_key,  # SenderCompID
    'FTX',  # TargetCompID
])

signature = hmac.new(api_secret.encode(), sign_target.encode(), 'sha256').hexdigest()

let crypto = require('crypto');

let apiKey = 'YOUR_API_KEY';
let apiSecret = 'YOUR_API_SECRET';

let sendingTime = '20190525-07:51:51';

let signTarget = [
    sendingTime,  // SendingTime
    'A',  // MsgType
    '1',  // MsgSeqNum
    apiKey,  // SenderCompID
    'FTX',  // TargetCompID
].join('\x01');

let hmac = crypto.createHmac('sha256', apiSecret);
let signature = hmac.update(signTarget).digest('hex');

For security, the Logon message must be signed by the client. To compute the signature, concatenate the following fields, joined by the FIX field separator (byte 0x01), and compute the SHA256 HMAC using the API secret:

The resulting hash should be hex-encoded.








Response

8=FIX.4.2|9=98|35=A|49=FTX|56=zyfvB4QPg0A3kkVgqUE9V1fOA-Y6jhdG3seqIIZx|34=1|98=0|108=30|52=20190525-07:51:51.838|10=099
Tag Name Value
35 MsgType A
98 EncryptMethod 0
108 HeartBInt 30

Heartbeat (0)

Sent by either side if a message has not been received in the past 30 seconds. Should also be sent in response to a TestRequest (1).

8=FIX.4.2|9=86|35=1|49=zyfvB4QPg0A3kkVgqUE9V1fOA-Y6jhdG3seqIIZx|56=FTX|34=2|52=20190525-07:52:24.029|10=049|
Tag Name Value Description
35 MsgType 0
112 TestReqID 123 If this heartbeat is in response to a TestRequest, copied from the TestRequest.

Test Request (1)

May be sent by either side at any time.

8=FIX.4.2|9=112|35=1|49=zyfvB4QPg0A3kkVgqUE9V1fOA-Y6jhdG3seqIIZx|56=FTX|34=3|112=20190525-08:26:38.989|52=20190525-08:26:38.989|10=140|
Tag Name Value Description
35 MsgType 1
112 TestReqID 123 Arbitrary string, to be echoed back by a Heartbeat.

Logout (5)

Sent by either side to terminate the session. The other side should respond with another Logout message to acknowledge session termination. The connection will be closed afterwards.

Tag Name Value
35 MsgType 5

New Order Single (D)

Sent by the client to submit a new order. Only limit orders are currently supported by the FIX API.

Tag Name Value Description
35 MsgType D
21 HandlInst 1 Must be set to "1" (AutomatedExecutionNoIntervention)
11 ClOrdID order123 Arbituary client-selected string to identify the order; must be unique within the session
55 Symbol BTC-PERP Symbol name
40 OrdType 2 Must be set to "2" (Limit)
38 OrderQty 1.1 Order size in base units
44 Price 8000 Limit price
54 Side 1 "1": buy; "2": sell
59 TimeInForce 1 Must be set to "1" (Good Till Cancel) or "3" (Immediate or Cancel)
18 ExecInst E This paramter is optional. "E": reduce only, "6": post only, not supplied: standard

If the order is accepted, an ExecutionReport (8) with ExecType=A (Pending New) will be returned. Otherwise, an ExecutionReport with ExecType=8 (Rejected) will be returned.

Order Cancel Request (F)

Sent by the client to request to cancel an order.

Tag Name Value Description
35 MsgType F
37 OrderID 123456 System-assigned order ID of the order
41 OrigClOrdID order123 Client-assigned order ID of the order

Only one of OrderID (37) and OrigClOrdID (41) should be provided.

If the order is successfully cancelled, an ExecutionReport (8) with ExecType=6 (Pending Cancel) will be returned. Otherwise, an OrderCancelReject (9) will be returned.

Order Cancel Reject (9)

Sent by the server to notify the client that an OrderCancelRequest (F) failed.

Tag Name Value Description
35 MsgType 9
11 ClOrdID cancel123 Copied from OrderCancelRequest
37 OrderID 123456 Copied from OrderCancelRequest
41 OrigClOrdID order123 Copied from OrderCancelRequest
39 OrdStatus 4 "4" (Canceled) if the order was already cancelled
102 CxlRejReason 1 "0": order already cancelled, "1": unknown order
434 CxlRejResponseTo 1 Always set to "1"

Order Status Request (H)

Sent by the client to request the status of an order.

Tag Name Value Description
35 MsgType H
37 OrderID 123456 OrderID of the order to request, or "*" to request all pending orders
41 OrigClOrdID order123 Client-assigned order ID of the order

The server will respond with an ExecutionReport (8) with ExecType=I (OrderStatus) with the requested order or orders. Only one of OrderID (37) and OrigClOrdID (41) should be provided.

Execution Report (8)

Sent by the server whenever an order receives a fill, whenever the status of an order changes, or in response to a NewOrderSingle (D), OrderCancelRequest (F), or OrderStatusRequest (H) message from the client.

Tag Name Value Description
35 MsgType 8
11 ClOrdID order123 Client-selected order ID.
37 OrderID 123456 Server-assigned order ID
55 Symbol BTC-PERP Symbol name
54 Side 1 "1": buy; "2": sell
38 OrderQty 1.2 Original order quantity
44 Price 8000 Original order price
150 ExecType 1 Reason for this message (see below)
39 OrdStatus 0 Order status (see below)
14 CumQty 0.4 Quantity of order that has already been filled
151 LeavesQty 0.8 Quantity of order that is still open
60 TransactTime 20190525-08:26:38.989 Time of the order update. Only present on order updates
31 LastPx 7999.25 Fill price. Only present if this message was the result of a fill
32 LastQty 0.4 Fill quantity. Only present if this message was the result of a fill
1057 AggressorIndicator Y "Y": taker fill; "N": maker fill. Only present if this message was the result of a fill
103 OrdRejReason 3 Reason the order was rejected (see below). Only present on rejected NewOrderSignle (D) requests
58 Text 58 Description of the reason the order was rejected.Only present on rejected NewOrderSignle (D) requests

ExecType values

The ExecType (150) field indicates the reason why this ExecutionReport was sent.

ExecType Description
0 New order
1 New fill for order
3 Order done (fully filled)
4 Order cancelled
5 Order resized (possible for reduce-only orders)
A Response to a successful NewOrderSingle (D) request
8 Response to a rejected NewOrderSingle (D) request
6 Response to a successful OrderCancelRequest (F) request
I Response to a OrderStatusRequest (H) request

Note that every fill will generate a new ExecType=1 message. If a fill causes an order to be fully filled, both a ExecType=1 message and a ExecType=3 message will be generated. Similarly, a newly placed order that is immediately matched against an opposing order will generate both a ExecType=0 message and a ExecType=1 message.

OrdStatus values

OrdStatus Description
0 New order
1 Partially filled order
3 Fully filled order
4 Cancelled order
5 Resized order

OrdRejReason values

OrdRejReason Description
3 Risk limits exceeded
0 Other errors

Reject (3)

Sent by the server in response to an invalid message.

Tag Name Value Description
35 MsgType 3
45 RefSeqNum 2 Sequence number of the rejected message
371 RefTagID 38 Tag number of the rejected field
372 RefMsgType D Message type of the rejected message
58 Text Missing quantity Human-readable description of the reason for the rejection
373 SessionRejectReason 1 Code to identify the rejection reason (see below)

Rejection reason codes

SessionRejectReason Description
1 Required tag missing
5 Value incorrect for this tag
6 Incorrect data format for value
11 Invalid MsgType