Merge pull request #20 from TYRANTHOSAURUS/futures-client/add-history-positions

v1.1.3 Added get history positions to bitget futures client
This commit is contained in:
Tiago
2023-09-11 10:38:40 +01:00
committed by GitHub
3 changed files with 19 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "bitget-api", "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.", "description": "Node.js connector for Bitget REST APIs and WebSockets, with TypeScript & end-to-end tests.",
"main": "lib/index.js", "main": "lib/index.js",
"types": "lib/index.d.ts", "types": "lib/index.d.ts",
@@ -68,4 +68,4 @@
"url": "https://github.com/tiagosiebler/bitget-api/issues" "url": "https://github.com/tiagosiebler/bitget-api/issues"
}, },
"homepage": "https://github.com/tiagosiebler/bitget-api#readme" "homepage": "https://github.com/tiagosiebler/bitget-api#readme"
} }

View File

@@ -24,6 +24,7 @@ import {
FuturesMarketTrade, FuturesMarketTrade,
FuturesPlanType, FuturesPlanType,
FuturesKlineInterval, FuturesKlineInterval,
FuturesHistoricPositions,
} from './types'; } from './types';
import { REST_CLIENT_TYPE_ENUM } from './util'; import { REST_CLIENT_TYPE_ENUM } from './util';
import BaseRestClient from './util/BaseRestClient'; import BaseRestClient from './util/BaseRestClient';
@@ -316,6 +317,13 @@ export class FuturesClient extends BaseRestClient {
}); });
} }
/** Get All historic positions, only supports Query within 3 months */
getHistoryPositions(
params: FuturesHistoricPositions,
): Promise<APIResponse<FuturesPosition[]>> {
return this.getPrivate('/api/mix/v1/position/history-position', params);
}
/** Get Account Bill */ /** Get Account Bill */
getAccountBill(params: FuturesAccountBillRequest): Promise<APIResponse<any>> { getAccountBill(params: FuturesAccountBillRequest): Promise<APIResponse<any>> {
return this.getPrivate('/api/mix/v1/account/accountBill', params); return this.getPrivate('/api/mix/v1/account/accountBill', params);

View File

@@ -88,6 +88,15 @@ export interface NewBatchFuturesOrder {
clientOid?: string; clientOid?: string;
} }
export interface FuturesHistoricPositions {
startTime: string;
endTime: string;
productType?: FuturesProductType;
symbol?: string;
pageSize?: number;
lastEndId?: string;
}
export interface FuturesPagination { export interface FuturesPagination {
startTime?: string; startTime?: string;
endTime?: string; endTime?: string;