Links

Account

Documentation on interacting with ByBit's Account 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.

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"
});

Last modified 6mo ago