Funding

Documentation on interacting with a variety of OKX API functions related to Funding data and information through the PENDAX SDK.

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

Funding

Get Currencies

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

https://www.okx.com/docs-v5/en/#rest-api-funding-get-currencies

Function Name:

fundingGetCurrencies()

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 fundingGetCurrencies(exchange, options) {
    try {
        let result = await exchange.fundingGetCurrencies(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await fundingGetCurrencies(myOkxAccount)

Get Balance

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

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

Function Name:

fundingGetBalance()

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 fundingGetBalance(exchange, options) {
    try {
        let result = await exchange.fundingGetBalance(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await fundingGetBalance(myOkxAccount)

Get Account Asset Valuation

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

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

Function Name:

fundingGetAssetValuation()

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 fundingGetAssetValuation(exchange, options) {
    try {
        let result = await exchange.fundingGetAssetValuation(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await fundingGetAssetValuation(myOkxAccount)

Funds Transfer

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

https://www.okx.com/docs-v5/en/#rest-api-funding-funds-transfer

Function Name:

fundingAssetTransfer()

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 fundingAssetTransfer(exchange, options) {
    try {
        let result = await exchange.fundingAssetTransfer(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await fundingAssetTransfer(myOkxAccount,
{
    ccy:"USDT",
    amt:"1.5",
    from:"6",
    to:"18"
})

Get Funds Transfer State

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

https://www.okx.com/docs-v5/en/#rest-api-funding-get-funds-transfer-state

Function Name:

fundingGetFundsTransferState()

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 fundingGetFundsTransferState(exchange, options) {
    try {
        let result = await exchange.fundingGetFundsTransferState(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await fundingGetFundsTransferState(myOkxAccount,
{
    transId: "1",
    type: "1"
})

Asset Bill Details

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

https://www.okx.com/docs-v5/en/#rest-api-funding-asset-bills-details

Function Name:

fundingGetAssetBillsDetails()

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 fundingGetAssetBillsDetails(exchange, options) {
    try {
        let result = await exchange.fundingGetAssetBillsDetails(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await fundingGetAssetBillsDetails(myOkxAccount)

Get Deposit Address

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

https://www.okx.com/docs-v5/en/#rest-api-funding-get-deposit-address

Function Name:

fundingGetDepositAddress()

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 fundingGetDepositAddress(exchange, options) {
    try {
        let result = await exchange.fundingGetDepositAddress(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await fundingGetDepositAddress(myOkxAccount, 
            {
                ccy: "BTC"
            })

Get Deposit History

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

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

Function Name:

fundingGetDepositHistory()

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 fundingGetDepositHistory(exchange, options) {
    try {
        let result = await exchange.fundingGetDepositHistory(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await fundingGetDepositHistory(myOkxAccount)

Withdrawal

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

https://www.okx.com/docs-v5/en/#rest-api-funding-withdrawal

Function Name:

fundingWithdrawal()

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 fundingWithdrawal(exchange, options) {
    try {
        let result = await exchange.fundingWithdrawal(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await fundingWithdrawal(myOkxAccount, 
{
    amt:"1",
    fee:"0.0005",
    dest:"4",
    ccy:"BTC",
    chain:"BTC-Bitcoin",
    toAddr:"17DKe3kkkkiiiiTvAKKi2vMPbm1Bz3CMKw"
})

Get Withdrawal History

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

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

Function Name:

fundingGetWithdrawalHistory()

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 fundingGetWithdrawalHistory(exchange, options) {
    try {
        let result = await exchange.fundingGetWithdrawalHistory(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await fundingGetWithdrawalHistory(myOkxAccount)

Small Assets Convert

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

https://www.okx.com/docs-v5/en/#rest-api-funding-small-assets-convert

Function Name:

fundingConvertDust()

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 fundingConvertDust(exchange, options) {
    try {
        let result = await exchange.fundingConvertDust(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await fundingConvertDust(myOkxAccount,
{
   ccy:["BTC","USDT"]
})

Get Saving Balance

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

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

Function Name:

fundingGetSavingBalance()

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 fundingGetSavingBalance(exchange, options) {
    try {
        let result = await exchange.fundingGetSavingBalance(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await fundingGetSavingBalance(myOkxAccount)

Savings Purchase/Redemption

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

https://www.okx.com/docs-v5/en/#rest-api-funding-savings-purchase-redemption

Function Name:

fundingSavingsAndPurchaseRedemption()

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 fundingSavingsAndPurchaseRedemption(exchange, options) {
    try {
        let result = await exchange.fundingSavingsAndPurchaseRedemption(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await fundingSavingsAndPurchaseRedemption(myOkxAccount,
{
    ccy:"BTC",
    amt:"1",
    side:"purchase",
    rate:"0.01"
}
)

Set Lending Rate

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

https://www.okx.com/docs-v5/en/#rest-api-funding-set-lending-rate

Function Name:

fundingSetLendingRate()

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 fundingSetLendingRate(exchange, options) {
    try {
        let result = await exchange.fundingSetLendingRate(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await fundingSetLendingRate(myOkxAccount,
{
    ccy:"BTC",
    rate:"0.02"
}
)

Get Lending History

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

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

Function Name:

fundingGetLendingHistory()

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 fundingGetLendingHistory(exchange, options) {
    try {
        let result = await exchange.fundingGetLendingHistory(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await fundingGetLendingHistory(myOkxAccount)

Get Public Borrow Info

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

https://www.okx.com/docs-v5/en/#rest-api-funding-get-public-borrow-info-public

Function Name:

fundingGetPublicBorrowInfo()

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 fundingGetPublicBorrowInfo(exchange, options) {
    try {
        let result = await exchange.fundingGetPublicBorrowInfo(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await fundingGetPublicBorrowInfo(myOkxAccount)

Get Public Borrow History

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

https://www.okx.com/docs-v5/en/#rest-api-funding-get-public-borrow-history-public

Function Name:

fundingGetPublicBorrowHistory()

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 fundingGetPublicBorrowHistory(exchange, options) {
    try {
        let result = await exchange.fundingGetPublicBorrowHistory(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await fundingGetPublicBorrowHistory(myOkxAccount)

Lightning Deposits

Not currently supported

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

https://www.okx.com/docs-v5/en/#rest-api-funding-lightning-deposits

Function Name:

fundingLightningDeposit()

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 fundingLightningDeposit(exchange, options) {
    try {
        let result = await exchange.fundingLightningDeposit(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await fundingLightningDeposit(myOkxAccount,
{
        ccy: "BTC",
        amt: "0.1"
}
)

Lightning Withdrawals

Not currently supported

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

https://www.okx.com/docs-v5/en/#rest-api-funding-lightning-withdrawals

Function Name:

fundingLightningWithdrawal()

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 fundingLightningWithdrawal(exchange, options) {
    try {
        let result = await exchange.fundingLightningWithdrawal(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await fundingLightningWithdrawal(myOkxAccount,
{
    ccy:"BTC",
    invoice:"lnbc100u1psnnvhtpp5yq2x3q5hhrzsuxpwx7ptphwzc4k4wk0j3stp0099968m44cyjg9sdqqcqzpgxqzjcsp5hz"
}
)

Cancel Withdrawal

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

https://www.okx.com/docs-v5/en/#rest-api-funding-cancel-withdrawal

Function Name:

fundingCancelWithdrawal()

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 fundingCancelWithdrawal(exchange, options) {
    try {
        let result = await exchange.fundingCancelWithdrawal(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await fundingCancelWithdrawal(myOkxAccount,
{
   wdId:"1123456"
}
)

Last updated