% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/wrappers_get_trade.R
\name{get_trade_orders_history_7d}
\alias{get_trade_orders_history_7d}
\title{Get trade orders history (last 7 days)}
\usage{
get_trade_orders_history_7d(
  inst_type = "SWAP",
  config,
  tz = .okx_default_tz
)
}
\arguments{
\item{inst_type}{Character. Instrument type. One of `"SPOT"`, `"MARGIN"`,
`"SWAP"`, `"FUTURES"`, `"OPTION"`. Default `"SWAP"`.}

\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 (e.g. `"Asia/Hong_Kong"`).}
}
\value{
A `data.frame` with one row per historical order and columns following the OKX
schema (same layout as pending orders, plus final states). Timestamp columns
are `POSIXct` in `tz`.
}
\description{
Retrieve recent order history for an instrument type.
}
\details{
This wraps `/api/v5/trade/orders-history` and covers about 7 days of data.
Older data is available from OKX's archive endpoint.
}
\note{
Since okxr 0.1.2
}
\section{Common errors}{

- HTTP 401 Unauthorized
- HTTP 400 Bad Request for invalid `inst_type`
}

\examples{
\dontrun{
cfg <- list(api_key = "xxx", secret_key = "xxx", passphrase = "xxx")
hist <- get_trade_orders_history_7d(
  inst_type = "SWAP",
  config = cfg,
  tz = "Asia/Hong_Kong"
)
tail(hist)
}

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