v3

latestOpenAPI 3.0.02026-07-311784111.3 MB
Block Trade
Matching Engine
Private

Executes a block trade. This is the second step in the block trade workflow - the second party calls this method with the signature received from the first party to execute the trade.

The whole request must be exactly the same as in private/verify_block_trade, only the role field should be set appropriately - this means that both sides have to agree on the same timestamp, nonce, and trades fields, and the server will ensure that the role field is different between sides (each party accepts their own role).

Using the same timestamp and nonce by both sides in private/verify_block_trade ensures that even if unintentionally both sides execute the given block trade with a valid counterparty_signature, the block trade will be executed only once.

Note: In the API, the direction field is always expressed from the maker's perspective. This means that when you accept a block trade as a taker, the direction shown in the API represents the opposite side of your trade. For example, if you are buying puts as a taker, the API will show the operation as a "sell put" (maker's perspective), and you will be verifying and accepting a "sell put" block trade.

📖 Related Article: Block Trading

Scope: block_trade:read_write

Try in API console

get/private/execute_block_trade

Query parameters

timestampinteger required

The timestamp (milliseconds since the Unix epoch)

Example:1536569522277

Timestamp, shared with other party (milliseconds since the UNIX epoch)

noncestring required

Nonce

Example:bF1_gfgcsd

Nonce, shared with other party

role'maker' | 'taker' required

Trade role of the user: maker or taker

Describes if user wants to be maker or taker of trades

instrument_namestring

Unique instrument identifier

pricenumber

Price for trade

amountnumber

It represents the requested order size. For perpetual and inverse futures the amount is in USD units. For options and linear futures it is the underlying base currency coin.

direction'buy' | 'sell'

Direction: buy, or sell

List of trades for block trade

[
  {
    "instrument_name": "BTC-PERPETUAL"
  }
]
counterparty_signaturestring required

Signature of block trade<br>It is valid only for 5 minutes around given timestamp

Example:1565173369982.1M9tO0Q-.z9n9WyZUU5op9pEz6Jtd2CI71QxQMMsCZAexnIfK9HQRT1pKH3clxeIbY7Bqm-yMcWIoE3IfCDPW5VEdiN-6oS0YkKUyXPD500MUf3ULKhfkmH81EZs

Signature of block trade generated by private/verify_block_trade_method

Response

Success response

jsonrpc'2.0' required

The JSON-RPC version (2.0)

idinteger

The id that was sent in the request

Example response

{
  "result": {
    "id": "154",
    "timestamp": 1536569522277,
    "trades": [
      {
        "instrument_name": "BTC-PERPETUAL",
        "timestamp": 1517329113791,
        "block_trade_id": "154"
      }
    ],
    "app_name": "Example Application",
    "broker_code": "2krM7sJsx",
    "broker_name": "Test Broker"
  }
}