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
  • Get Wallet Balance
  • Upgrade to Unified Account
  • Get Borrow History
  • Get Collateral Info
  • Get Coin Greeks
  • Get Fee Rate
  • Get Account Info
  • Get Transaction Log
  • Set Margin Mode
  • Set MMP
  • Reset MMP
  • Get MMP State
  1. PENDAX
  2. Using PENDAX SDK
  3. ByBit Functions

Account

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

PreviousPositionNextAsset

Last updated 8 months ago

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

Get Wallet Balance

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

Function name:

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

const result = await getWalletBalance(myByBitAccount, 
    {
       accountType: "UNIFIED"
     });

Upgrade to Unified Account

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

Function name:

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

const result = await upgradeToUta(myByBitAccount);

Get Borrow History

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

Function name:

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

const result = await getBorrowHistory(myByBitAccount, 
    {
       currency: "USDT"
     });

Get Collateral Info

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

Function name:

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

const result = await getCollateralInfo(myByBitAccount);

Get Coin Greeks

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

Function name:

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

const result = await getCoinGreeks(myByBitAccount);

Get Fee Rate

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

Function name:

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

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

Get Account Info

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

Function name:

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

const result = await getAccountInfo(myByBitAccount);

Get Transaction Log

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

Function name:

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

const result = await getTransactionLog(myByBitAccount);

Set Margin Mode

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

Function name:

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

const result = await setMarginMode(myByBitAccount, 
    {
       setMarginMode: "REGULAR_MARGIN"
   });

Set MMP

This function is under construction and may not behave as expected

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

Function name:

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

const result = await setMmp(myByBitAccount, 
    {
    baseCoin: "ETH",
    window: "5000",
    frozenPeriod: "100000",
    qtyLimit: "50",
    deltaLimit: "20"
    });

Reset MMP

This function is under construction and may not behave as expected

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

Function name:

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

const result = await resetMmp(myByBitAccount, 
    {
    baseCoin: "BTC"
    });

Get MMP State

This function is under construction and may not behave as expected

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

Function name:

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

const result = await getMmpState(myByBitAccount, 
    {
    baseCoin: "ETH"
    });

⚫
💡
💻
https://bybit-exchange.github.io/docs/v5/account/wallet-balance
https://bybit-exchange.github.io/docs/v5/account/upgrade-unified-account
https://bybit-exchange.github.io/docs/v5/account/borrow-history
https://bybit-exchange.github.io/docs/v5/account/collateral-info
https://bybit-exchange.github.io/docs/v5/account/coin-greeks
https://bybit-exchange.github.io/docs/v5/account/fee-rate
https://bybit-exchange.github.io/docs/v5/account/account-info
https://bybit-exchange.github.io/docs/v5/account/transaction-log
https://bybit-exchange.github.io/docs/v5/account/set-margin-mode
https://bybit-exchange.github.io/docs/v5/account/set-mmp
https://bybit-exchange.github.io/docs/v5/account/reset-mmp
https://bybit-exchange.github.io/docs/v5/account/get-mmp-state