Account
Documentation on interacting with ByBit's Account API functions through the PENDAX Javascript SDK.
Last updated
Documentation on interacting with ByBit's Account API functions through the PENDAX Javascript SDK.
Last updated
All parameters of type INTEGER listed in the Bybit API docs need to be passed in as a string.
getWalletBalance(options)
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"
});
upgradeToUta(options)
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);
getBorrowHistory(options)
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"
});
getCollateralInfo(options)
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);
getCoinGreeks(options)
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);
getFeeRate(options)
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'
});
getAccountInfo(options)
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);
getTransactionLog(options)
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);
setMarginMode(options)
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"
});
This function is under construction and may not behave as expected
setMmp(options)
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"
});
This function is under construction and may not behave as expected
resetMmp(options)
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"
});
This function is under construction and may not behave as expected
getMmpState(options)
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"
});