Skip to contents

Fetches KuCoin API credentials from environment variables and returns them as a list. Expected environment variables are:

Usage

get_api_keys(
  api_key = Sys.getenv("KC-API-KEY"),
  api_secret = Sys.getenv("KC-API-SECRET"),
  api_passphrase = Sys.getenv("KC-API-PASSPHRASE"),
  key_version = "2"
)

Arguments

api_key

Character string; the KuCoin API key. Defaults to Sys.getenv("KC-API-KEY").

api_secret

Character string; the KuCoin API secret. Defaults to Sys.getenv("KC-API-SECRET").

api_passphrase

Character string; the KuCoin API passphrase. Defaults to Sys.getenv("KC-API-PASSPHRASE").

key_version

Character string; the API key version. Defaults to "2".

Value

List containing the API credentials: api_key, api_secret, api_passphrase, and key_version.

Details

  • KC-API-KEY: The API key.

  • KC-API-SECRET: The API secret.

  • KC-API-PASSPHRASE: The API passphrase.

  • KC-API-ENDPOINT: Optional base URL (handled by get_base_url()).

Includes a default API key version ("2"). These credentials are required for authenticated KuCoin API requests.

Examples

if (FALSE) { # \dontrun{
# Retrieve credentials from environment variables
config <- get_api_keys()
print(config)

# Specify credentials manually
config <- get_api_keys(
  api_key = "my_key",
  api_secret = "my_secret",
  api_passphrase = "my_pass",
  key_version = "2"
)
print(config)
} # }