get_trade_orders_history_7d: Get trade orders history (last 7 days)

View source: R/wrappers_get_trade.R

get_trade_orders_history_7dR Documentation

Get trade orders history (last 7 days)

Description

Retrieve recent order history for an instrument type.

Usage

get_trade_orders_history_7d(
  inst_type = "SWAP",
  config,
  tz = .okx_default_tz
)

Arguments

inst_type

Character. Instrument type. One of '"SPOT"', '"MARGIN"', '"SWAP"', '"FUTURES"', '"OPTION"'. Default '"SWAP"'.

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 (e.g. '"Asia/Hong_Kong"').

Details

This wraps '/api/v5/trade/orders-history' and covers about 7 days of data. Older data is available from OKX's archive endpoint.

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'.

Common errors

- HTTP 401 Unauthorized - HTTP 400 Bad Request for invalid 'inst_type'

Note

Since okxr 0.1.2

See Also

[get_trade_order()], [get_trade_orders_pending()]

Examples

## Not run: 
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)

## End(Not run)


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