Skip to contents

KucoinAccount: Account and Funding Management

KucoinAccount: Account and Funding Management

Details

Provides methods for querying account information, balances, and ledger history on KuCoin. Inherits from KucoinBase.

Purpose and Scope

  • Account Summary: Retrieve VIP level, sub-account count, and general account metadata.

  • API Key Inspection: Query permissions, IP whitelist, and expiry for the active API key.

  • Spot Accounts: List all spot/margin/trade accounts with balances, or inspect a single account by ID.

  • Margin Accounts: Retrieve cross-margin and isolated-margin account details including liability and asset info.

  • Ledger History: Paginated transaction history across spot and margin accounts with datetime conversion.

Usage

All methods require authentication (valid API key, secret, passphrase set via environment variables or passed to the constructor). The class supports both synchronous and asynchronous (coro/promises) operation modes inherited from KucoinBase.

# Synchronous usage
account <- KucoinAccount$new()
summary <- account$get_summary()
print(summary)

# Asynchronous usage
account_async <- KucoinAccount$new(async = TRUE)
main <- coro::async(function() {
  summary <- await(account_async$get_summary())
  print(summary)
})
main()
while (!later::loop_empty()) later::run_now()

Official Documentation

KuCoin Account Funding

Endpoints Covered

MethodEndpointHTTP
get_summaryGET /api/v2/user-infoGET
get_apikey_infoGET /api/v1/user/api-keyGET
get_spot_account_typeGET /api/v1/hf/accounts/openedGET
get_spot_accountsGET /api/v1/accountsGET
get_spot_account_detailGET /api/v1/accounts/{accountId}GET
get_cross_margin_accountGET /api/v3/margin/accountsGET
get_isolated_margin_accountGET /api/v3/isolated/accountsGET
get_spot_ledgerGET /api/v1/accounts/ledgersGET
get_hf_ledgerGET /api/v1/hf/accounts/ledgersGET
get_base_fee_rateGET /api/v1/base-feeGET
get_fee_rateGET /api/v1/trade-feesGET

Super class

kucoin::KucoinBase -> KucoinAccount

Methods

Inherited methods


Method get_summary()

Get Account Summary

Retrieves account summary information including VIP level, sub-account count, and general account metadata for the authenticated user.

Workflow

  1. Request: Authenticated GET to the user-info endpoint.

  2. Parsing: Converts the response into a single-row data.table.

API Endpoint

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

Official Documentation

KuCoin Get Account Summary

Verified: 2026-02-01

Automated Trading Usage

  • VIP Tier Monitoring: Check level to confirm fee tier before placing large orders.

  • Sub-Account Awareness: Use sub_quantity to verify sub-account count for multi-strategy bots.

  • Rate Limit Planning: Higher VIP levels receive more generous rate limits; adjust request frequency accordingly.

curl

curl --location --request GET 'https://api.kucoin.com/api/v2/user-info' \
  --header 'KC-API-KEY: your-api-key' \
  --header 'KC-API-SIGN: your-signature' \
  --header 'KC-API-TIMESTAMP: 1729176273859' \
  --header 'KC-API-PASSPHRASE: your-passphrase' \
  --header 'KC-API-KEY-VERSION: 2'

JSON Response

{
  "code": "200000",
  "data": {
    "level": 1,
    "subQuantity": 3,
    "maxDefaultSubQuantity": 5,
    "maxSubQuantity": 5,
    "spotSubQuantity": 2,
    "marginSubQuantity": 1,
    "futuresSubQuantity": 0,
    "optionSubQuantity": 0,
    "maxSpotSubQuantity": 5,
    "maxMarginSubQuantity": 5,
    "maxFuturesSubQuantity": 5,
    "maxOptionSubQuantity": 5
  }
}

Usage

KucoinAccount$get_summary()

Returns

data.table (or promise<data.table> if constructed with async = TRUE) with columns: level (integer, VIP tier), sub_quantity (integer, total sub-accounts), max_default_sub_quantity (integer), max_sub_quantity (integer), spot_sub_quantity (integer), margin_sub_quantity (integer), futures_sub_quantity (integer), option_sub_quantity (integer), max_spot_sub_quantity (integer), max_margin_sub_quantity (integer), max_futures_sub_quantity (integer), max_option_sub_quantity (integer).

Examples

\dontrun{
account <- KucoinAccount$new()
summary <- account$get_summary()
cat("VIP Level:", summary$level, "\\n")
cat("Sub-accounts:", summary$sub_quantity, "/", summary$max_sub_quantity, "\\n")
}


Method get_apikey_info()

Get API Key Info

Retrieves detailed information about the currently authenticated API key, including its permissions, IP whitelist, creation date, and associated UID.

Workflow

  1. Request: Authenticated GET to the api-key endpoint.

  2. Parsing: Converts the response into a single-row data.table.

API Endpoint

GET https://api.kucoin.com/api/v1/user/api-key

Official Documentation

KuCoin Get API Key Info

Verified: 2026-02-01

Automated Trading Usage

  • Permission Verification: Confirm the key has Trade permission before placing orders in a bot startup routine.

  • IP Whitelist Check: Validate that the bot's server IP is in is_master/ip_whitelist to avoid auth failures.

  • Key Rotation Monitoring: Use created_at to track key age and schedule rotation for security.

curl

curl --location --request GET 'https://api.kucoin.com/api/v1/user/api-key' \
  --header 'KC-API-KEY: your-api-key' \
  --header 'KC-API-SIGN: your-signature' \
  --header 'KC-API-TIMESTAMP: 1729176273859' \
  --header 'KC-API-PASSPHRASE: your-passphrase' \
  --header 'KC-API-KEY-VERSION: 2'

JSON Response

{
  "code": "200000",
  "data": {
    "remark": "trading-bot",
    "apiKey": "670c42f1a24b1b0001a5c7e0",
    "apiVersion": 3,
    "permission": "General,Spot",
    "ipWhitelist": "198.51.100.42",
    "createdAt": 1728905969000,
    "uid": 123456789,
    "isMaster": true
  }
}

Usage

KucoinAccount$get_apikey_info()

Returns

data.table (or promise<data.table> if constructed with async = TRUE) with columns: remark (character, key label), api_key (character, API key ID), api_version (integer, key version), permission (character, comma-separated permissions e.g. "General,Spot"), ip_whitelist (character, allowed IPs), created_at (numeric, epoch ms), uid (numeric, user ID), is_master (logical, TRUE if master account key).

Examples

\dontrun{
account <- KucoinAccount$new()
key_info <- account$get_apikey_info()
cat("Permissions:", key_info$permission, "\\n")
cat("IP Whitelist:", key_info$ip_whitelist, "\\n")
cat("Is Master:", key_info$is_master, "\\n")
}


Method get_spot_account_type()

Get Spot Account Types

Retrieves the account types that have been opened for HF (High-Frequency) spot trading. This indicates which account categories are active.

Workflow

  1. Request: Authenticated GET to the HF accounts opened endpoint.

  2. Parsing: If a named list is returned, converts to a single-row data.table. If a list of entries is returned, row-binds into a multi-row data.table. Returns an empty data.table if no accounts are opened.

API Endpoint

GET https://api.kucoin.com/api/v1/hf/accounts/opened

Official Documentation

KuCoin Get Spot Account Type

Verified: 2026-02-01

Automated Trading Usage

  • Pre-Trade Validation: Confirm HF trading accounts are opened before submitting HF orders.

  • Account Provisioning: Detect missing account types at bot startup and alert the operator.

  • Multi-Account Bots: Verify that both trade and margin types are available for strategies that span both.

curl

curl --location --request GET 'https://api.kucoin.com/api/v1/hf/accounts/opened' \
  --header 'KC-API-KEY: your-api-key' \
  --header 'KC-API-SIGN: your-signature' \
  --header 'KC-API-TIMESTAMP: 1729176273859' \
  --header 'KC-API-PASSPHRASE: your-passphrase' \
  --header 'KC-API-KEY-VERSION: 2'

JSON Response

{
  "code": "200000",
  "data": {
    "type": "trade",
    "isOpened": true
  }
}

Usage

KucoinAccount$get_spot_account_type()

Returns

data.table (or promise<data.table> if constructed with async = TRUE) with columns: type (character, account type e.g. "trade"), is_opened (logical, whether the account type is active). Returns an empty data.table if no account types are found.

Examples

\dontrun{
account <- KucoinAccount$new()
types <- account$get_spot_account_type()
print(types)
# Check if trade account is opened
if (nrow(types) > 0 && any(types$is_opened)) {
  cat("HF trading account is active.\n")
}
}


Method get_spot_accounts()

Get Spot Account List

Retrieves all spot accounts for the authenticated user, optionally filtered by currency or account type. Each row represents a single account with its current balance, available funds, and holds.

Workflow

  1. Request: Authenticated GET with optional query filters.

  2. Parsing: Row-binds the list of account objects into a data.table. Returns an empty data.table if no accounts match the filter.

API Endpoint

GET https://api.kucoin.com/api/v1/accounts

Official Documentation

KuCoin Get Spot Account List

Verified: 2026-02-01

Automated Trading Usage

  • Balance Checks: Query available funds before placing orders to avoid insufficient balance errors.

  • Portfolio Snapshot: Retrieve all account balances periodically for portfolio tracking and rebalancing.

  • Filter by Type: Use query = list(type = "trade") to get only trading account balances for order sizing.

curl

curl --location --request GET 'https://api.kucoin.com/api/v1/accounts?currency=USDT&type=trade' \
  --header 'KC-API-KEY: your-api-key' \
  --header 'KC-API-SIGN: your-signature' \
  --header 'KC-API-TIMESTAMP: 1729176273859' \
  --header 'KC-API-PASSPHRASE: your-passphrase' \
  --header 'KC-API-KEY-VERSION: 2'

JSON Response

{
  "code": "200000",
  "data": [
    {
      "id": "5bd6e9286d99522a52e458de",
      "currency": "USDT",
      "type": "trade",
      "balance": "1250.75",
      "available": "1200.50",
      "holds": "50.25"
    },
    {
      "id": "5bd6e9286d99522a52e458df",
      "currency": "BTC",
      "type": "trade",
      "balance": "0.05123",
      "available": "0.05123",
      "holds": "0"
    }
  ]
}

Usage

KucoinAccount$get_spot_accounts(query = list())

Arguments

query

Named list; optional filter parameters. Supported keys:

  • currency (character): Filter by currency code e.g. "USDT", "BTC".

  • type (character): Filter by account type: "main", "trade", or "margin".

Returns

data.table (or promise<data.table> if constructed with async = TRUE) with columns: id (character, account ID), currency (character, currency code), type (character, account type), balance (character, total balance), available (character, available for trading), holds (character, amount on hold in open orders). Returns an empty data.table if no accounts match.

Examples

\dontrun{
account <- KucoinAccount$new()

# Get all accounts
all_accounts <- account$get_spot_accounts()
print(all_accounts)

# Get only USDT trade accounts
usdt <- account$get_spot_accounts(query = list(currency = "USDT", type = "trade"))
cat("USDT available:", usdt$available, "\\n")
}


Method get_spot_account_detail()

Get Spot Account Detail

Retrieves detailed information for a single specific account identified by its account ID. Returns currency, type, balance, available, and holds.

Workflow

  1. Request: Authenticated GET with the account ID appended to the path.

  2. Parsing: Converts the response into a single-row data.table.

API Endpoint

GET https://api.kucoin.com/api/v1/accounts/{accountId}

Official Documentation

KuCoin Get Spot Account Detail

Verified: 2026-02-01

Automated Trading Usage

  • Precise Balance Check: Query a specific account by ID when you already know the account to avoid parsing lists.

  • Post-Trade Verification: After an order fills, query the relevant account to confirm balance changes.

  • Hold Monitoring: Check holds to understand how much capital is locked in open orders.

curl

curl --location --request GET 'https://api.kucoin.com/api/v1/accounts/5bd6e9286d99522a52e458de' \
  --header 'KC-API-KEY: your-api-key' \
  --header 'KC-API-SIGN: your-signature' \
  --header 'KC-API-TIMESTAMP: 1729176273859' \
  --header 'KC-API-PASSPHRASE: your-passphrase' \
  --header 'KC-API-KEY-VERSION: 2'

JSON Response

{
  "code": "200000",
  "data": {
    "currency": "USDT",
    "balance": "1250.75",
    "available": "1200.50",
    "holds": "50.25"
  }
}

Usage

KucoinAccount$get_spot_account_detail(accountId)

Arguments

accountId

Character; the unique account ID (e.g. "5bd6e9286d99522a52e458de"). Obtain account IDs from get_spot_accounts().

Returns

data.table (or promise<data.table> if constructed with async = TRUE) with columns: currency (character, currency code), balance (character, total balance), available (character, available for use), holds (character, amount held in open orders).

Examples

\dontrun{
account <- KucoinAccount$new()

# First get all accounts to find the ID
accounts <- account$get_spot_accounts(query = list(currency = "USDT", type = "trade"))
account_id <- accounts$id[1]

# Then query the specific account
detail <- account$get_spot_account_detail(account_id)
cat("Balance:", detail$balance, "Available:", detail$available, "\\n")
}


Method get_cross_margin_account()

Get Cross Margin Account

Retrieves cross margin account information including balances, liabilities, and asset details for all currencies held in the cross margin account.

Workflow

  1. Request: Authenticated GET with optional query filters.

  2. Parsing: Extracts the accounts sub-list from the response and row-binds into a data.table. Returns empty data.table if no accounts found.

API Endpoint

GET https://api.kucoin.com/api/v3/margin/accounts

Official Documentation

KuCoin Get Cross Margin Account

Verified: 2026-02-01

Automated Trading Usage

  • Margin Risk Monitoring: Check liability and totalAsset to compute margin ratio and trigger de-risk actions.

  • Borrowing Capacity: Use available_balance to determine how much additional margin is available before placing leveraged orders.

  • Cross-Margin Rebalancing: Periodically query to detect imbalanced positions and repay liabilities automatically.

curl

curl --location --request GET 'https://api.kucoin.com/api/v3/margin/accounts?quoteCurrency=USDT&queryType=MARGIN' \
  --header 'KC-API-KEY: your-api-key' \
  --header 'KC-API-SIGN: your-signature' \
  --header 'KC-API-TIMESTAMP: 1729176273859' \
  --header 'KC-API-PASSPHRASE: your-passphrase' \
  --header 'KC-API-KEY-VERSION: 2'

JSON Response

{
  "code": "200000",
  "data": {
    "totalAssetOfQuoteCurrency": "15234.67",
    "totalLiabilityOfQuoteCurrency": "2500.00",
    "debtRatio": "0.1641",
    "status": "EFFECTIVE",
    "accounts": [
      {
        "currency": "USDT",
        "totalBalance": "10000.00",
        "availableBalance": "8500.00",
        "holdBalance": "1500.00",
        "liability": "2500.00",
        "maxBorrowSize": "50000.00",
        "borrowEnabled": true,
        "transferInEnabled": true
      },
      {
        "currency": "BTC",
        "totalBalance": "0.15",
        "availableBalance": "0.15",
        "holdBalance": "0",
        "liability": "0",
        "maxBorrowSize": "2.5",
        "borrowEnabled": true,
        "transferInEnabled": true
      }
    ]
  }
}

Usage

KucoinAccount$get_cross_margin_account(query = list())

Arguments

query

Named list; optional filter parameters. Supported keys:

  • quoteCurrency (character): Quote currency for valuation e.g. "USDT", "BTC".

  • queryType (character): Query type e.g. "MARGIN", "MARGIN_V2".

Returns

data.table (or promise<data.table> if constructed with async = TRUE) with columns: currency (character), total_balance (character), available_balance (character), hold_balance (character), liability (character), max_borrow_size (character), borrow_enabled (logical), transfer_in_enabled (logical). Returns an empty data.table if no margin accounts exist.

Examples

\dontrun{
account <- KucoinAccount$new()
margin <- account$get_cross_margin_account(query = list(quoteCurrency = "USDT"))
print(margin)
# Check debt ratio
cat("Liabilities:", margin[currency == "USDT", liability], "\\n")
}


Method get_isolated_margin_account()

Get Isolated Margin Account

Retrieves isolated margin account information for specific trading pairs. Each isolated margin account is tied to a single symbol and has independent balances, liabilities, and risk parameters.

Workflow

  1. Request: Authenticated GET with optional query filters.

  2. Parsing: Extracts the assets sub-list from the response and row-binds into a data.table. Returns empty data.table if no assets found.

API Endpoint

GET https://api.kucoin.com/api/v3/isolated/accounts

Official Documentation

KuCoin Get Isolated Margin Account

Verified: 2026-02-01

Automated Trading Usage

  • Per-Pair Risk Management: Monitor isolated margin ratios per symbol to trigger stop-loss or de-leverage actions independently.

  • Position Sizing: Use available_balance for the specific trading pair to size new margin orders correctly.

  • Liquidation Prevention: Compare debt_ratio against liquidation thresholds and add margin or reduce positions automatically.

curl

curl --location --request GET 'https://api.kucoin.com/api/v3/isolated/accounts?symbol=BTC-USDT&quoteCurrency=USDT&queryType=ISOLATED' \
  --header 'KC-API-KEY: your-api-key' \
  --header 'KC-API-SIGN: your-signature' \
  --header 'KC-API-TIMESTAMP: 1729176273859' \
  --header 'KC-API-PASSPHRASE: your-passphrase' \
  --header 'KC-API-KEY-VERSION: 2'

JSON Response

{
  "code": "200000",
  "data": {
    "totalAssetOfQuoteCurrency": "5234.67",
    "totalLiabilityOfQuoteCurrency": "1000.00",
    "timestamp": 1729176273859,
    "assets": [
      {
        "symbol": "BTC-USDT",
        "status": "EFFECTIVE",
        "debtRatio": "0.1912",
        "baseAsset": {
          "currency": "BTC",
          "totalBalance": "0.1",
          "holdBalance": "0",
          "availableBalance": "0.1",
          "liability": "0",
          "interest": "0",
          "borrowableAmount": "1.5"
        },
        "quoteAsset": {
          "currency": "USDT",
          "totalBalance": "5000.00",
          "holdBalance": "500.00",
          "availableBalance": "4500.00",
          "liability": "1000.00",
          "interest": "0.42",
          "borrowableAmount": "25000.00"
        }
      }
    ]
  }
}

Usage

KucoinAccount$get_isolated_margin_account(query = list())

Arguments

query

Named list; optional filter parameters. Supported keys:

  • symbol (character): Trading pair e.g. "BTC-USDT". Filter to a specific pair.

  • quoteCurrency (character): Quote currency for valuation e.g. "USDT".

  • queryType (character): Query type e.g. "ISOLATED", "ISOLATED_V2".

Returns

data.table (or promise<data.table> if constructed with async = TRUE) with columns: Columns are flattened from the nested response and may include: symbol (character), status (character), debt_ratio (character), and nested base_asset.* and quote_asset.* fields (currency, total_balance, hold_balance, available_balance, liability, interest, borrowable_amount). Returns an empty data.table if no isolated margin accounts exist.

Examples

\dontrun{
account <- KucoinAccount$new()
isolated <- account$get_isolated_margin_account(
  query = list(symbol = "BTC-USDT", quoteCurrency = "USDT")
)
print(isolated)
}


Method get_spot_ledger()

Get Spot Account Ledger

Retrieves paginated account ledger (transaction history) for spot and margin accounts. Each entry represents a balance change event such as a trade fill, deposit, withdrawal, transfer, or fee charge. Automatically converts the created_at millisecond timestamp to a datetime_created POSIXct column.

Workflow

  1. Pagination: Calls the internal $.paginate() method which fetches successive pages until all results are retrieved or max_pages is reached.

  2. Flattening: Combines all pages into a single data.table via flatten_pages().

  3. Datetime Conversion: If created_at is present, adds a datetime_created column by converting epoch milliseconds to POSIXct.

API Endpoint

GET https://api.kucoin.com/api/v1/accounts/ledgers

Official Documentation

KuCoin Get Account Ledger Spot/Margin

Verified: 2026-02-01

Automated Trading Usage

  • Trade Reconciliation: Compare ledger entries against expected fills to verify order execution integrity.

  • Fee Tracking: Filter by bizType = "Exchange" to aggregate trading fees for cost analysis.

  • Audit Trail: Fetch full ledger history with max_pages = Inf for end-of-day accounting and compliance.

curl

curl --location --request GET 'https://api.kucoin.com/api/v1/accounts/ledgers?currency=USDT&direction=in&bizType=Exchange&pageSize=50&currentPage=1' \
  --header 'KC-API-KEY: your-api-key' \
  --header 'KC-API-SIGN: your-signature' \
  --header 'KC-API-TIMESTAMP: 1729176273859' \
  --header 'KC-API-PASSPHRASE: your-passphrase' \
  --header 'KC-API-KEY-VERSION: 2'

JSON Response

{
  "code": "200000",
  "data": {
    "currentPage": 1,
    "pageSize": 50,
    "totalNum": 2,
    "totalPage": 1,
    "items": [
      {
        "id": "611a1e7c6a053300067a88de",
        "currency": "USDT",
        "amount": "125.50",
        "fee": "0.1255",
        "balance": "3750.25",
        "accountType": "TRADE",
        "bizType": "Exchange",
        "direction": "in",
        "createdAt": 1729176273859,
        "context": "{\"orderId\":\"670fd33bf9406e0007ab3945\",\"symbol\":\"BTC-USDT\"}"
      },
      {
        "id": "611a1e7c6a053300067a88df",
        "currency": "USDT",
        "amount": "50.00",
        "fee": "0",
        "balance": "3624.75",
        "accountType": "TRADE",
        "bizType": "Transfer",
        "direction": "out",
        "createdAt": 1729170000000,
        "context": "{\"description\":\"Transfer to main account\"}"
      }
    ]
  }
}

Usage

KucoinAccount$get_spot_ledger(query = list(), page_size = 50, max_pages = Inf)

Arguments

query

Named list; optional filter parameters. Supported keys:

  • currency (character): Filter by currency code e.g. "USDT", "BTC".

  • direction (character): Filter by direction: "in" or "out".

  • bizType (character): Business type filter e.g. "Exchange", "Deposit", "Withdrawal", "Transfer", "Trade_Exchange".

  • startAt (numeric): Start time in milliseconds (epoch). Inclusive.

  • endAt (numeric): End time in milliseconds (epoch). Inclusive.

page_size

Integer; number of results per page, between 10 and 500. Default 50.

max_pages

Numeric; maximum number of pages to fetch. Default Inf (fetch all pages). Set to a finite number to limit API calls.

Returns

data.table (or promise<data.table> if constructed with async = TRUE) with columns: id (character, ledger entry ID), currency (character), amount (character, transaction amount), fee (character, fee charged), balance (character, balance after transaction), account_type (character, e.g. "TRADE", "MAIN"), biz_type (character, business type), direction (character, "in" or "out"), context (character, JSON metadata), datetime_created (POSIXct, converted from created_at). Returns an empty data.table if no ledger entries match.

Examples

\dontrun{
account <- KucoinAccount$new()

# Get recent USDT trade ledger entries
ledger <- account$get_spot_ledger(
  query = list(currency = "USDT", bizType = "Exchange"),
  page_size = 100,
  max_pages = 5
)
print(ledger)

# Get all ledger entries for the last 24 hours
now_ms <- as.numeric(lubridate::now()) * 1000
ledger_24h <- account$get_spot_ledger(
  query = list(startAt = now_ms - 86400000, endAt = now_ms)
)
print(ledger_24h[, .(currency, amount, direction, datetime_created)])
}


Method get_hf_ledger()

Get HF Trading Account Ledger

Retrieves transfer records from high-frequency trading accounts. Results are sorted by creation timestamp in descending order. Data is limited to a rolling 7-day window.

API Endpoint

GET https://api.kucoin.com/api/v1/hf/accounts/ledgers

Official Documentation

KuCoin Get Account Ledgers Trade_hf

Verified: 2026-02-03

Automated Trading Usage

  • PnL Tracking: Filter by bizType = "TRADE_EXCHANGE" to track trading gains/losses.

  • Fee Reconciliation: Use fee and tax fields for accurate fee accounting.

  • Audit Trail: Build trade-by-trade logs from the context JSON field.

Usage

KucoinAccount$get_hf_ledger(
  currency = NULL,
  direction = NULL,
  bizType = NULL,
  lastId = NULL,
  limit = NULL,
  startAt = NULL,
  endAt = NULL
)

Arguments

currency

Character or NULL; filter by currency (supports up to 10 comma-separated).

direction

Character or NULL; "in" or "out".

bizType

Character or NULL; transaction type: "TRADE_EXCHANGE", "TRANSFER", "SUB_TRANSFER", "RETURNED_FEES", "DEDUCTION_FEES", "OTHER".

lastId

Character or NULL; pagination cursor for fetching previous batches.

limit

Integer or NULL; results per page (default 100, max 200).

startAt

Integer or NULL; start timestamp in milliseconds.

endAt

Integer or NULL; end timestamp in milliseconds.

Returns

data.table (or promise<data.table> if constructed with async = TRUE) with columns: id (character), currency (character), amount (character), fee (character), tax (character), balance (character), account_type (character), biz_type (character), direction (character), context (character), datetime_created (POSIXct).

Examples

\dontrun{
account <- KucoinAccount$new()
hf <- account$get_hf_ledger(currency = "USDT", bizType = "TRADE_EXCHANGE")
print(hf[, .(currency, amount, fee, direction, datetime_created)])
}


Method get_base_fee_rate()

Get Base Fee Rate

Retrieves the base (tier default) taker and maker fee rates for spot/margin trading. This is the account's default rate before any per-symbol discounts.

API Endpoint

GET https://api.kucoin.com/api/v1/base-fee

Official Documentation

KuCoin Get Basic Fee

Verified: 2026-02-03

Automated Trading Usage

  • Tier Awareness: Know your default fee tier for cost estimation.

  • Fee Budgeting: Use as baseline for worst-case fee calculations.

Usage

KucoinAccount$get_base_fee_rate(currencyType = NULL)

Arguments

currencyType

Integer or NULL; 0 for crypto (default), 1 for fiat.

Returns

data.table (or promise<data.table> if constructed with async = TRUE) with columns:

  • taker_fee_rate (character): Base taker fee rate.

  • maker_fee_rate (character): Base maker fee rate.

Examples

\dontrun{
account <- KucoinAccount$new()
fees <- account$get_base_fee_rate()
cat("Taker:", fees$taker_fee_rate, "Maker:", fees$maker_fee_rate, "\n")
}


Method get_fee_rate()

Get Actual Fee Rate

Retrieves the actual (per-symbol) taker and maker fee rates after VIP/KCS discounts. Supports up to 10 trading pairs per request.

API Endpoint

GET https://api.kucoin.com/api/v1/trade-fees

Official Documentation

KuCoin Get Actual Fee

Verified: 2026-02-03

Automated Trading Usage

  • Precise PnL: Use actual rates for accurate profit/loss calculations.

  • Fee Optimization: Compare rates across pairs to choose the cheapest execution venue.

  • Batch Query: Query up to 10 pairs at once to minimize API calls.

Usage

KucoinAccount$get_fee_rate(symbols)

Arguments

symbols

Character; comma-separated trading pairs (max 10), e.g. "BTC-USDT,ETH-USDT".

Returns

data.table (or promise<data.table> if constructed with async = TRUE) with columns:

  • symbol (character): Trading pair.

  • taker_fee_rate (character): Actual taker fee rate.

  • maker_fee_rate (character): Actual maker fee rate.

Examples

\dontrun{
account <- KucoinAccount$new()
fees <- account$get_fee_rate("BTC-USDT,ETH-USDT")
print(fees[, .(symbol, taker_fee_rate, maker_fee_rate)])
}


Method clone()

The objects of this class are cloneable with this method.

Usage

KucoinAccount$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

if (FALSE) { # \dontrun{
# Synchronous
account <- KucoinAccount$new()
summary <- account$get_summary()
print(summary)

# Asynchronous
account_async <- KucoinAccount$new(async = TRUE)
main <- coro::async(function() {
  summary <- await(account_async$get_summary())
  print(summary)
})
main()
while (!later::loop_empty()) later::run_now()
} # }


## ------------------------------------------------
## Method `KucoinAccount$get_summary`
## ------------------------------------------------

if (FALSE) { # \dontrun{
account <- KucoinAccount$new()
summary <- account$get_summary()
cat("VIP Level:", summary$level, "\\n")
cat("Sub-accounts:", summary$sub_quantity, "/", summary$max_sub_quantity, "\\n")
} # }

## ------------------------------------------------
## Method `KucoinAccount$get_apikey_info`
## ------------------------------------------------

if (FALSE) { # \dontrun{
account <- KucoinAccount$new()
key_info <- account$get_apikey_info()
cat("Permissions:", key_info$permission, "\\n")
cat("IP Whitelist:", key_info$ip_whitelist, "\\n")
cat("Is Master:", key_info$is_master, "\\n")
} # }

## ------------------------------------------------
## Method `KucoinAccount$get_spot_account_type`
## ------------------------------------------------

if (FALSE) { # \dontrun{
account <- KucoinAccount$new()
types <- account$get_spot_account_type()
print(types)
# Check if trade account is opened
if (nrow(types) > 0 && any(types$is_opened)) {
  cat("HF trading account is active.\n")
}
} # }

## ------------------------------------------------
## Method `KucoinAccount$get_spot_accounts`
## ------------------------------------------------

if (FALSE) { # \dontrun{
account <- KucoinAccount$new()

# Get all accounts
all_accounts <- account$get_spot_accounts()
print(all_accounts)

# Get only USDT trade accounts
usdt <- account$get_spot_accounts(query = list(currency = "USDT", type = "trade"))
cat("USDT available:", usdt$available, "\\n")
} # }

## ------------------------------------------------
## Method `KucoinAccount$get_spot_account_detail`
## ------------------------------------------------

if (FALSE) { # \dontrun{
account <- KucoinAccount$new()

# First get all accounts to find the ID
accounts <- account$get_spot_accounts(query = list(currency = "USDT", type = "trade"))
account_id <- accounts$id[1]

# Then query the specific account
detail <- account$get_spot_account_detail(account_id)
cat("Balance:", detail$balance, "Available:", detail$available, "\\n")
} # }

## ------------------------------------------------
## Method `KucoinAccount$get_cross_margin_account`
## ------------------------------------------------

if (FALSE) { # \dontrun{
account <- KucoinAccount$new()
margin <- account$get_cross_margin_account(query = list(quoteCurrency = "USDT"))
print(margin)
# Check debt ratio
cat("Liabilities:", margin[currency == "USDT", liability], "\\n")
} # }

## ------------------------------------------------
## Method `KucoinAccount$get_isolated_margin_account`
## ------------------------------------------------

if (FALSE) { # \dontrun{
account <- KucoinAccount$new()
isolated <- account$get_isolated_margin_account(
  query = list(symbol = "BTC-USDT", quoteCurrency = "USDT")
)
print(isolated)
} # }

## ------------------------------------------------
## Method `KucoinAccount$get_spot_ledger`
## ------------------------------------------------

if (FALSE) { # \dontrun{
account <- KucoinAccount$new()

# Get recent USDT trade ledger entries
ledger <- account$get_spot_ledger(
  query = list(currency = "USDT", bizType = "Exchange"),
  page_size = 100,
  max_pages = 5
)
print(ledger)

# Get all ledger entries for the last 24 hours
now_ms <- as.numeric(lubridate::now()) * 1000
ledger_24h <- account$get_spot_ledger(
  query = list(startAt = now_ms - 86400000, endAt = now_ms)
)
print(ledger_24h[, .(currency, amount, direction, datetime_created)])
} # }

## ------------------------------------------------
## Method `KucoinAccount$get_hf_ledger`
## ------------------------------------------------

if (FALSE) { # \dontrun{
account <- KucoinAccount$new()
hf <- account$get_hf_ledger(currency = "USDT", bizType = "TRADE_EXCHANGE")
print(hf[, .(currency, amount, fee, direction, datetime_created)])
} # }

## ------------------------------------------------
## Method `KucoinAccount$get_base_fee_rate`
## ------------------------------------------------

if (FALSE) { # \dontrun{
account <- KucoinAccount$new()
fees <- account$get_base_fee_rate()
cat("Taker:", fees$taker_fee_rate, "Maker:", fees$maker_fee_rate, "\n")
} # }

## ------------------------------------------------
## Method `KucoinAccount$get_fee_rate`
## ------------------------------------------------

if (FALSE) { # \dontrun{
account <- KucoinAccount$new()
fees <- account$get_fee_rate("BTC-USDT,ETH-USDT")
print(fees[, .(symbol, taker_fee_rate, maker_fee_rate)])
} # }