diff --git a/src/rest-client-v5.ts b/src/rest-client-v5.ts index 2d4fabb..1080c60 100644 --- a/src/rest-client-v5.ts +++ b/src/rest-client-v5.ts @@ -69,6 +69,9 @@ import { GetOpenInterestParamsV5, GetOptionDeliveryPriceParamsV5, GetOrderbookParamsV5, + GetPreUpgradeClosedPnlParamsV5, + GetPreUpgradeOrderHistoryParamsV5, + GetPreUpgradeTradeHistoryParamsV5, GetPremiumIndexPriceKlineParamsV5, GetPublicTradingHistoryParamsV5, GetRiskLimitParamsV5, @@ -656,6 +659,52 @@ export class RestClientV5 extends BaseRestClient { return this.getPrivate('/v5/position/closed-pnl', params); } + /** + * + ****** Pre-upgrade APIs + * + */ + + /** + * Get those orders which occurred before you upgrade the account to Unified account. + * + * For now, it only supports to query USDT perpetual, USDC perpetual, Inverse perpetual and futures. + * + * - can get all status in 7 days + * - can only get filled orders beyond 7 days + */ + getPreUpgradeOrderHistory( + params: GetPreUpgradeOrderHistoryParamsV5, + ): Promise>> { + return this.getPrivate('/v5/pre-upgrade/order/history', params); + } + + /** + * Get users' execution records which occurred before you upgrade the account to Unified account, sorted by execTime in descending order + * + * For now, it only supports to query USDT perpetual, Inverse perpetual and futures. + * + * - You may have multiple executions in a single order. + * - You can query by symbol, baseCoin, orderId and orderLinkId, and if you pass multiple params, + * the system will process them according to this priority: orderId > orderLinkId > symbol > baseCoin. + */ + getPreUpgradeTradeHistory( + params: GetPreUpgradeTradeHistoryParamsV5, + ): Promise>> { + return this.getPrivate('/v5/pre-upgrade/execution/list', params); + } + + /** + * Query user's closed profit and loss records. The results are sorted by createdTime in descending order. + * + * For now, it only supports to query USDT perpetual, Inverse perpetual and futures. + */ + getPreUpgradeClosedPnl( + params: GetPreUpgradeClosedPnlParamsV5, + ): Promise>> { + return this.getPrivate('/v5/pre-upgrade/position/closed-pnl', params); + } + /** * ****** Account APIs diff --git a/src/types/request/index.ts b/src/types/request/index.ts index 75f8d45..be15ddc 100644 --- a/src/types/request/index.ts +++ b/src/types/request/index.ts @@ -12,6 +12,7 @@ export * from './v5-account'; export * from './v5-asset'; export * from './v5-market'; export * from './v5-position'; +export * from './v5-pre-upgrade'; export * from './v5-trade'; export * from './v5-user'; export * from './v5-spot-leverage-token'; diff --git a/src/types/request/v5-pre-upgrade.ts b/src/types/request/v5-pre-upgrade.ts new file mode 100644 index 0000000..1cb7201 --- /dev/null +++ b/src/types/request/v5-pre-upgrade.ts @@ -0,0 +1,37 @@ +import { ExecTypeV5 } from '../v5-shared'; + +export interface GetPreUpgradeOrderHistoryParamsV5 { + category: 'linear' | 'inverse'; + symbol?: string; + baseCoin?: string; + orderId?: string; + orderLinkId?: string; + orderFilter?: 'Order' | 'StopOrder'; + orderStatus?: string; + startTime?: number; + endTime?: number; + limit?: number; + cursor?: string; +} + +export interface GetPreUpgradeTradeHistoryParamsV5 { + category: 'linear' | 'inverse'; + symbol?: string; + orderId?: string; + orderLinkId?: string; + baseCoin?: string; + startTime?: number; + endTime?: number; + execType?: ExecTypeV5; + limit?: number; + cursor?: string; +} + +export interface GetPreUpgradeClosedPnlParamsV5 { + category: 'linear' | 'inverse'; + symbol: string; + startTime?: number; + endTime?: number; + limit?: number; + cursor?: string; +} diff --git a/src/types/response/v5-position.ts b/src/types/response/v5-position.ts index 0ea3a00..66fd0a6 100644 --- a/src/types/response/v5-position.ts +++ b/src/types/response/v5-position.ts @@ -94,6 +94,7 @@ export interface ExecutionV5 { indexPrice: string; underlyingPrice?: string; blockTradeId?: string; + closedSize?: string; } export interface ClosedPnLV5 {