feat(): updated types for Market and Trade categories

This commit is contained in:
JJ-Cro
2025-02-17 12:14:14 +01:00
parent 7ebad90e7f
commit a521338091
7 changed files with 38 additions and 15 deletions

View File

@@ -551,7 +551,9 @@ export class RestClientV5 extends BaseRestClient {
cancelAllOrders( cancelAllOrders(
params: CancelAllOrdersParamsV5, params: CancelAllOrdersParamsV5,
): Promise<APIResponseV3WithTime<{ list: OrderResultV5[] }>> { ): Promise<
APIResponseV3WithTime<{ list: OrderResultV5[]; success: string }>
> {
return this.postPrivate('/v5/order/cancel-all', params); return this.postPrivate('/v5/order/cancel-all', params);
} }
@@ -566,6 +568,18 @@ export class RestClientV5 extends BaseRestClient {
return this.getPrivate('/v5/order/history', params); return this.getPrivate('/v5/order/history', params);
} }
/**
* Query users' execution records, sorted by execTime in descending order
*
* Unified account covers: Spot / Linear contract / Options
* Normal account covers: USDT perpetual / Inverse perpetual / Inverse futures
*/
getExecutionList(
params: GetExecutionListParamsV5,
): Promise<APIResponseV3WithTime<CategoryCursorListV5<ExecutionV5[]>>> {
return this.getPrivate('/v5/execution/list', params);
}
/** /**
* This endpoint allows you to place more than one order in a single request. * This endpoint allows you to place more than one order in a single request.
* Covers: Option (UTA, UTA Pro) / USDT Perpetual, UDSC Perpetual, USDC Futures (UTA Pro) * Covers: Option (UTA, UTA Pro) / USDT Perpetual, UDSC Perpetual, USDC Futures (UTA Pro)
@@ -675,7 +689,7 @@ export class RestClientV5 extends BaseRestClient {
* Only for institutional clients! * Only for institutional clients!
*/ */
setDisconnectCancelAllWindowV2(params: { setDisconnectCancelAllWindowV2(params: {
product: 'OPTION' | 'SPOT' | 'DERIVATIVES'; product?: 'OPTION' | 'SPOT' | 'DERIVATIVES';
timeWindow: number; timeWindow: number;
}): Promise<APIResponseV3<undefined>> { }): Promise<APIResponseV3<undefined>> {
return this.postPrivate('/v5/order/disconnected-cancel-all', params); return this.postPrivate('/v5/order/disconnected-cancel-all', params);
@@ -811,18 +825,6 @@ export class RestClientV5 extends BaseRestClient {
return this.postPrivate('/v5/position/add-margin', params); return this.postPrivate('/v5/position/add-margin', params);
} }
/**
* Query users' execution records, sorted by execTime in descending order
*
* Unified account covers: Spot / Linear contract / Options
* Normal account covers: USDT perpetual / Inverse perpetual / Inverse futures
*/
getExecutionList(
params: GetExecutionListParamsV5,
): Promise<APIResponseV3WithTime<CategoryCursorListV5<ExecutionV5[]>>> {
return this.getPrivate('/v5/execution/list', params);
}
/** /**
* Query user's closed profit and loss records. The results are sorted by createdTime in descending order. * Query user's closed profit and loss records. The results are sorted by createdTime in descending order.
* *

View File

@@ -108,6 +108,7 @@ export interface GetInsuranceParamsV5 {
export interface GetRiskLimitParamsV5 { export interface GetRiskLimitParamsV5 {
category?: 'linear' | 'inverse'; category?: 'linear' | 'inverse';
symbol?: string; symbol?: string;
cursor?: string;
} }
export interface GetOptionDeliveryPriceParamsV5 { export interface GetOptionDeliveryPriceParamsV5 {

View File

@@ -8,6 +8,7 @@ import {
OrderTriggerByV5, OrderTriggerByV5,
OrderTypeV5, OrderTypeV5,
PositionIdx, PositionIdx,
StopOrderTypeV5,
} from '../shared-v5'; } from '../shared-v5';
export interface OrderParamsV5 { export interface OrderParamsV5 {
@@ -51,6 +52,7 @@ export interface AmendOrderParamsV5 {
triggerPrice?: string; triggerPrice?: string;
qty?: string; qty?: string;
price?: string; price?: string;
tpslMode?: 'Full' | 'Partial';
takeProfit?: string; takeProfit?: string;
stopLoss?: string; stopLoss?: string;
tpTriggerBy?: OrderTriggerByV5; tpTriggerBy?: OrderTriggerByV5;
@@ -86,6 +88,7 @@ export interface GetAccountHistoricOrdersParamsV5 {
category: CategoryV5; category: CategoryV5;
symbol?: string; symbol?: string;
baseCoin?: string; baseCoin?: string;
settleCoin?: string;
orderId?: string; orderId?: string;
orderLinkId?: string; orderLinkId?: string;
orderFilter?: OrderFilterV5; orderFilter?: OrderFilterV5;
@@ -102,11 +105,13 @@ export interface CancelAllOrdersParamsV5 {
baseCoin?: string; baseCoin?: string;
settleCoin?: string; settleCoin?: string;
orderFilter?: OrderFilterV5; orderFilter?: OrderFilterV5;
stopOrderType?: StopOrderTypeV5;
} }
export interface BatchOrderParamsV5 { export interface BatchOrderParamsV5 {
symbol: string; symbol: string;
side: OrderSideV5; side: OrderSideV5;
isLeverage?: 0 | 1;
orderType: OrderTypeV5; orderType: OrderTypeV5;
qty: string; qty: string;
price?: string; price?: string;

View File

@@ -163,6 +163,8 @@ export interface OrderbookResponseV5 {
a: OrderbookLevelV5[]; a: OrderbookLevelV5[];
ts: number; ts: number;
u: number; u: number;
seq: number;
cts: number;
} }
export interface TickerLinearInverseV5 { export interface TickerLinearInverseV5 {
@@ -192,6 +194,7 @@ export interface TickerLinearInverseV5 {
preOpenPrice: string; preOpenPrice: string;
preQty: string; preQty: string;
curPreListingPhase: string; curPreListingPhase: string;
basis: string;
} }
export interface TickerOptionV5 { export interface TickerOptionV5 {
@@ -252,6 +255,10 @@ export interface PublicTradeV5 {
side: OrderSideV5; side: OrderSideV5;
time: string; time: string;
isBlockTrade: boolean; isBlockTrade: boolean;
mP?: string;
iP?: string;
mIv?: string;
iv?: string;
} }
/** /**
@@ -279,6 +286,7 @@ export interface HistoricalVolatilityV5 {
export interface InsuranceDataV5 { export interface InsuranceDataV5 {
coin: string; coin: string;
symbols: string;
balance: string; balance: string;
value: string; value: string;
} }
@@ -299,6 +307,7 @@ export interface RiskLimitV5 {
isLowestRisk: 0 | 1; isLowestRisk: 0 | 1;
maxLeverage: string; maxLeverage: string;
mmDeduction: string; mmDeduction: string;
nextPageCursor?: string;
} }
/** @deprecated use DeliveryPriceV5 instead */ /** @deprecated use DeliveryPriceV5 instead */

View File

@@ -108,6 +108,7 @@ export interface ExecutionV5 {
underlyingPrice?: string; underlyingPrice?: string;
blockTradeId?: string; blockTradeId?: string;
closedSize?: string; closedSize?: string;
seq: number;
} }
export interface ClosedPnLV5 { export interface ClosedPnLV5 {

View File

@@ -107,5 +107,7 @@ export interface SpotBorrowCheckResultV5 {
side: OrderSideV5; side: OrderSideV5;
maxTradeQty: string; maxTradeQty: string;
maxTradeAmount: string; maxTradeAmount: string;
spotMaxTradeQty: string;
spotMaxTradeAmount: string;
borrowCoin: string; borrowCoin: string;
} }

View File

@@ -142,7 +142,10 @@ export type StopOrderTypeV5 =
| 'Stop' | 'Stop'
| 'PartialTakeProfit' | 'PartialTakeProfit'
| 'PartialStopLoss' | 'PartialStopLoss'
| 'tpslOrder'; | 'tpslOrder'
| 'OcoOrder'
| 'MmRateClose'
| 'BidirectionalTpslOrder';
/** /**
* Position index. Used to identify positions in different position modes. * Position index. Used to identify positions in different position modes.