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
  • Convert
  • Get Convert Currencies
  • Get Convert Currency Pair
  • Estimate Quote
  • Convert Trade
  • Get Convert History
  1. PENDAX
  2. Using PENDAX SDK
  3. OKX Functions

Convert

Documentation on interacting with a variety of OKX Convert and Convert History API functions through the PENDAX SDK.

PreviousFundingNextAccount & Subaccount

Last updated 2 years ago

The API endpoints of Convert require authentication. Please start by creating an OKX API key. Only the assets in the funding account can be used for conversion.

Convert

Get Convert Currencies

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

Function Name:

getConvertCurrencies()

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

const result = await getConvertCurrencies(myOkxAccount)

Get Convert Currency Pair

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

Function Name:

getConvertCurrencyPair()

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

const result = await getConvertCurrencyPair(myOkxAccount,
{
        fromCcy: "USDT",
        toCcy: "BTC"
})

Estimate Quote

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

Function Name:

convertEstimateQuote()

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

const result = await convertEstimateQuote(myOkxAccount,
{
    baseCcy: "ETH",
    quoteCcy: "USDT",
    side: "buy",
    rfqSz: "30",
    rfqSzCcy: "USDT"
}
)

Convert Trade

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

Function Name:

convertTrade()

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

const result = await convertTrade(myOkxAccount,
{
    baseCcy: "ETH",
    quoteCcy: "USDT",
    side: "buy",
    sz: "30",
    szCcy: "USDT",
    quoteId: "quoterETH-USDT16461885104612381"
}
)

Get Convert History

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

Function Name:

getConvertHistory()

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

const result = await getConvertHistory(myOkxAccount)

⚫
💡
💻
https://www.okx.com/docs-v5/en/#rest-api-convert-get-convert-currencies
https://www.okx.com/docs-v5/en/#rest-api-convert-get-convert-currency-pair
https://www.okx.com/docs-v5/en/#rest-api-convert-estimate-quote
https://www.okx.com/docs-v5/en/#rest-api-convert-convert-trade
https://www.okx.com/docs-v5/en/#rest-api-convert-get-convert-history