% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/wrappers_get_trade.R
\name{get_trade_order}
\alias{get_trade_order}
\title{Get trade order details}
\usage{
get_trade_order(
  inst_id,
  ord_id = NULL,
  cl_ord_id = NULL,
  config,
  tz = .okx_default_tz
)
}
\arguments{
\item{inst_id}{Character. Instrument ID, e.g. `"ETH-USDT-SWAP"` (perps),
`"BTC-USDT"` (spot), or `"BTC-USD-240927"` (dated futures).}

\item{ord_id}{Character, optional. The OKX order ID. Provide this **or** `cl_ord_id`.}

\item{cl_ord_id}{Character, optional. Your client order ID. Provide this **or** `ord_id`.}

\item{config}{List. API credentials/config, typically containing
`api_key`, `secret_key`, and `passphrase`. May also include `base_url`.}

\item{tz}{Character. Time zone for parsing timestamps. Default `"Asia/Hong_Kong"`.}
}
\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`.
}
\description{
Retrieve detailed information about a specific OKX order by either the
exchange-assigned `ord_id` or your client-assigned `cl_ord_id`.
}
\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`.
}
\note{
Since okxr 0.1.1
}
\section{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
}

\examples{
\dontrun{
cfg <- list(api_key = "xxx", secret_key = "xxx", passphrase = "xxx")
get_trade_order(
  inst_id = "ETH-USDT-SWAP",
  ord_id  = "1234567890",
  config  = cfg
)
}

}
\seealso{
[get_trade_orders_pending()], [get_trade_orders_history_7d()]

Other okxr-trade: 
\code{\link{get_trade_orders_history_7d}()},
\code{\link{get_trade_orders_pending}()}
}
\concept{okxr-trade}
