Spot Margin Trade (UTA)

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

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

Toggle Margin Trade

Function name:

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

const result = await toggleUnifiedMarginTrade(myByBitAccount,
    {
        spotMarginMode: "1"
    });

Get Leveraged Token Market

Function name:

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

const result = await setLeverageMargin(myByBitAccount,
    {
       leverage: "4"
    });

Last updated