Skip to content

Commit

Permalink
Rename.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereckmezquita committed Feb 21, 2025
1 parent 827e932 commit f62b686
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions R/KucoinAccountAndFunding.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#' - **get_account_summary_info():** Retrieves a comprehensive summary of the user's account.
#' - **get_apikey_info():** Retrieves detailed information about the API key.
#' - **get_spot_account_type():** Determines whether the spot account is high-frequency or low-frequency.
#' - **get_spot_account_dt(query):** Retrieves a list of all spot accounts with optional filters.
#' - **get_spot_account_list(query):** Retrieves a list of all spot accounts with optional filters.
#' - **get_spot_account_detail(accountId):** Retrieves detailed information for a specific spot account.
#' - **get_cross_margin_account(query):** Retrieves cross margin account information based on specified filters.
#' - **get_isolated_margin_account(query):** Retrieves isolated margin account data for specific trading pairs.
Expand Down Expand Up @@ -69,7 +69,7 @@
#' cat("Spot Account High-Frequency:", is_high_freq, "\n")
#'
#' # List spot accounts and filter for USDT main accounts
#' spot_accounts <- await(account$get_spot_account_dt(list(currency = "USDT", type = "main")))
#' spot_accounts <- await(account$get_spot_account_list(list(currency = "USDT", type = "main")))
#' print("Spot Accounts (USDT Main):")
#' print(spot_accounts)
#'
Expand Down Expand Up @@ -251,7 +251,7 @@ KucoinAccountAndFunding <- R6::R6Class(
#' Retrieve Spot Account List
#'
#' ### Description
#' Retrieves a list of all spot accounts associated with the KuCoin account asynchronously, with optional filters for currency and account type. This method returns financial metrics in a `data.table` and calls `get_spot_account_dt_impl`.
#' Retrieves a list of all spot accounts associated with the KuCoin account asynchronously, with optional filters for currency and account type. This method returns financial metrics in a `data.table` and calls `get_spot_account_list_impl`.
#'
#' ### Workflow Overview
#' 1. **URL Construction**: Combines the base URL with `/api/v1/accounts` and a query string from `build_query()`.
Expand Down Expand Up @@ -279,14 +279,14 @@ KucoinAccountAndFunding <- R6::R6Class(
#' - `balance` (numeric): Total funds.
#' - `available` (numeric): Available funds.
#' - `holds` (numeric): Funds on hold.
get_spot_account_dt = function(query = list()) {
return(get_spot_account_dt_impl(self$keys, self$base_url, query))
get_spot_account_list = function(query = list()) {
return(get_spot_account_list_impl(self$keys, self$base_url, query))
},

#' Retrieve Spot Account Details
#'
#' ### Description
#' Retrieves detailed financial metrics for a specific spot account identified by its `accountId` from the KuCoin API asynchronously. This method calls `get_spot_account_detail_impl` and requires an account ID, obtainable via `get_spot_account_dt()`.
#' Retrieves detailed financial metrics for a specific spot account identified by its `accountId` from the KuCoin API asynchronously. This method calls `get_spot_account_detail_impl` and requires an account ID, obtainable via `get_spot_account_list()`.
#'
#' ### Workflow Overview
#' 1. **URL Construction**: Embeds `accountId` into `/api/v1/accounts/{accountId}` and combines with the base URL.
Expand All @@ -303,7 +303,7 @@ KucoinAccountAndFunding <- R6::R6Class(
#' ### Official Documentation
#' [KuCoin Get Account Detail Spot](https://www.kucoin.com/docs-new/rest/account-info/account-funding/get-account-detail-spot)
#'
#' @param accountId Character string; unique account ID (e.g., from `get_spot_account_dt()`).
#' @param accountId Character string; unique account ID (e.g., from `get_spot_account_list()`).
#'
#' @return Promise resolving to a `data.table` containing:
#' - `currency` (character): Currency of the account.
Expand Down
12 changes: 6 additions & 6 deletions R/impl_account_account_and_funding.R
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ get_spot_account_type_impl <- coro::async(function(
#' base_url <- "https://api.kucoin.com"
#' query <- list(currency = "USDT", type = "main")
#' main_async <- coro::async(function() {
#' dt <- await(get_spot_account_dt_impl(keys = keys, base_url = base_url, query = query))
#' dt <- await(get_spot_account_list_impl(keys = keys, base_url = base_url, query = query))
#' print(dt)
#' })
#' main_async()
Expand All @@ -278,7 +278,7 @@ get_spot_account_type_impl <- coro::async(function(
#' @importFrom data.table data.table as.data.table rbindlist
#' @importFrom rlang abort
#' @export
get_spot_account_dt_impl <- coro::async(function(
get_spot_account_list_impl <- coro::async(function(
keys = get_api_keys(),
base_url = get_base_url(),
query = list()
Expand All @@ -293,10 +293,10 @@ get_spot_account_dt_impl <- coro::async(function(

url <- paste0(base_url, full_endpoint)
response <- httr::GET(url, headers, httr::timeout(3))
# saveRDS(response, "./api-responses/impl_account_account_and_funding/response-get_spot_account_dt_impl.ignore.Rds")
# saveRDS(response, "./api-responses/impl_account_account_and_funding/response-get_spot_account_list_impl.ignore.Rds")

parsed_response <- process_kucoin_response(response, url)
# saveRDS(parsed_response, "./api-responses/impl_account_account_and_funding/parsed_response-get_spot_account_dt_impl.Rds")
# saveRDS(parsed_response, "./api-responses/impl_account_account_and_funding/parsed_response-get_spot_account_list_impl.Rds")
account_dt <- data.table::rbindlist(parsed_response$data)

if (nrow(account_dt) == 0) {
Expand All @@ -321,7 +321,7 @@ get_spot_account_dt_impl <- coro::async(function(

return(account_dt)
}, error = function(e) {
rlang::abort(paste("Error in get_spot_account_dt_impl:", conditionMessage(e)))
rlang::abort(paste("Error in get_spot_account_list_impl:", conditionMessage(e)))
})
})

Expand Down Expand Up @@ -351,7 +351,7 @@ get_spot_account_dt_impl <- coro::async(function(
#' - `key_version`: Character string; API key version (e.g., `"2"`).
#' Defaults to `get_api_keys()`.
#' @param base_url Character string representing the base URL for the API. Defaults to `get_base_url()`.
#' @param accountId Character string; unique account ID (e.g., from `get_spot_account_dt()`).
#' @param accountId Character string; unique account ID (e.g., from `get_spot_account_detail_impl()`).
#' @return Promise resolving to a `data.table` containing:
#' - `currency` (character): Currency of the account.
#' - `balance` (numeric): Total funds.
Expand Down

0 comments on commit f62b686

Please sign in to comment.