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 Margin Coin Info
  • Get Borrowable Coin Info
  • Get Interest & Quota
  • Get Loan Account Info
  • Borrow
  • Repay
  • Get Borrow Order Detail
  • Get Repayment Order Detail
  • Toggle Margin Trade
  1. PENDAX
  2. Using PENDAX SDK
  3. ByBit Functions

Spot Margin Trade (Normal)

Documentation on interacting with ByBit's Spot Margin Trade (Normal) API functions through the PENDAX Javascript SDK.

PreviousSpot Margin Trade (UTA)NextInstitutional Lending

Last updated 1 year ago

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

Get Margin Coin Info

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

Function name:

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

const result = await getMarginCoinInfo(myByBitAccount);

Get Borrowable Coin Info

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

Function name:

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

const result = await getBorrowableCoinInfo(myByBitAccount, {coin: "ETH"});

Get Interest & Quota

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

Function name:

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

const result = await getInterestAndQuota(myByBitAccount,
    {
        coin: "USDT"
    });

Get Loan Account Info

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

Function name:

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

const result = await getLoanAccountInfo(myByBitAccount);

Borrow

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

Function name:

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

const result = await borrowMargin(myByBitAccount,
    {
        coin: "USDT",
        qty: "10"
    });

Repay

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

Function name:

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

const result = await repayMargin(myByBitAccount,
    {
        coin: "USDT",
        completeRepayments: "1"
    });

Get Borrow Order Detail

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

Function name:

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

const result = await getBorrowOrderDetail(myByBitAccount);

Get Repayment Order Detail

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

Function name:

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

const result = await getRepaymentOrderDetail(myByBitAccount);

Toggle Margin Trade

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

Function name:

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

const result = await toggleNormalMarginTrade(myByBitAccount,
    {
        switch: "1"
    });

⚫
💡
💻
https://bybit-exchange.github.io/docs/v5/spot-margin-normal/margin-data
https://bybit-exchange.github.io/docs/v5/spot-margin-normal/borrowable-data
https://bybit-exchange.github.io/docs/v5/spot-margin-normal/interest-quota
https://bybit-exchange.github.io/docs/v5/spot-margin-normal/account-info
https://bybit-exchange.github.io/docs/v5/spot-margin-normal/borrow
https://bybit-exchange.github.io/docs/v5/spot-margin-normal/repay
https://bybit-exchange.github.io/docs/v5/spot-margin-normal/borrow-order
https://bybit-exchange.github.io/docs/v5/spot-margin-normal/repay-order
https://bybit-exchange.github.io/docs/v5/spot-margin-normal/switch-mode