Skip to main content
Block trading uses the RFQ (Request for Quote) model. Makers respond to RFQs with quotes; takers execute against the best quote. Most endpoints require authentication; public trade data does not.

Method reference

Counterparty and settings

MethodHTTPAuthEndpointDescription
getBlockCounterParties()GETYes/api/v5/rfq/counterpartiesEligible block trading counterparties
getQuoteProducts()GETYes/api/v5/rfq/maker-instrument-settingsMaker instrument settings
updateBlockQuoteProducts(params)POSTYes/api/v5/rfq/maker-instrument-settingsUpdate maker instrument settings

RFQ lifecycle (taker)

MethodHTTPAuthEndpointDescription
createBlockRFQ(params)POSTYes/api/v5/rfq/create-rfqCreate a new RFQ
cancelBlockRFQ(params)POSTYes/api/v5/rfq/cancel-rfqCancel an RFQ
cancelMultipleBlockRFQs(params)POSTYes/api/v5/rfq/cancel-batch-rfqsCancel multiple RFQs
cancelAllRFQs()POSTYes/api/v5/rfq/cancel-all-rfqsCancel all active RFQs
executeBlockQuote(params)POSTYes/api/v5/rfq/execute-quoteExecute a quote
getBlockRFQs(params?)GETYes/api/v5/rfq/rfqsList RFQs

Quote lifecycle (maker)

MethodHTTPAuthEndpointDescription
createBlockQuote(params)POSTYes/api/v5/rfq/create-quoteCreate a quote in response to an RFQ
cancelBlockQuote(params)POSTYes/api/v5/rfq/cancel-quoteCancel a quote
cancelMultipleBlockQuotes(params)POSTYes/api/v5/rfq/cancel-batch-quotesCancel multiple quotes
cancelAllBlockQuotes()POSTYes/api/v5/rfq/cancel-all-quotesCancel all active quotes
getBlockQuotes(params?)GETYes/api/v5/rfq/quotesList quotes

MMP (Market Maker Protection)

MethodHTTPAuthEndpointDescription
updateBlockMmpConfig(params)POSTYes/api/v5/rfq/mmp-configConfigure MMP
getBlockMmpConfig()GETYes/api/v5/rfq/mmp-configGet MMP configuration
resetBlockMmp()POSTYes/api/v5/rfq/mmp-resetReset MMP after trigger
cancelAllBlockAfter(params)POSTYes/api/v5/rfq/cancel-all-afterCancel-all-after timer

Trades and market data

MethodHTTPAuthEndpointDescription
getBlockTrades(params?)GETYes/api/v5/rfq/tradesYour executed block trades
getPublicRFQBlockTrades(params?)GETNo/api/v5/rfq/public-tradesPublic block trade tape
getBlockTickers(params)GETNo/api/v5/market/block-tickersBlock tickers by instrument type
getBlockTicker(params)GETNo/api/v5/market/block-tickerBlock ticker for one instrument
getBlockPublicTrades(params)GETNo/api/v5/public/block-tradesPublic block trades for an instrument

Examples

Create an RFQ (taker)

import { RestClient } from 'okx-api';

const client = new RestClient({
  apiKey: process.env.API_KEY!,
  apiSecret: process.env.API_SECRET!,
  apiPass: process.env.API_PASS!,
});

// Get eligible counterparties first
const counterparties = await client.getBlockCounterParties();
console.log('Available counterparties:', counterparties.map((c) => c.traderCode));

// Create an RFQ to buy 5 BTC
const [rfq] = await client.createBlockRFQ({
  counterparties: ['COUNTERPARTY_CODE'],
  anonymous: false,
  legs: [
    {
      instId: 'BTC-USDT',
      tdMode: 'cash',
      side: 'buy',
      sz: '5',
      tgtCcy: 'base_ccy',
    },
  ],
});

console.log('RFQ ID:', rfq.rfqId);
console.log('State:', rfq.state);

Create a quote (maker)

const [quote] = await client.createBlockQuote({
  rfqId: 'incoming-rfq-id',
  quoteSide: 'buy',
  legs: [
    {
      instId: 'BTC-USDT',
      px: '67500',
      sz: '5',
      side: 'sell',
      tgtCcy: 'base_ccy',
    },
  ],
});
console.log('Quote ID:', quote.quoteId);

Execute a quote

const [trade] = await client.executeBlockQuote({
  rfqId: 'your-rfq-id',
  quoteId: 'the-best-quote-id',
  legs: [
    {
      instId: 'BTC-USDT',
      px: '67500',
      sz: '5',
      side: 'buy',
      tgtCcy: 'base_ccy',
    },
  ],
});
console.log('Block trade ID:', trade.blockTdId);
console.log('Fill price:', trade.legs[0]?.px);

Query public block trades

const client = new RestClient(); // no auth

const trades = await client.getPublicRFQBlockTrades();
for (const t of trades.slice(0, 5)) {
  console.log(`${t.instId}: ${t.sz} @ ${t.px} (${t.side})`);
}

Build docs developers (and LLMs) love