View source: R/wrappers_get_trade.R
| get_trade_order | R Documentation |
Retrieve detailed information about a specific OKX order by either the exchange-assigned 'ord_id' or your client-assigned 'cl_ord_id'.
get_trade_order(
inst_id,
ord_id = NULL,
cl_ord_id = NULL,
config,
tz = .okx_default_tz
)
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"'. |
You must provide exactly one identifier: 'ord_id' **or** 'cl_ord_id'. Timestamps in the response are converted to 'POSIXct' in the supplied 'tz'.
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'.
- ‘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
Since okxr 0.1.1
[get_trade_orders_pending()], [get_trade_orders_history_7d()]
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.