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
  • Trading Data
  • Get Support Coin
  • Get Taker Volume
  • Get Margin Lending Ratio
  • Get Long/Short Ratio
  • Get Contracts Open Interest and Volume
  • Get Options Open Interest and Volume
  • Get Put/Call Ratio
  • Get Open Interest and Volume (expiry)
  • Get Open Interest and Volume (strike)
  • Get Taker Flow
  1. PENDAX
  2. Using PENDAX SDK
  3. OKX Functions

Trading Data

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

PreviousPublic DataNextBitget Functions

Last updated 2 years ago

The API endpoints of Trading Data do not require authentication.

Trading Data

Get Support Coin

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

Function name:

getSupportCoin()

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

const result = await getSupportCoin(myOkxAccount)

Get Taker Volume

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

Function name:

getTakerVolume()

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

const result = await getTakerVolume(myOkxAccount, 
{
    ccy: "BTC",
    instType: "SPOT"
})

Get Margin Lending Ratio

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

Function name:

getMarginLendingRatio()

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

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

Get Long/Short Ratio

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

Function name:

getLongShortRatio()

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

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

Get Contracts Open Interest and Volume

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

Function name:

getContractsOiAndVolume()

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

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

Get Options Open Interest and Volume

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

Function name:

getOptionsOiAndVolume()

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

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

Get Put/Call Ratio

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

Function name:

getPutCallRatio()

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

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

Get Open Interest and Volume (expiry)

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

Function name:

getOiAndVolumeExpiry()

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

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

Get Open Interest and Volume (strike)

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

Function name:

getOiAndVolumeStrike()

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

const result = await getOiAndVolumeStrike(myOkxAccount, 
{
    ccy: "BTC",
    expTime: "<get example>"
})

Get Taker Flow

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

Function name:

getTakerFlow()

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

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

⚫
💡
💻
https://www.okx.com/docs-v5/en/#rest-api-trading-data-get-support-coin
https://www.okx.com/docs-v5/en/#rest-api-trading-data-get-taker-volume
https://www.okx.com/docs-v5/en/#rest-api-trading-data-get-margin-lending-ratio
https://www.okx.com/docs-v5/en/#rest-api-trading-data-get-long-short-ratio
https://www.okx.com/docs-v5/en/#rest-api-trading-data-get-contracts-open-interest-and-volume
https://www.okx.com/docs-v5/en/#rest-api-trading-data-get-options-open-interest-and-volume
https://www.okx.com/docs-v5/en/#rest-api-trading-data-get-put-call-ratio
https://www.okx.com/docs-v5/en/#rest-api-trading-data-get-open-interest-and-volume-expiry
https://www.okx.com/docs-v5/en/#rest-api-trading-data-get-open-interest-and-volume-strike
https://www.okx.com/docs-v5/en/#rest-api-trading-data-get-taker-flow