Documentation
API Reference
Types
Balance

Type: Balances

Every balance is represented by a PortfolioBalanceEntry object:

type PortfolioBalanceEntry = {
  tokenName?: string;
  freeBalance: string;
  refFreeBalance: string;
  usedBalance: string;
  refUsedBalance: string;
  totalBalance: string;
  refTotalBalance: string;
  marginBalance?: {
    [symbol: string]: {
      freeBalance: string;
      totalBalance: string;
      type: "base" | "quote";
    };
  };
};

BalancesByWalletTypeV2

This type represents the balances returned by the Cede SDK for a given exchange instance.

type BalancesByWalletTypeV2 = {
  [walletType: string]: {
    [tokenSymbol: string]: PortfolioBalanceEntry;
  };
};
  • walletType - string
    The wallet type, one value from WalletType.
  • tokenSymbol - string
    The token's symbol.
  • freeBalance - number
    The balance able to be transfered, traded, sent without any action needed.
  • refFreeBalance - number
    The freeBalance value in american dollars.
  • usedBalance - number
    The balance that is currently being used in open orders, loans, etc.
  • refUsedBalance - number
    The usedBalance value in american dollars.
  • totalBalance - number
    The total balance of the token.
  • refTotalBalance - number
    The totalBalance value in american dollars.

BalancesWithTokensV2

This type represents the balances returned by the Cede SDK for a given exchange instance with token metadata.

type BalancesWithTokensV2 = Partial<{
  [walletType: string]: {
    [tokenSymbol: string]: {
      balance: PortfolioBalanceEntry;
      token: TokenWithMarketNetwork;
    };
  };
}>;

SubAccountBalancesByWalletTypeV2

This type represents the balances returned by the Cede SDK for a given sub-account.

type SubAccountBalancesByWalletTypeV2 = {
  [walletType: string]: {
    [tokenSymbol: string]: PortfolioBalanceEntry;
  };
};

MainSubAccountsBalancesWithTokensResponseV2

This type represents the balances returned by the Cede SDK for a given exchange instance with token metadata.

type MainSubAccountsBalancesWithTokensResponseV2 = {
  main: BalancesWithTokensV2;
  subAccounts: Record<string, BalancesWithTokensV2>;
};
  • main - BalancesWithTokensV2
    The main account balances with token metadata.
  • subAccounts - Record<string, BalancesWithTokensV2>
    The sub-accounts balances with token metadata.