feat(v4.1.4): full spread trading support

This commit is contained in:
JJ-Cro
2025-04-17 11:24:09 +02:00
parent 4b7daf91db
commit 70be74fe9a
18 changed files with 599 additions and 4 deletions

View File

@@ -0,0 +1,21 @@
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
key: 'apiKey',
secret: 'apiSecret',
});
client
.amendSpreadOrder({
symbol: 'SOLUSDT_SOL/USDT',
orderLinkId: '1744072052193428475',
price: '14',
qty: '0.2',
})
.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,
key: 'apiKey',
secret: 'apiSecret',
});
client
.cancelAllSpreadOrders()
.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,
key: 'apiKey',
secret: 'apiSecret',
});
client
.cancelSpreadOrder({
orderLinkId: '1744072052193428476',
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});

View File

@@ -0,0 +1,24 @@
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
key: 'apiKey',
secret: 'apiSecret',
});
client
.submitSpreadOrder({
symbol: 'SOLUSDT_SOL/USDT',
side: 'Buy',
orderType: 'Limit',
qty: '0.1',
price: '21',
orderLinkId: '1744072052193428479',
timeInForce: 'PostOnly',
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});

View File

@@ -0,0 +1,14 @@
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
});
client
.getSpreadInstrumentsInfo()
.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,
key: 'apiKey',
secret: 'apiSecret',
});
client
.getSpreadOpenOrders()
.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,
key: 'apiKey',
secret: 'apiSecret',
});
client
.getSpreadOrderHistory({
orderId: '5e010c35-2b44-4f03-8081-8fa31fb73376',
})
.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
.getSpreadOrderbook({
symbol: 'SOLUSDT_SOL/USDT',
limit: 1, // Show 5 levels of depth
})
.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
.getSpreadTickers({
symbol: 'SOLUSDT_SOL/USDT',
})
.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,
key: 'apiKey',
secret: 'apiSecret',
});
client
.getSpreadTradeHistory({
orderId: '5e010c35-2b44-4f03-8081-8fa31fb73376',
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});