% 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 (up to ~7 days) for the specified instrument type.
This wraps `/api/v5/trade/orders-history`. For older data, OKX provides
an archive endpoint (`orders-history-archive`) which is not covered here.
}
\note{
Since okxr 0.1.2
}
\section{Common errors}{

- HTTP 401 Unauthorized (missing/invalid credentials)
- HTTP 400 Bad Request (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()]

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