get_market_candles: Get recent market candles

View source: R/wrappers_get_market.R

get_market_candlesR Documentation

Get recent market candles

Description

Retrieve the latest candlestick data for a given instrument and bar size.

Usage

get_market_candles(
  inst_id,
  bar,
  limit = 100L,
  config = NULL,
  tz = .okx_default_tz,
  standardize_names = TRUE
)

Arguments

inst_id

Character. Instrument ID, e.g. '"BTC-USDT"', '"ETH-USDT-SWAP"'.

bar

Character. Candlestick granularity, e.g. '"1m"', '"5m"', '"1H"', '"1D"'.

limit

Integer. Number of bars to retrieve. Default '100L'.

config

Optional list. Public endpoint request options, such as 'timeout'; credentials are not required.

tz

Character. Time zone for parsing timestamps. Default '"Asia/Hong_Kong"'.

standardize_names

Logical. If 'TRUE' (default), renames columns to 'timestamp', 'open', 'high', 'low', 'close', 'volume', 'volQuote'.

Details

Wraps '/api/v5/market/candles'. Returns up to 'limit' bars, sorted by timestamp. Candlestick fields can be standardized to common OHLCV names via 'standardize_names = TRUE'.

Value

A 'data.frame' with columns including 'timestamp', 'open', 'high', 'low', 'close', 'volume', and 'volQuote'. Timestamps are 'POSIXct' in 'tz'.

Note

Since okxr 0.1.1

See Also

[get_market_history_candles()], [get_public_mark_price()]

Examples

## Not run: 
cfg <- list(api_key = "xxx", secret_key = "xxx", passphrase = "xxx")
get_market_candles("BTC-USDT", bar = "5m", limit = 50, config = cfg)

## End(Not run)


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