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

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

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

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

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

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

Function Name:

Usage:

Get Positions History

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

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

Function Name:

Usage:

Get Account and Position Risk

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-risk

Function Name:

Usage:

Get Bills Details (last 7 days)

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-days

Function Name:

Usage:

Get Bills Details (last 3 months)

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-months

Function Name:

Usage:

Get Account Configuration

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

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

Function Name:

Usage:

Set Position Mode

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

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

Function Name:

Usage:

Set Leverage

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

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

Function Name:

Usage:

Get Maximum Buy/Sell Amount or Open Amount

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

https://www.okx.com/docs-v5/en/#rest-api-account-get-maximum-buy-sell-amount-or-open-amount

Function Name:

Usage:

Get Maximum Available Tradable Amount

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

https://www.okx.com/docs-v5/en/#rest-api-account-get-maximum-available-tradable-amount

Function Name:

Usage:

Increase/Decrease Margin

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

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

Function Name:

Usage:

Get Leverage

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

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

Function Name:

Usage:

Get The Maximum Loan Of Instrument

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-instrument

Function Name:

Usage:

Get Fee Rates

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

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

Function Name:

Usage:

Get Interest Accrued Data

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

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

Function Name:

Usage:

Get Interest Rate

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

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

Function Name:

Usage:

Set Greeks

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

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

Function Name:

Usage:

Isolated Margin Trading Settings

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

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

Function Name:

Usage:

Get Maximum Withdrawals

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

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

Function Name:

Usage:

Get Account Risk State

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

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

Function Name:

Usage:

VIP Loans Borrow and Repay

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-repay

Function Name:

Usage:

Get Borrow and Repay History for VIP Loans

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

https://www.okx.com/docs-v5/en/#rest-api-account-get-borrow-and-repay-history-for-vip-loans

Function Name:

Usage:

Get Borrow Interest and Limit

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-limit

Function Name:

Usage:

Position Builder

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

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

Function Name:

Usage:

Get Greeks

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

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

Function Name:

Usage:

Subaccount

View Subaccount List

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-list

Function Name:

Usage:

Get Subaccount Trading Balance

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-balance

Function Name:

Usage:

Get Subaccount Funding Balance

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-balance

Function Name:

Usage:

History of Subaccount Transfer

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-transfer

Applies to master accounts only.

Function Name:

Usage:

Master Accounts Manage the Transfers Between Subaccounts

Function Name:

Usage:

Set Permission of Transfer Out

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-out

Function Name:

Usage:

Get Custody Trading Subaccount List

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-list

Function Name:

Usage:

Last updated