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
  • Place Order
  • Amend Order
  • Cancel Order
  • Get Open Orders
  • Cancel All Orders
  • Get Order History
  • Batch Place Order
  • Batch Amend Order
  • Batch Cancel Order
  • Get Borrow Quota
  • Set Disconnect Cancel All
  1. PENDAX
  2. Using PENDAX SDK
  3. ByBit Functions

Trading

Documentation on interacting with ByBit's Trading API functions through the PENDAX Javascript SDK.

PreviousMarketNextPosition

Last updated 8 months ago

All parameters of type INTEGER listed in the Bybit API docs need to be passed in as a string.

Place Order

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

Function name:

placeOrder(options)

Usage:

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

  let myByBitAccount = createExchange({
      exchange: "bybit",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      label: "bybit",
      testnet: "false"
});

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

const result = await placeOrder(myByBitAccount, 
    {
       category: 'linear',
       symbol: 'BTCUSD',
       side: 'Buy',
       orderType: 'Market',
       qty: '10'
     });

Amend Order

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

Function name:

amendOrder(options)

Usage:

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

  let myByBitAccount = createExchange({
      exchange: "bybit",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      label: "bybit",
      testnet: "false"
});

async function amendOrder(exchange, options) {
    try {
        let result = await exchange.amendOrder(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await amendOrder(myByBitAccount, 
    {
       category: 'linear',
       symbol: 'BTCUSD',
       qty: '0.000034',
       orderId: '12345'
     })

Cancel Order

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

Function name:

cancelOrder(options)

Usage:

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

  let myByBitAccount = createExchange({
      exchange: "bybit",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      label: "bybit",
      testnet: "false"
});

async function cancelOrder(exchange, options) {
    try {
        let result = await exchange.cancelOrder(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await cancelOrder(myByBitAccount, 
    {
       category: 'linear',
       symbol: 'BTCUSD',
       orderId: '12345'
     });

Get Open Orders

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

Function name:

getOpenOrders(options)

Usage:

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

  let myByBitAccount = createExchange({
      exchange: "bybit",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      label: "bybit",
      testnet: "false"
});

async function getOpenOrders(exchange, options) {
    try {
        let result = await exchange.getOpenOrders(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await getOpenOrders(myByBitAccount, 
    {
       category: 'linear'
       
     });

Cancel All Orders

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

Function name:

cancelAllOrders(options)

Usage:

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

  let myByBitAccount = createExchange({
      exchange: "bybit",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      label: "bybit",
      testnet: "false"
});

async function cancelAllOrders(exchange, options) {
    try {
        let result = await exchange.cancelAllOrders(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await cancelAllOrders(myByBitAccount, 
    {
       category: 'linear',
       symbol: 'BTCUSD'
     });

Get Order History

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

Function name:

getOrderHistory(options)

Usage:

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

  let myByBitAccount = createExchange({
      exchange: "bybit",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      label: "bybit",
      testnet: "false"
});

async function getOrderHistory(exchange, options) {
    try {
        let result = await exchange.getOrderHistory(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await getOrderHistory(myByBitAccount, 
    {
       category: 'linear'
     });

Batch Place Order

This function is under construction and may behave unexpectedly

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

Function name:

placeBatchOrder(options)

Usage:

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

  let myByBitAccount = createExchange({
      exchange: "bybit",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      label: "bybit",
      testnet: "false"
});

async function placeBatchOrder(exchange, options) {
    try {
        let result = await exchange.placeBatchOrder(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await placeBatchOrder(myByBitAccount, 
    {
       category: 'linear',
       request: [
           {
               category: 'linear',
               symbol: 'BTCPERP',
               side: 'Buy',
               orderType: 'Market',
               qty: '0.000033'
           },
           {
               category: 'linear',
               symbol: 'BTCPERP',
               side: 'Buy',
               orderType: 'Market',
               qty: '0.000030'
           }
       ]
     });

Batch Amend Order

This function is under construction and may behave unexpectedly

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

Function name:

amendBatchOrder(options)

Usage:

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

  let myByBitAccount = createExchange({
      exchange: "bybit",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      label: "bybit",
      testnet: "false"
});

async function amendBatchOrder(exchange, options) {
    try {
        let result = await exchange.amendBatchOrder(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await amendBatchOrder(myByBitAccount, 
    {
       category: 'linear',
       request: [
           {
               symbol: 'BTCPERP',
               qty: '0.000034',
               orderId: '12345'
             },
           {
               symbol: 'BTCPERP',
               orderId: '12346'
               qty: '0.000030'
           }
       ]
     });

Batch Cancel Order

This function is under construction and may behave unexpectedly

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

Function name:

cancelBatchOrder(options)

Usage:

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

  let myByBitAccount = createExchange({
      exchange: "bybit",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      label: "bybit",
      testnet: "false"
});

async function cancelBatchOrder(exchange, options) {
    try {
        let result = await exchange.cancelBatchOrder(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await cancelBatchOrder(myByBitAccount, 
    {
       category: 'linear',
       request: [
           {
               symbol: 'BTCUSD',
               orderId: '12345'
             },
           {
               symbol: 'BTCUSD',
               orderId: '12346'
           }
       ]
     });

Get Borrow Quota

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

Function name:

getBorrowQuotaSpot(options)

Usage:

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

  let myByBitAccount = createExchange({
      exchange: "bybit",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      label: "bybit",
      testnet: "false"
});

async function getBorrowQuotaSpot(exchange, options) {
    try {
        let result = await exchange.getBorrowQuotaSpot(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await getBorrowQuotaSpot(myByBitAccount, 
    {
       category: 'spot',
       symbol: 'BTCUSDT',
       side: 'buy'
     });

Set Disconnect Cancel All

This function is under construction and may behave unexpectedly

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

Function name:

setDcp(options)

Usage:

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

  let myByBitAccount = createExchange({
      exchange: "bybit",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      label: "bybit",
      testnet: "false"
});

async function setDcp(exchange, options) {
    try {
        let result = await exchange.setDcp(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await setDcp(myByBitAccount, 
    {
       timeWindow: '100'
     });

⚫
💡
💻
https://bybit-exchange.github.io/docs/v5/order/create-order
https://bybit-exchange.github.io/docs/v5/order/amend-order
https://bybit-exchange.github.io/docs/v5/order/cancel-order
https://bybit-exchange.github.io/docs/v5/order/open-order
https://bybit-exchange.github.io/docs/v5/order/cancel-all
https://bybit-exchange.github.io/docs/v5/order/order-list
https://bybit-exchange.github.io/docs/v5/order/batch-place
https://bybit-exchange.github.io/docs/v5/order/batch-amend
https://bybit-exchange.github.io/docs/v5/order/batch-cancel
https://bybit-exchange.github.io/docs/v5/order/spot-borrow-quota
https://bybit-exchange.github.io/docs/v5/order/dcp