feat(): add/update missing v5 market endpoints. add api doc examples for each endpoint.

This commit is contained in:
tiagosiebler
2023-06-07 12:13:25 +01:00
parent 15d5ae00cf
commit 4f563a65a5
21 changed files with 322 additions and 4 deletions

View File

@@ -0,0 +1,3 @@
# V5 - REST - Market
https://bybit-exchange.github.io/docs/v5/market/kline

View File

@@ -0,0 +1,17 @@
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
});
client
.getTickers({
category: 'inverse',
symbol: 'BTCUSDT',
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});

View File

@@ -0,0 +1,18 @@
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
});
client
.getFundingRateHistory({
category: 'linear',
symbol: 'ETHPERP',
limit: 1,
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});

View File

@@ -0,0 +1,18 @@
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
});
client
.getHistoricalVolatility({
category: 'option',
baseCoin: 'ETH',
period: 30,
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});

View File

@@ -0,0 +1,17 @@
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
});
client
.getInstrumentsInfo({
category: 'linear',
symbol: 'BTCUSDT',
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});

View File

@@ -0,0 +1,16 @@
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
});
client
.getInsurance({
coin: 'ETH',
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});

View File

@@ -0,0 +1,21 @@
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
});
client
.getIndexPriceKline({
category: 'inverse',
symbol: 'BTCUSDZ22',
interval: '1',
start: 1670601600000,
end: 1670608800000,
limit: 2,
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});

View File

@@ -0,0 +1,21 @@
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
});
client
.getMarkPriceKline({
category: 'linear',
symbol: 'BTCUSD',
interval: '15',
start: 1670601600000,
end: 1670608800000,
limit: 1,
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});

View File

@@ -0,0 +1,20 @@
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
});
client
.getPremiumIndexPriceKline({
category: 'linear',
symbol: 'BTCUSDT',
interval: 'D',
start: 1652112000000,
end: 1652544000000,
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});

View File

@@ -0,0 +1,20 @@
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
});
client
.getKline({
category: 'inverse',
symbol: 'BTCUSD',
interval: '60',
start: 1670601600000,
end: 1670608800000,
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});

View File

@@ -0,0 +1,20 @@
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
});
client
.getOpenInterest({
category: 'inverse',
symbol: 'BTCUSD',
intervalTime: '5min',
startTime: 1669571100000,
endTime: 1669571400000,
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});

View File

@@ -0,0 +1,17 @@
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
});
client
.getOrderbook({
category: 'linear',
symbol: 'BTCUSDT',
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});

View File

@@ -0,0 +1,18 @@
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
});
client
.getPublicTradingHistory({
category: 'spot',
symbol: 'BTCUSDT',
limit: 1,
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});

View File

@@ -0,0 +1,17 @@
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
});
client
.getRiskLimit({
category: 'inverse',
symbol: 'BTCUSD',
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});

View File

@@ -0,0 +1,17 @@
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
});
client
.getTickers({
category: 'inverse',
symbol: 'BTCUSDT',
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});