feat(v4.0.0-beta.8): add support for new Websocket API batch order commands

This commit is contained in:
tiagosiebler
2025-02-26 10:33:13 +00:00
parent 5005b816b3
commit 446db1ae2c
3 changed files with 36 additions and 8 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "bybit-api", "name": "bybit-api",
"version": "4.0.0-beta.7", "version": "4.0.0-beta.8",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "bybit-api", "name": "bybit-api",
"version": "4.0.0-beta.7", "version": "4.0.0-beta.8",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"axios": "^1.7.9", "axios": "^1.7.9",

View File

@@ -1,6 +1,6 @@
{ {
"name": "bybit-api", "name": "bybit-api",
"version": "4.0.0-beta.7", "version": "4.0.0-beta.8",
"description": "Complete & robust Node.js SDK for Bybit's REST APIs and WebSockets, with TypeScript & strong end to end tests.", "description": "Complete & robust Node.js SDK for Bybit's REST APIs and WebSockets, with TypeScript & strong end to end tests.",
"main": "lib/index.js", "main": "lib/index.js",
"types": "lib/index.d.ts", "types": "lib/index.d.ts",
@@ -20,9 +20,7 @@
"betapublish": "npm publish --tag beta" "betapublish": "npm publish --tag beta"
}, },
"author": "Tiago Siebler (https://github.com/tiagosiebler)", "author": "Tiago Siebler (https://github.com/tiagosiebler)",
"contributors": [ "contributors": [],
"Stefan Aebischer <os@pixtron.ch> (https://pixtron.ch)"
],
"dependencies": { "dependencies": {
"axios": "^1.7.9", "axios": "^1.7.9",
"isomorphic-ws": "^4.0.1", "isomorphic-ws": "^4.0.1",

View File

@@ -1,13 +1,28 @@
import { APIID, WS_KEY_MAP } from '../../util'; import { APIID, WS_KEY_MAP } from '../../util';
import { import {
AmendOrderParamsV5, AmendOrderParamsV5,
BatchAmendOrderParamsV5,
BatchCancelOrderParamsV5,
BatchOrderParamsV5,
CancelOrderParamsV5, CancelOrderParamsV5,
OrderParamsV5, OrderParamsV5,
} from '../request'; } from '../request';
import { OrderResultV5 } from '../response'; import {
BatchAmendOrderResultV5,
BatchCancelOrderResultV5,
BatchCreateOrderResultV5,
BatchOrdersResponseV5,
OrderResultV5,
} from '../response';
import { WsKey } from './ws-general'; import { WsKey } from './ws-general';
export type WSAPIOperation = 'order.create' | 'order.amend' | 'order.cancel'; export type WSAPIOperation =
| 'order.create'
| 'order.amend'
| 'order.cancel'
| 'order.create-batch'
| 'order.amend-batch'
| 'order.cancel-batch';
export type WsOperation = export type WsOperation =
| 'subscribe' | 'subscribe'
@@ -85,6 +100,9 @@ export interface WsAPITopicRequestParamMap {
'order.create': OrderParamsV5; 'order.create': OrderParamsV5;
'order.amend': AmendOrderParamsV5; 'order.amend': AmendOrderParamsV5;
'order.cancel': CancelOrderParamsV5; 'order.cancel': CancelOrderParamsV5;
'order.create-batch': BatchOrderParamsV5[];
'order.amend-batch': BatchAmendOrderParamsV5[];
'order.cancel-batch': BatchCancelOrderParamsV5[];
} }
/** /**
@@ -94,6 +112,18 @@ export interface WsAPIOperationResponseMap {
'order.create': WSAPIResponse<OrderResultV5, 'order.create'>; 'order.create': WSAPIResponse<OrderResultV5, 'order.create'>;
'order.amend': WSAPIResponse<OrderResultV5, 'order.amend'>; 'order.amend': WSAPIResponse<OrderResultV5, 'order.amend'>;
'order.cancel': WSAPIResponse<OrderResultV5, 'order.cancel'>; 'order.cancel': WSAPIResponse<OrderResultV5, 'order.cancel'>;
'order.create-batch': WSAPIResponse<
BatchOrdersResponseV5<BatchCreateOrderResultV5[]>,
'order.create-batch'
>;
'order.amend-batch': WSAPIResponse<
BatchOrdersResponseV5<BatchAmendOrderResultV5[]>,
'order.amend-batch'
>;
'order.cancel-batch': WSAPIResponse<
BatchOrdersResponseV5<BatchCancelOrderResultV5[]>,
'order.cancel-batch'
>;
ping: { ping: {
retCode: 0 | number; retCode: 0 | number;
retMsg: 'OK' | string; retMsg: 'OK' | string;