From 446db1ae2c6f2b78ac68a75af797bdc71c698df6 Mon Sep 17 00:00:00 2001 From: tiagosiebler Date: Wed, 26 Feb 2025 10:33:13 +0000 Subject: [PATCH] feat(v4.0.0-beta.8): add support for new Websocket API batch order commands --- package-lock.json | 4 ++-- package.json | 6 ++---- src/types/websockets/ws-api.ts | 34 ++++++++++++++++++++++++++++++++-- 3 files changed, 36 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 204ddab..5f09f6b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "bybit-api", - "version": "4.0.0-beta.7", + "version": "4.0.0-beta.8", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "bybit-api", - "version": "4.0.0-beta.7", + "version": "4.0.0-beta.8", "license": "MIT", "dependencies": { "axios": "^1.7.9", diff --git a/package.json b/package.json index faa2c9b..d9842b4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "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.", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -20,9 +20,7 @@ "betapublish": "npm publish --tag beta" }, "author": "Tiago Siebler (https://github.com/tiagosiebler)", - "contributors": [ - "Stefan Aebischer (https://pixtron.ch)" - ], + "contributors": [], "dependencies": { "axios": "^1.7.9", "isomorphic-ws": "^4.0.1", diff --git a/src/types/websockets/ws-api.ts b/src/types/websockets/ws-api.ts index f47c562..c0d5295 100644 --- a/src/types/websockets/ws-api.ts +++ b/src/types/websockets/ws-api.ts @@ -1,13 +1,28 @@ import { APIID, WS_KEY_MAP } from '../../util'; import { AmendOrderParamsV5, + BatchAmendOrderParamsV5, + BatchCancelOrderParamsV5, + BatchOrderParamsV5, CancelOrderParamsV5, OrderParamsV5, } from '../request'; -import { OrderResultV5 } from '../response'; +import { + BatchAmendOrderResultV5, + BatchCancelOrderResultV5, + BatchCreateOrderResultV5, + BatchOrdersResponseV5, + OrderResultV5, +} from '../response'; 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 = | 'subscribe' @@ -85,6 +100,9 @@ export interface WsAPITopicRequestParamMap { 'order.create': OrderParamsV5; 'order.amend': AmendOrderParamsV5; '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; 'order.amend': WSAPIResponse; 'order.cancel': WSAPIResponse; + 'order.create-batch': WSAPIResponse< + BatchOrdersResponseV5, + 'order.create-batch' + >; + 'order.amend-batch': WSAPIResponse< + BatchOrdersResponseV5, + 'order.amend-batch' + >; + 'order.cancel-batch': WSAPIResponse< + BatchOrdersResponseV5, + 'order.cancel-batch' + >; ping: { retCode: 0 | number; retMsg: 'OK' | string;