Retrieves market tickers for all trading pairs from the KuCoin API asynchronously, including 24-hour volume data.
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
URL Assembly: Combines
base_url
with/api/v1/market/allTickers
.HTTP Request: Sends a GET request with a 10-second timeout via
httr::GET()
.Response Processing: Validates the response with
process_kucoin_response()
and extracts"data"
.Data Conversion: Converts the
"ticker"
array to adata.table
, addingglobalTime_ms
andglobalTime_datetime
from the"time"
field.
Usage
Utilised to fetch a snapshot of market data across all KuCoin trading pairs for monitoring or analysis.
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()
} # }