To interact with the Cede SDK, you need to create an instance of the SDK and register at least one exchange instance. Refer to the General info section for details.
Sub Accounts List
To retrieve all sub-accounts for a given exchange, use:
method: getSubAccounts
params:
exchangeInstanceId
-string
The exchange instance ID for which you want to fetch the sub accounts.auth
- The authentication object for the exchange. See authentication section for details.
response structure: Promise<{ uid: string }[]>
. The response is an array of sub-account UIDs. You should use the
provided identifiers to interact with sub-accounts.
const subAccounts = await cedeSDK.api.getSubAccounts({ exchangeInstanceId, auth });
Sub Account Balance
To fetch the balance of a sub-account on a given exchange, use:
method: getSubAccountBalances
params:
exchangeInstanceId
-string
The exchange instance ID for which you want to fetch the sub account balances.auth
- The authentication object for the exchange. See authentication section for details.uid
-string
The sub-account UID for which you want to fetch the balance. You can get the sub-account UID from the Sub Accounts List method.
response structure: Promise<SubAccountBalancesByWalletType>
, see
SubAccountBalancesByWalletType for details.
const balances = await cedeSDK.api.getSubAccountBalances({
exchangeInstanceId,
auth,
uid: "sub-account-uid-1"
});
Sub Account Transfer
To transfer funds between sub-account and master account on a given exchange, use:
method: subAccountTransfer
params:
exchangeInstanceId
-string
The exchange instance ID from which you want to execute the transferauth
- The authentication object for the exchange. See authentication section for details.tokenSymbol
-string
The token's symbol.amount
-string
The amount to transfer.fromUid
-string
The sub-account UID from which you want to transfer the funds. You can get the sub-account UID from the Sub Accounts List.toUid
-string
The sub-account UID to which you want to transfer the funds. You can get the sub-account UID from the Sub Accounts List.fromWalletType
-WalletType
The wallet type from which you want to transfer the funds. Currently, onlyWalletType.SPOT
is supported.toWalletType
-WalletType
The wallet type to which you want to transfer the funds. Currently, onlyWalletType.SPOT
is supported.
response structure: Promise<{ transferId: string }>
Note: The following exchanges require "master"
instead of master account UID:
- Gate.io
- MEXC
- Kucoin
- OKX
const transfer = await cedeSDK.api.subAccountTransfer({
exchangeInstanceId: masterExchangeInstanceId,
auth,
tokenSymbol: "USDC",
amount: "0.00001",
fromUid: "17280679",
toUid: "master",
fromWalletType: WalletType.SPOT,
toWalletType: WalletType.SPOT,
});