v4.0.0-beta.9: fix() batch order ws api handling
This commit is contained in:
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "bybit-api",
|
||||
"version": "4.0.0-beta.8",
|
||||
"version": "4.0.0-beta.9",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "bybit-api",
|
||||
"version": "4.0.0-beta.8",
|
||||
"version": "4.0.0-beta.9",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"axios": "^1.7.9",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "bybit-api",
|
||||
"version": "4.0.0-beta.8",
|
||||
"version": "4.0.0-beta.9",
|
||||
"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",
|
||||
|
||||
@@ -78,16 +78,18 @@ export interface BatchCreateOrderResultV5 {
|
||||
createAt: string;
|
||||
}
|
||||
|
||||
export interface BatchOrdersRetExtInfoV5 {
|
||||
list: {
|
||||
code: number;
|
||||
msg: string;
|
||||
}[];
|
||||
}
|
||||
|
||||
export interface BatchOrdersResponseV5<T extends unknown[]> {
|
||||
result: {
|
||||
list: T;
|
||||
};
|
||||
retExtInfo: {
|
||||
list: {
|
||||
code: number;
|
||||
msg: string;
|
||||
}[];
|
||||
};
|
||||
retExtInfo: BatchOrdersRetExtInfoV5;
|
||||
}
|
||||
|
||||
export interface BatchAmendOrderResultV5 {
|
||||
|
||||
@@ -12,10 +12,12 @@ import {
|
||||
BatchCancelOrderResultV5,
|
||||
BatchCreateOrderResultV5,
|
||||
BatchOrdersResponseV5,
|
||||
BatchOrdersRetExtInfoV5,
|
||||
OrderResultV5,
|
||||
} from '../response';
|
||||
import { WsKey } from './ws-general';
|
||||
|
||||
// When new WS API operations are added, make sure to also update WS_API_Operations[] below
|
||||
export type WSAPIOperation =
|
||||
| 'order.create'
|
||||
| 'order.amend'
|
||||
@@ -24,6 +26,15 @@ export type WSAPIOperation =
|
||||
| 'order.amend-batch'
|
||||
| 'order.cancel-batch';
|
||||
|
||||
export const WS_API_Operations: WSAPIOperation[] = [
|
||||
'order.create',
|
||||
'order.amend',
|
||||
'order.cancel',
|
||||
'order.create-batch',
|
||||
'order.amend-batch',
|
||||
'order.cancel-batch',
|
||||
];
|
||||
|
||||
export type WsOperation =
|
||||
| 'subscribe'
|
||||
| 'unsubscribe'
|
||||
@@ -31,12 +42,6 @@ export type WsOperation =
|
||||
| 'ping'
|
||||
| 'pong';
|
||||
|
||||
export const WS_API_Operations: WSAPIOperation[] = [
|
||||
'order.create',
|
||||
'order.amend',
|
||||
'order.cancel',
|
||||
];
|
||||
|
||||
export interface WsRequestOperationBybit<TWSTopic extends string> {
|
||||
req_id: string;
|
||||
op: WsOperation;
|
||||
@@ -100,17 +105,18 @@ export interface WsAPITopicRequestParamMap {
|
||||
'order.create': OrderParamsV5;
|
||||
'order.amend': AmendOrderParamsV5;
|
||||
'order.cancel': CancelOrderParamsV5;
|
||||
|
||||
'order.create-batch': {
|
||||
category: 'option' | 'linear';
|
||||
orders: BatchOrderParamsV5[];
|
||||
request: BatchOrderParamsV5[];
|
||||
};
|
||||
'order.amend-batch': {
|
||||
category: 'option' | 'linear';
|
||||
orders: BatchAmendOrderParamsV5[];
|
||||
request: BatchAmendOrderParamsV5[];
|
||||
};
|
||||
'order.cancel-batch': {
|
||||
category: 'option' | 'linear';
|
||||
orders: BatchCancelOrderParamsV5[];
|
||||
request: BatchCancelOrderParamsV5[];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -121,18 +127,26 @@ export interface WsAPIOperationResponseMap {
|
||||
'order.create': WSAPIResponse<OrderResultV5, 'order.create'>;
|
||||
'order.amend': WSAPIResponse<OrderResultV5, 'order.amend'>;
|
||||
'order.cancel': WSAPIResponse<OrderResultV5, 'order.cancel'>;
|
||||
|
||||
'order.create-batch': WSAPIResponse<
|
||||
BatchOrdersResponseV5<BatchCreateOrderResultV5[]>,
|
||||
{ list: BatchCreateOrderResultV5[] },
|
||||
'order.create-batch'
|
||||
>;
|
||||
> & {
|
||||
retExtInfo: BatchOrdersRetExtInfoV5;
|
||||
};
|
||||
'order.amend-batch': WSAPIResponse<
|
||||
BatchOrdersResponseV5<BatchAmendOrderResultV5[]>,
|
||||
{ list: BatchAmendOrderResultV5[] },
|
||||
'order.amend-batch'
|
||||
>;
|
||||
> & {
|
||||
retExtInfo: BatchOrdersRetExtInfoV5;
|
||||
};
|
||||
'order.cancel-batch': WSAPIResponse<
|
||||
BatchOrdersResponseV5<BatchCancelOrderResultV5[]>,
|
||||
{ list: BatchCancelOrderResultV5[] },
|
||||
'order.cancel-batch'
|
||||
>;
|
||||
> & {
|
||||
retExtInfo: BatchOrdersRetExtInfoV5;
|
||||
};
|
||||
|
||||
ping: {
|
||||
retCode: 0 | number;
|
||||
retMsg: 'OK' | string;
|
||||
|
||||
Reference in New Issue
Block a user