get_trade_order: Get trade order details

View source: R/wrappers_get_trade.R

get_trade_orderR Documentation

Get trade order details

Description

Retrieve detailed information about a specific OKX order by either the exchange-assigned 'ord_id' or your client-assigned 'cl_ord_id'.

Usage

get_trade_order(
  inst_id,
  ord_id = NULL,
  cl_ord_id = NULL,
  config,
  tz = .okx_default_tz
)

Arguments

inst_id

Character. Instrument ID, e.g. '"ETH-USDT-SWAP"' (perps), '"BTC-USDT"' (spot), or '"BTC-USD-240927"' (dated futures).

ord_id

Character, optional. The OKX order ID. Provide this **or** 'cl_ord_id'.

cl_ord_id

Character, optional. Your client order ID. Provide this **or** 'ord_id'.

config

List. API credentials/config, typically containing 'api_key', 'secret_key', and 'passphrase'. May also include 'base_url'.

tz

Character. Time zone for parsing timestamps. Default '"Asia/Hong_Kong"'.

Details

You must provide exactly one identifier: 'ord_id' **or** 'cl_ord_id'. Timestamps in the response are converted to 'POSIXct' in the supplied 'tz'.

Value

A 'data.frame' (one row) with order details following OKX schema (e.g., 'ordId', 'clOrdId', 'instId', 'ordType', 'px', 'sz', 'side', 'posSide', 'tdMode', 'accFillSz', 'fillPx', 'fillSz', 'fillTime', 'avgPx', 'state', 'lever', etc.). Timestamp columns are 'POSIXct' in 'tz'.

Common errors

- ‘Either ’ord_id' or 'cl_ord_id' must be provided.' (client-side) - HTTP 401 Unauthorized (missing/invalid credentials) - OKX 'code' like '51000' invalid sign or '51603' order not found

Note

Since okxr 0.1.1

See Also

[get_trade_orders_pending()], [get_trade_orders_history_7d()]

Examples

## Not run: 
cfg <- list(api_key = "xxx", secret_key = "xxx", passphrase = "xxx")
get_trade_order(
  inst_id = "ETH-USDT-SWAP",
  ord_id  = "1234567890",
  config  = cfg
)

## End(Not run)


okxr documentation built on May 8, 2026, 5:09 p.m.