From afbaa22cfb08e35f1ddfc4e7b1639feae7b13a0b Mon Sep 17 00:00:00 2001 From: TYRANTHOSAURUS Date: Fri, 1 Sep 2023 23:47:51 +0200 Subject: [PATCH 1/3] Added getHistoryPositions() to the Bitget futures client --- src/futures-client.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/futures-client.ts b/src/futures-client.ts index 0fae4b7..daa4ffe 100644 --- a/src/futures-client.ts +++ b/src/futures-client.ts @@ -316,6 +316,25 @@ export class FuturesClient extends BaseRestClient { }); } + /** Get All historic positions, only supports Query within 3 monthso */ + getHistoryPositions( + startTime: string, + endTime: string, + productType?: FuturesProductType, + symbol?: string, + pageSize?: number, + lastEndId?: string, + ): Promise> { + return this.getPrivate('/api/mix/v1/position/history-position', { + startTime, + endTime, + productType, + symbol, + pageSize, + lastEndId, + }); + } + /** Get Account Bill */ getAccountBill(params: FuturesAccountBillRequest): Promise> { return this.getPrivate('/api/mix/v1/account/accountBill', params); From 5441d7f6dc4d2883c681de6582dee8134c98f3f0 Mon Sep 17 00:00:00 2001 From: TYRANTHOSAURUS Date: Fri, 1 Sep 2023 23:50:22 +0200 Subject: [PATCH 2/3] Updated package.json to version 1.1.3 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1846d47..038a206 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bitget-api", - "version": "1.1.2", + "version": "1.1.3", "description": "Node.js connector for Bitget REST APIs and WebSockets, with TypeScript & end-to-end tests.", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -68,4 +68,4 @@ "url": "https://github.com/tiagosiebler/bitget-api/issues" }, "homepage": "https://github.com/tiagosiebler/bitget-api#readme" -} +} \ No newline at end of file From 51cb5d70f6ec81c264844e02810f380b359d9c12 Mon Sep 17 00:00:00 2001 From: TYRANTHOSAURUS Date: Mon, 4 Sep 2023 23:55:15 +0200 Subject: [PATCH 3/3] Updated types with params type FuturesHistoricPositions --- src/futures-client.ts | 19 ++++--------------- src/types/request/futures.ts | 9 +++++++++ 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/futures-client.ts b/src/futures-client.ts index daa4ffe..1cd2e48 100644 --- a/src/futures-client.ts +++ b/src/futures-client.ts @@ -24,6 +24,7 @@ import { FuturesMarketTrade, FuturesPlanType, FuturesKlineInterval, + FuturesHistoricPositions, } from './types'; import { REST_CLIENT_TYPE_ENUM } from './util'; import BaseRestClient from './util/BaseRestClient'; @@ -316,23 +317,11 @@ export class FuturesClient extends BaseRestClient { }); } - /** Get All historic positions, only supports Query within 3 monthso */ + /** Get All historic positions, only supports Query within 3 months */ getHistoryPositions( - startTime: string, - endTime: string, - productType?: FuturesProductType, - symbol?: string, - pageSize?: number, - lastEndId?: string, + params: FuturesHistoricPositions, ): Promise> { - return this.getPrivate('/api/mix/v1/position/history-position', { - startTime, - endTime, - productType, - symbol, - pageSize, - lastEndId, - }); + return this.getPrivate('/api/mix/v1/position/history-position', params); } /** Get Account Bill */ diff --git a/src/types/request/futures.ts b/src/types/request/futures.ts index 07273c1..865c234 100644 --- a/src/types/request/futures.ts +++ b/src/types/request/futures.ts @@ -88,6 +88,15 @@ export interface NewBatchFuturesOrder { clientOid?: string; } +export interface FuturesHistoricPositions { + startTime: string; + endTime: string; + productType?: FuturesProductType; + symbol?: string; + pageSize?: number; + lastEndId?: string; +} + export interface FuturesPagination { startTime?: string; endTime?: string;