feat(v4.1.5): updated latency check to look at absolute values, fixed batch order responses, updated new endpoints

This commit is contained in:
JJ-Cro
2025-04-25 12:18:53 +02:00
parent dd54e8a0ed
commit 5fbe3908ce
9 changed files with 211 additions and 213 deletions

View File

@@ -20,10 +20,7 @@ import {
ApiKeyInfoV5,
AssetInfoV5,
BatchAmendOrderParamsV5,
BatchAmendOrderResultV5,
BatchCancelOrderParamsV5,
BatchCancelOrderResultV5,
BatchCreateOrderResultV5,
BatchOrderParamsV5,
BatchOrdersResponseV5,
BorrowCryptoLoanParamsV5,
@@ -290,7 +287,7 @@ export class RestClientV5 extends BaseRestClient {
`,
);
if (timeDifference > 500) {
if (Math.abs(timeDifference) > 500) {
console.warn(
`WARNING! Time difference between server and client clock is greater than 500ms. It is currently ${timeDifference}ms.
Consider adjusting your system clock to avoid unwanted clock sync errors!
@@ -811,9 +808,7 @@ export class RestClientV5 extends BaseRestClient {
batchSubmitOrders(
category: 'option' | 'linear',
orders: BatchOrderParamsV5[],
): Promise<
APIResponseV3WithTime<BatchOrdersResponseV5<BatchCreateOrderResultV5[]>>
> {
): Promise<BatchOrdersResponseV5> {
return this.postPrivate('/v5/order/create-batch', {
category,
request: orders,
@@ -831,9 +826,7 @@ export class RestClientV5 extends BaseRestClient {
batchAmendOrders(
category: 'option' | 'linear',
orders: BatchAmendOrderParamsV5[],
): Promise<
APIResponseV3WithTime<BatchOrdersResponseV5<BatchAmendOrderResultV5[]>>
> {
): Promise<BatchOrdersResponseV5> {
return this.postPrivate('/v5/order/amend-batch', {
category,
request: orders,
@@ -851,9 +844,7 @@ export class RestClientV5 extends BaseRestClient {
batchCancelOrders(
category: 'option' | 'linear',
orders: BatchCancelOrderParamsV5[],
): Promise<
APIResponseV3WithTime<BatchOrdersResponseV5<BatchCancelOrderResultV5[]>>
> {
): Promise<BatchOrdersResponseV5> {
return this.postPrivate('/v5/order/cancel-batch', {
category,
request: orders,

View File

@@ -119,6 +119,7 @@ export interface TransactionLogV5 {
tradeId: string;
orderId: string;
orderLinkId: string;
transSubType: string;
}
export interface MMPStateV5 {

View File

@@ -233,6 +233,7 @@ export interface ConvertQuoteV5 {
toAmount: string;
expiredTime: string;
requestId: string;
extTaxAndFee: string[];
}
export interface ConvertStatusV5 {

View File

@@ -93,6 +93,7 @@ export interface LinearInverseInstrumentInfoV5 {
makerFeeRate: string;
};
} | null;
displayName: string;
}
export interface OptionInstrumentInfoV5 {
@@ -115,6 +116,7 @@ export interface OptionInstrumentInfoV5 {
minOrderQty: string;
qtyStep: string;
};
displayName: string;
}
export interface SpotInstrumentInfoV5 {

View File

@@ -77,7 +77,6 @@ export interface SpreadOrderHistoryV5 {
orderStatus: 'Rejected' | 'Cancelled' | 'Filled';
price: string;
orderQty: string;
orderPrice: string;
timeInForce: 'GTC' | 'FOK' | 'IOC' | 'PostOnly';
baseCoin: string;
createdAt: string;
@@ -95,6 +94,7 @@ export interface SpreadOrderHistoryV5 {
leg2OrderId: string;
leg2Symbol: string;
leg2Side: string;
cxlRejReason: string;
}
export interface SpreadTradeLegV5 {

View File

@@ -85,11 +85,14 @@ export interface BatchOrdersRetExtInfoV5 {
}[];
}
export interface BatchOrdersResponseV5<T extends unknown[]> {
export interface BatchOrdersResponseV5 {
retCode: number;
retMsg: 'OK' | string;
result: {
list: T;
list: BatchCreateOrderResultV5[];
};
retExtInfo: BatchOrdersRetExtInfoV5;
time: number;
}
export interface BatchAmendOrderResultV5 {