Market
Documentation on interacting with ByBit's Market 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 Kline
Function name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myByBitAccount = createExchange({
exchange: "bybit",
authenticate: "true",
key: "myKeys",
secret: "mySecret",
label: "bybit",
testnet: "false"
});
async function getKline(exchange, options) {
try {
let result = await exchange.getKline(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
const result = await getKline(myByBitAccount ,
{
category: 'linear',
symbol: 'BTCUSD',
interval: '60'
});
Get Mark Price Kline
Function name:
getMarkPriceKline(options)
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myByBitAccount = createExchange({
exchange: "bybit",
authenticate: "true",
key: "myKeys",
secret: "mySecret",
label: "bybit",
testnet: "false"
passphrase: "myPassphrase",
label: "bybit",
marginType: "usdt",
testnet: "false"
});
async function getMarkPriceKline(exchange, options) {
try {
let result = await exchange.getMarkPriceKline(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
const result = await getMarkPriceKline(myByBitAccount ,
{
category: 'linear',
symbol: 'BTCUSD',
interval: '60'
});
Get Index Price Kleine
Function name:
placeOrderFutures(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 getKline(exchange, options) {
try {
let result = await exchange.getKline(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
const result = await getKline(myByBitAccount ,
{
category: 'linear',
symbol: 'BTCUSD',
interval: '60'
});
Get Premium Index Price Kline
Function name:
getPremiumIndexPriceKline(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 getPremiumIndexPriceKline(exchange, options) {
try {
let result = await exchange.getPremiumIndexPriceKline(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
const result = await getPremiumIndexPriceKline(myByBitAccount ,
{
category: 'linear',
symbol: 'BTCUSD',
interval: '60'
});
Get Instruments Info
Function name:
getInstrumentsInfo(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 getInstrumentsInfo(exchange, options) {
try {
let result = await exchange.getInstrumentsInfo(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
const result = await getInstrumentsInfo(myByBitAccount,
{
category: 'linear'
});
Get Orderbook
Function name:
getOrderbook(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 getOrderbook(exchange, options) {
try {
let result = await exchange.getOrderbook(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
const result = await getOrderbook(myByBitAccount,
{
category: 'linear',
symbol: 'BTCUSD'
});
Get Tickers
Function name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myByBitAccount = createExchange({
exchange: "bybit",
authenticate: "true",
key: "myKeys",
secret: "mySecret",
label: "bybit",
testnet: "false"
});
async function getTickers(exchange, options) {
try {
let result = await exchange.getTickers(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
const result = await getTickers(myByBitAccount,
{
category: 'linear'
});
Get Funding Rate History
Function name:
getFundingRateHistory(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 getFundingRateHistory(exchange, options) {
try {
let result = await exchange.getFundingRateHistory(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
const result = await getFundingRateHistory(myByBitAccount,
{
category: 'linear',
symbol: 'BTCUSD'
});
Get Public Trading History
Function name:
getPublicTradingHistory(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 getPublicTradingHistory(exchange, options) {
try {
let result = await exchange.getPublicTradingHistory(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
const result = await getPublicTradingHistory(myByBitAccount,
{
category: 'linear',
symbol: 'BTCUSD'
});
Get Open Interest
Function name:
getOpenInterest(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 getOpenInterest(exchange, options) {
try {
let result = await exchange.getOpenInterest(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
const result = await getOpenInterest(myByBitAccount,
{
category: 'linear',
symbol: 'BTCUSDT',
intervalTime: '5min'
});
Get Historical Volatility
Function name:
getHistoricalVolatility(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 getHistoricalVolatility(exchange, options) {
try {
let result = await exchange.getHistoricalVolatility(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
const result = await getHistoricalVolatility(myByBitAccount,
{
category: 'option'
});
Get Insurance
Function name:
getInsurance(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 getInsurance(exchange, options) {
try {
let result = await exchange.getInsurance(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
const result = await getInsurance(myByBitAccount);
Get Risk Limit
Function name:
getRiskLimit(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 getRiskLimit(exchange, options) {
try {
let result = await exchange.getRiskLimit(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
const result = await getRiskLimit(myByBitAccount,
{
category: 'linear'
});
Get Delivery Price
Function name:
getDeliveryPrice(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 getDeliveryPrice(exchange, options) {
try {
let result = await exchange.getDeliveryPrice(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
const result = await getDeliveryPrice(myByBitAccount,
{
category: 'linear'
});