Skip to contents

Retrieves account summary information from the KuCoin API asynchronously. This internal function is designed for use within an R6 class and is not intended for direct end-user consumption. It fetches details such as VIP level, sub-account counts, and limits.

Usage

get_account_summary_info_impl(
  keys = get_api_keys(),
  base_url = get_base_url(),
  .__coro_env_parent__ = <environment>
)

Arguments

keys

List containing API configuration parameters from get_api_keys(), including:

  • api_key: Character string; your KuCoin API key.

  • api_secret: Character string; your KuCoin API secret.

  • api_passphrase: Character string; your KuCoin API passphrase.

  • key_version: Character string; API key version (e.g., "2"). Defaults to get_api_keys().

base_url

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

Value

Promise resolving to a data.table containing:

  • level (integer): User's VIP level.

  • subQuantity (integer): Total number of sub-accounts.

  • spotSubQuantity (integer): Number of spot trading sub-accounts.

  • marginSubQuantity (integer): Number of margin trading sub-accounts.

  • futuresSubQuantity (integer): Number of futures trading sub-accounts.

  • optionSubQuantity (integer): Number of option trading sub-accounts.

  • maxSubQuantity (integer): Maximum allowed sub-accounts (sum of maxDefaultSubQuantity and maxSpotSubQuantity).

  • maxDefaultSubQuantity (integer): Maximum default sub-accounts based on VIP level.

  • maxSpotSubQuantity (integer): Maximum additional spot sub-accounts.

  • maxMarginSubQuantity (integer): Maximum additional margin sub-accounts.

  • maxFuturesSubQuantity (integer): Maximum additional futures sub-accounts.

  • maxOptionSubQuantity (integer): Maximum additional option sub-accounts.

Details

Workflow Overview

  1. URL Construction: Combines the base URL (from get_base_url() or provided base_url) with the endpoint /api/v2/user-info.

  2. Header Preparation: Constructs authentication headers using build_headers() with the HTTP method, endpoint, and an empty request body.

  3. API Request: Sends a GET request to the KuCoin API with a 3-second timeout via httr::GET().

  4. Response Processing: Processes the response with process_kucoin_response() and converts the "data" field into a data.table.

API Endpoint

GET https://api.kucoin.com/api/v2/user-info

Usage

Utilised internally by the KucoinAccountAndFunding class to provide account summary data.

Official Documentation

KuCoin Get Account Summary Info

Examples

if (FALSE) { # \dontrun{
keys <- get_api_keys()
base_url <- "https://api.kucoin.com"
main_async <- coro::async(function() {
  dt <- await(get_account_summary_info_impl(keys = keys, base_url = base_url))
  print(dt)
})
main_async()
while (!later::loop_empty()) later::run_now()
} # }