Skip to contents

Retrieves market tickers for all trading pairs from the KuCoin API asynchronously, including 24-hour volume data.

Usage

get_all_tickers_impl(
  base_url = get_base_url(),
  .__coro_env_parent__ = <environment>
)

Arguments

base_url

Character string; base URL for the KuCoin API. Defaults to get_base_url().

Value

Promise resolving to a data.table containing:

  • symbol (character): Trading symbol.

  • symbolName (character): Symbol name.

  • buy (character): Best bid price.

  • bestBidSize (character): Best bid size.

  • sell (character): Best ask price.

  • bestAskSize (character): Best ask size.

  • changeRate (character): 24-hour change rate.

  • changePrice (character): 24-hour price change.

  • high (character): 24-hour high price.

  • low (character): 24-hour low price.

  • vol (character): 24-hour trading volume.

  • volValue (character): 24-hour turnover.

  • last (character): Last traded price.

  • averagePrice (character): 24-hour average price.

  • takerFeeRate (character): Taker fee rate.

  • makerFeeRate (character): Maker fee rate.

  • takerCoefficient (character): Taker fee coefficient.

  • makerCoefficient (character): Maker fee coefficient.

  • globalTime_ms (integer): Snapshot timestamp in milliseconds.

  • globalTime_datetime (POSIXct): Snapshot timestamp in UTC.

Details

Workflow Overview

  1. URL Assembly: Combines base_url with /api/v1/market/allTickers.

  2. HTTP Request: Sends a GET request with a 10-second timeout via httr::GET().

  3. Response Processing: Validates the response with process_kucoin_response() and extracts "data".

  4. Data Conversion: Converts the "ticker" array to a data.table, adding globalTime_ms and globalTime_datetime from the "time" field.

API Endpoint

GET https://api.kucoin.com/api/v1/market/allTickers

Usage

Utilised to fetch a snapshot of market data across all KuCoin trading pairs for monitoring or analysis.

Official Documentation

KuCoin Get All Tickers

Examples

if (FALSE) { # \dontrun{
main_async <- coro::async(function() {
  tickers <- await(get_all_tickers_impl())
  print(tickers)
})
main_async()
while (!later::loop_empty()) later::run_now()
} # }