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
Please refer to the official ByBit API Docs for the required parameters.
Function name:
getKline(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 Mark Price Kline
Please refer to the official ByBit API Docs for the required parameters.
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
Please refer to the official ByBit API Docs for the required parameters.
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
Please refer to the official ByBit API Docs for the required parameters.
https://bybit-exchange.github.io/docs/v5/market/preimum-index-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
Please refer to the official ByBit API Docs for the required parameters.
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
Please refer to the official ByBit API Docs for the required parameters.
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
Please refer to the official ByBit API Docs for the required parameters.
Function name:
getTickers(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 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
Please refer to the official ByBit API Docs for the required parameters.
https://bybit-exchange.github.io/docs/v5/market/history-fund-rate
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
Please refer to the official ByBit API Docs for the required parameters.
https://bybit-exchange.github.io/docs/v5/market/recent-trade
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
Please refer to the official ByBit API Docs for the required parameters.
https://bybit-exchange.github.io/docs/v5/market/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
Please refer to the official ByBit API Docs for the required parameters.
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
Please refer to the official ByBit API Docs for the required parameters.
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
Please refer to the official ByBit API Docs for the required parameters.
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
Please refer to the official ByBit API Docs for the required parameters.
https://bybit-exchange.github.io/docs/v5/market/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'
});
Last updated