Get All Currencies (Implementation)
Source:R/impl_spottrading_market_data.R
get_all_currencies_impl.RdRetrieves a list of all currencies available on KuCoin asynchronously, combining summary and chain-specific details into a data.table.
Arguments
- base_url
Character string; base URL for the KuCoin API. Defaults to
get_base_url().
Value
Promise resolving to a data.table containing:
Summary Fields:
currency(character): Unique currency code.name(character): Short name.fullName(character): Full name.precision(integer): Decimal places.confirms(integer or NA): Block confirmations.contractAddress(character or NA): Primary contract address.isMarginEnabled(logical): Margin trading status.isDebitEnabled(logical): Debit status.
Chain-Specific Fields:
chainName(character or NA): Blockchain name.withdrawalMinSize(character or NA): Minimum withdrawal amount.depositMinSize(character or NA): Minimum deposit amount.withdrawFeeRate(character or NA): Withdrawal fee rate.withdrawalMinFee(character or NA): Minimum withdrawal fee.isWithdrawEnabled(logical or NA): Withdrawal enabled status.isDepositEnabled(logical or NA): Deposit enabled status.confirms(integer or NA): Chain-specific confirmations.preConfirms(integer or NA): Pre-confirmations.chain_contractAddress(character or NA): Chain-specific contract address.withdrawPrecision(integer or NA): Withdrawal precision.maxWithdraw(character or NA): Maximum withdrawal amount.maxDeposit(character or NA): Maximum deposit amount.needTag(logical or NA): Memo/tag requirement.chainId(character or NA): Blockchain identifier.depositFeeRate(character or NA): Deposit fee rate.withdrawMaxFee(character or NA): Maximum withdrawal fee.depositTierFee(character or NA): Tiered deposit fee.
Details
Workflow Overview
URL Assembly: Combines
base_urlwith/api/v3/currencies.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 the"data"field.Data Iteration: Loops through each currency, extracting summary fields and chain data (if present).
Result Assembly: Combines summary and chain data into a
data.table, adding dummy chain columns withNAif no chains exist.
Usage
Utilised to fetch comprehensive currency details, including multi-chain support, for market analysis or configuration.
Examples
if (FALSE) { # \dontrun{
main_async <- coro::async(function() {
currencies <- await(get_all_currencies_impl())
print(currencies)
})
main_async()
while (!later::loop_empty()) later::run_now()
} # }