Spot Margin Trade (Normal)
Documentation on interacting with ByBit's Spot Margin Trade (Normal) API functions through the PENDAX Javascript SDK.
Last updated
Documentation on interacting with ByBit's Spot Margin Trade (Normal) 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.
getMarginCoinInfo(options)
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);
getBorrowableCoinInfo(options)
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"});
getInterestAndQuota(options)
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"
});
getLoanAccountInfo(options)
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);
borrowMargin(options)
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"
});
repayMargin(options)
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"
});
getBorrowOrderDetail(options)
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);
getRepaymentOrderDetail(options)
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);
toggleNormalMarginTrade(options)
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"
});