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
  • Create an Exchange Object
  • All Available OKX Functions
  • Exchange API Availability Status
  • WebSocket Example Code
  1. PENDAX
  2. Using PENDAX SDK

OKX Functions

Documentation for interacting with OKX functions and API endpoints through the PENDAX Javascript SDK.

Create an Exchange Object

Before you can interact with PENDAX functions, you must first create an Exchange object. This exchange object will allow you to interact with PENDAX. You can create one or multiple, and reference them together or individually throughout your code.

Example Exchange Object Creation:

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

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

Unauthenticated Exchange Objects

If you are just calling public API endpoints on the exchange and you don't need any authentication to protected endpoints, simply create your exchange object with authenticate set to false and omit the key, secret, passphrase.

Authenticated Exchange objects can call private and public endpoints, however, unauthenticated exchange objects may only call public endpoints.

Example Unauthenticated Exchange Object:

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

let myOkxAccount = createExchange({
  exchange: "okx",
  authenticate: false,
  label: "okx",
  marginType: "usdt" // coin or usdt
});

Once an Exchange object has been created you may use any of the available functions allowed by that exchange by referencing the name of the Exchange object you created.

Example using multiple Exchange Objects for executing PENDAX functions:

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

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

let myOtherOkxAccount = createExchange({
  exchange: "okx",
  authenticate: true,
  key: "myOtherKeys",
  secret: "myOtherSecret",
  passphrase: "myOtherPassphrase",
  label: "okx2",
  marginType: "usdt"
});

 async function placeOrder(options){
    try {
      let result = await myOkxAccount.placeOrder (options);
      console.log(result);
    } catch (error) {
      console.log(error.message);
    }
  }  
  async function placeOrder(options){
    try {
      let result = await myOtherOkxAccount.placeOrder (options);
      console.log(result);
    } catch (error) {
      console.log(error.message);
    }
  }

All Available OKX Functions

Documentation for each category of functions is broken down into its own subpage in order to make navigating pages simpler and faster. Please use the side navigation to access these sub-pages or click on one of the links below.

Exchange API Availability Status

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

Function name:

getStatus() 

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

const result = await getStatus(myOkxAccount)

WebSocket Example Code

Please refer to the attached repository to utilize OKX WebSocket connections for trading and data deployments through the PENDAX SDK

PreviousCommon FunctionsNextTrading & Orders

Last updated 1 year ago

โšซ
๐Ÿ’ก
๐Ÿ’ป
Trading & Orders
Funding
Convert
Account & Subaccount
Grid Trading
Market Data
Public Data
Trading Data
https://www.okx.com/docs-v5/en/#rest-api-status
PENDAX-SDK/Examples/OKX-WebSocket-Template at main ยท CompendiumFi/PENDAX-SDKGitHub
Logo