Account & Subaccount

Documentation on interacting with a variety of OKX account and subaccount API endpoint functions through the PENDAX Javascript SDK.

All Account and Subaccount API endpoints require authentication. Please create OKX API keys to interact with these functions successfully.

Account

Get Balance

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-balancearrow-up-right

Function Name:

getBalances()

Usage:

import { createExchange } from "./exchanges/exchange.js";

  let myOkxAccount = createExchange({
      exchange: "okx",
      authenticate: true,
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "okx",
      marginType: "usdt"
});

async function getBalances(exchange, options) {
    try {
        let result = await exchange.getBalances(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await getBalances(myOkxAccount)

Get Positions

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-account-get-positionsarrow-up-right

Function Name:

Usage:

Get Positions History

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-account-get-positions-historyarrow-up-right

Function Name:

Usage:

Get Account and Position Risk

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-account-get-account-and-position-riskarrow-up-right

Function Name:

Usage:

Get Bills Details (last 7 days)

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-account-get-bills-details-last-7-daysarrow-up-right

Function Name:

Usage:

Get Bills Details (last 3 months)

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-account-get-bills-details-last-3-monthsarrow-up-right

Function Name:

Usage:

Get Account Configuration

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-account-get-account-configurationarrow-up-right

Function Name:

Usage:

Set Position Mode

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-account-set-position-modearrow-up-right

Function Name:

Usage:

Set Leverage

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-account-set-leveragearrow-up-right

Function Name:

Usage:

Get Maximum Buy/Sell Amount or Open Amount

circle-info

Function Name:

Usage:

Get Maximum Available Tradable Amount

circle-info

Function Name:

Usage:

Increase/Decrease Margin

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-account-increase-decrease-marginarrow-up-right

Function Name:

Usage:

Get Leverage

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-account-get-leveragearrow-up-right

Function Name:

Usage:

Get The Maximum Loan Of Instrument

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-account-get-the-maximum-loan-of-instrumentarrow-up-right

Function Name:

Usage:

Get Fee Rates

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-account-get-fee-ratesarrow-up-right

Function Name:

Usage:

Get Interest Accrued Data

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-account-get-interest-accrued-dataarrow-up-right

Function Name:

Usage:

Get Interest Rate

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-account-get-interest-ratearrow-up-right

Function Name:

Usage:

Set Greeks

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-account-set-greeks-pa-bsarrow-up-right

Function Name:

Usage:

Isolated Margin Trading Settings

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-account-isolated-margin-trading-settingsarrow-up-right

Function Name:

Usage:

Get Maximum Withdrawals

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-account-get-maximum-withdrawalsarrow-up-right

Function Name:

Usage:

Get Account Risk State

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-account-get-account-risk-statearrow-up-right

Function Name:

Usage:

VIP Loans Borrow and Repay

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-account-vip-loans-borrow-and-repayarrow-up-right

Function Name:

Usage:

Get Borrow and Repay History for VIP Loans

circle-info

Function Name:

Usage:

Get Borrow Interest and Limit

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-account-get-borrow-interest-and-limitarrow-up-right

Function Name:

Usage:

Position Builder

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-account-position-builderarrow-up-right

Function Name:

Usage:

Get Greeks

circle-info

Please refer to the official OKX API Docs for the required parameters.

https://www.okx.com/docs-v5/en/#rest-api-account-get-greeksarrow-up-right

Function Name:

Usage:

Subaccount

View Subaccount List

circle-info

Please refer to the official OKX API Docs for the required parameters.

https://www.okx.com/docs-v5/en/#rest-api-subaccount-view-sub-account-listarrow-up-right

Function Name:

Usage:

Get Subaccount Trading Balance

circle-info

Please refer to the official OKX API Docs for the required parameters.

https://www.okx.com/docs-v5/en/#rest-api-subaccount-get-sub-account-trading-balancearrow-up-right

Function Name:

Usage:

Get Subaccount Funding Balance

circle-info

Please refer to the official OKX API Docs for the required parameters.

https://www.okx.com/docs-v5/en/#rest-api-subaccount-get-sub-account-funding-balancearrow-up-right

Function Name:

Usage:

History of Subaccount Transfer

circle-info

Please refer to the official OKX API Docs for required parameters.

https://www.okx.com/docs-v5/en/#rest-api-subaccount-history-of-sub-account-transferarrow-up-right

Applies to master accounts only.

Function Name:

Usage:

Master Accounts Manage the Transfers Between Subaccounts

Function Name:

Usage:

Set Permission of Transfer Out

circle-info

Please refer to the official OKX API Docs for the required parameters.

https://www.okx.com/docs-v5/en/#rest-api-subaccount-set-permission-of-transfer-outarrow-up-right

Function Name:

Usage:

Get Custody Trading Subaccount List

circle-info

Please refer to the official OKX API Docs for the required parameters.

https://www.okx.com/docs-v5/en/#rest-api-subaccount-get-custody-trading-sub-account-listarrow-up-right

Function Name:

Usage:

Last updated