Compendium Trading Tools Documentation
CompendiumPENDAXCompendexOfficial Links
  • ⭐Platform Overview
  • ⚫PENDAX
    • 🌐What is PENDAX?
    • 🖱️PENDAX Capabilities
    • 💾Installing PENDAX modules
    • 💡Using PENDAX SDK
      • 💻Common Functions
      • 💻OKX Functions
        • Trading & Orders
        • Funding
        • Convert
        • Account & Subaccount
        • Grid Trading
        • Market Data
        • Public Data
        • Trading Data
      • 💻Bitget Functions
        • Public (Spot)
        • Market (Spot)
        • Wallet (Spot)
        • Account (Spot)
        • Trade (Spot)
        • Market (Futures)
        • Account (Futures)
        • Trade (Futures)
        • CopyTrade (Futures)
        • Sub Account Interface (Broker)
        • Sub API Interface (Broker)
      • 💻ByBit Functions
        • Market
        • Trading
        • Position
        • Account
        • Asset
        • User
        • Spot Leverage Token
        • Spot Margin Trade (UTA)
        • Spot Margin Trade (Normal)
        • Institutional Lending
      • 💻Mexc Functions
        • Market
        • Sub-Account
        • Spot Account/Trade
        • Wallet
        • ETF
        • Rebate
        • Futures Market
        • Futures Account and Trading
      • 💻Phemex Functions
        • Contract
        • Hedged Contract
        • Spot
        • Margin Trading
        • Transfer
        • Convert
        • Deposit And Withdraw
      • 💻BloFin Functions
        • Websocket
        • Account
        • Affiliate
        • Public Data
        • Trading
        • User
      • 💻BingX Functions
        • Fund Account
        • Wallet Deposits and Withdrawals
        • Sub-Account Managenent
        • Market Data (USDT-M)
        • Account (USDT-M)
        • Trades (USDT-M)
        • Market Data (Coin-M)
        • Trades (Coin-M)
        • Market Data (Spot)
        • Fund Account (Spot)
        • Trades (Spot)
        • CopyTrader
      • ⚠️FTX Functions
    • 📜License Agreement
  • 🟣Compendium App
    • 📈Compendium Trading Tools
    • 🔗Connect An Exchange Account
      • 🗝️OKX.com API Keys
    • 🤖Verified Trading Bots
      • Explore The Marketplace
      • For Algo & Strategy Authors
        • Get Listed & Verified
        • Strategy Monetization
        • Sending Trading Signals
        • Simplified Signal Program
      • For Users & Subscribers
        • Subscribing To Bots
        • Managing A Subscription
    • 💫Copy Trading Groups
      • For Copy Group Leaders
        • Creating A Copy Group
        • Linking Leader Account
        • Important Trading Notes
        • Manage A Copy Group
        • Discord Webhooks Setup
      • For Users & Subscribers
        • Subscribe To Copy Group
        • Link Account To Group
    • 📶Signal Provider Groups
      • For Group Leaders
        • Creating A Signal Group
        • Managing A Signal Group
        • Sending Trading Signals
      • For Users & Subscribers
        • Subscribing To Signal Groups
        • Manage Signal Group Subscription
  • 🔵Compendex Suite
    • 🔮DeFi With Compendex
    • ☀️Solana Integrations
      • Supported Solana Wallets
      • Overview And News
      • Openbook Spot Markets
      • Smart Swap Aggregator
      • NFT Metaverse Markets
      • Solana DeFi Analytics Portal
      • Community Tools List
  • 🪙The CMFI Token Ecosystem
    • 📊Tokenomics Breakdown
    • 🍎Trade Incentive Program
    • 🌊Staking And Liquidity Pools
      • ✨Raydium Liquidity Pools
      • 🐳Orca Liquidity Whirlpools
      • 🐋Orca Liquidity Pools
    • 🐷Compendi-Pigs NFT
  • 👥Community Info
    • ✅Links And Social Pages
    • 🎨Branding Guidelines
Powered by GitBook
On this page
  • Public Data
  • Get Instruments
  • Get Delivery/Exercise Data
  • Get Open Interest
  • Get Funding Rate
  • Get Funding Rate History
  • Get Limit Price
  • Get Option Market Data
  • Get Estimated Delivery/Exercise Price
  • Get Discount Rate and Interest-Free Quota
  • Get System Time
  • Get Liquidation Orders
  • Get Mark Price
  • Get Position Tiers
  • Get Interest Rate and Loan Quota
  • Get Interest Rate and Loan Quota for VIP Loans
  • Get Underlying
  • Get Insurance Fund
  • Unit Convert
  1. PENDAX
  2. Using PENDAX SDK
  3. OKX Functions

Public Data

Documentation on interacting with a variety of OKX's Public Data API functions through the PENDAX Javascript SDK.

PreviousMarket DataNextTrading Data

Last updated 2 years ago

The API endpoints of Public Data do not require authentication.

Public Data

Get Instruments

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

Function Name:

getInstruments()

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

const result = await getInstruments(myOkxAccount,
{
    instType: "SWAP"
});

Get Delivery/Exercise Data

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

Function Name:

getDeliveryAndRequestHistory()

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

const result = await getDeliveryAndRequestHistory(myOkxAccount,
{
  instType: "OPTION",
  uly: "BTC-USD"
});

Get Open Interest

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

Function Name:

getOpenInterest()

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

const result = await getOpenInterest(myOkxAccount,
{
    instType: "SWAP"
});

Get Funding Rate

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

Function Name:

getFundingRate()

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

const result = await getFundingRate(myOkxAccount,
{
    instId: "BTC-USD-SWAP"
});

Get Funding Rate History

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

Function Name:

getFundingHistory()

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

const result = await getFundingHistory(myOkxAccount,
{
    instId: "BTC-USD-SWAP"
});

Get Limit Price

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

Function Name:

getLimitPrice()

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

const result = await getLimitPrice(myOkxAccount,
{
    instId: "BTC-USDT-SWAP"
});

Get Option Market Data

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

Function Name:

getOptionMarketData()

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

const result = await getOptionMarketData(myOkxAccount,
{
    uly: "BTC-USD"
});

Get Estimated Delivery/Exercise Price

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

Function Name:

getEstimatedDelExpPrice()

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

const result = await getEstimatedDelExpPrice(myOkxAccount,
{
  instId: "BTC-USD-230106-16200-P"
});

Get Discount Rate and Interest-Free Quota

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

Function Name:

getDiscRateAndIntFreeQuota()

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

const result = await getDiscRateAndIntFreeQuota(myOkxAccount,
{
    instType: "SWAP"
});

Get System Time

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

Function Name:

getServerTime()

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

const result = await getServerTime(myOkxAccount);

Get Liquidation Orders

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

Function Name:

getLiqOrders()

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

const result = await getLiqOrders(myOkxAccount,
{
  instType: "MARGIN",
  instId: "BTC-USDT"
}));

Get Mark Price

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

Function Name:

getMarkPrice()

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

const result = await getMarkPrice(myOkxAccount,
{
    instType: "SWAP"
});

Get Position Tiers

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

Function Name:

getPositionTiers()

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

const result = await getPositionTiers(myOkxAccount,
{
  instType: "SWAP",
  tdMode: "cross",
  uly: ["BTC-USD"]
});

Get Interest Rate and Loan Quota

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

Function Name:

getInterestRateAndLoanQuota()

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

const result = await getInterestRateAndLoanQuota(myOkxAccount);

Get Interest Rate and Loan Quota for VIP Loans

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

Function Name:

getVipInterestRateAndLoanQuota()

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

const result = await getVipInterestRateAndLoanQuota(myOkxAccount);

Get Underlying

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

Function Name:

getUnderlying()

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

const result = await getUnderlying(myOkxAccount,
{
    instType: "SWAP"
});

Get Insurance Fund

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

Function Name:

getInsuranceFund()

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

const result = await getInsuranceFund(myOkxAccount,
{
  instType: "SWAP",
  uly: "BTC-USD"
});

Unit Convert

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

Function Name:

unitConvert()

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

const result = await unitConvert(myOkxAccount,
{
  instId: "BTC-USD-SWAP",
  px: "35000",
  sz: "0.888"
});

⚫
💡
💻
https://www.okx.com/docs-v5/en/#rest-api-public-data-get-instruments
https://www.okx.com/docs-v5/en/#rest-api-public-data-get-delivery-exercise-history
https://www.okx.com/docs-v5/en/#rest-api-public-data-get-open-interest
https://www.okx.com/docs-v5/en/#rest-api-public-data-get-funding-rate
https://www.okx.com/docs-v5/en/#rest-api-public-data-get-funding-rate-history
https://www.okx.com/docs-v5/en/#rest-api-public-data-get-limit-price
https://www.okx.com/docs-v5/en/#rest-api-public-data-get-option-market-data
https://www.okx.com/docs-v5/en/#rest-api-public-data-get-estimated-delivery-exercise-price
https://www.okx.com/docs-v5/en/#rest-api-public-data-get-discount-rate-and-interest-free-quota
https://www.okx.com/docs-v5/en/#rest-api-public-data-get-system-time
https://www.okx.com/docs-v5/en/#rest-api-public-data-get-liquidation-orders
https://www.okx.com/docs-v5/en/#rest-api-public-data-get-mark-price
https://www.okx.com/docs-v5/en/#rest-api-public-data-get-position-tiers
https://www.okx.com/docs-v5/en/#rest-api-public-data-get-interest-rate-and-loan-quota
https://www.okx.com/docs-v5/en/#rest-api-public-data-get-interest-rate-and-loan-quota-for-vip-loans
https://www.okx.com/docs-v5/en/#rest-api-public-data-get-underlying
https://www.okx.com/docs-v5/en/#rest-api-public-data-get-insurance-fund
https://www.okx.com/docs-v5/en/#rest-api-public-data-unit-convert