Skip to content

Commit 4d7dd8e

Browse files
committed
feat(v3.0.3): add new V3 endpoints
1 parent 15f9ee5 commit 4d7dd8e

File tree

7 files changed

+82
-4
lines changed

7 files changed

+82
-4
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bitget-api",
3-
"version": "3.0.2",
3+
"version": "3.0.3",
44
"description": "Complete Node.js & JavaScript SDK for Bitget V1-V3 REST APIs & WebSockets, with TypeScript & end-to-end tests.",
55
"scripts": {
66
"test": "jest",

src/rest-client-v3.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
GetTransferableCoinsRequestV3,
1919
GetWithdrawRecordsRequestV3,
2020
RepayRequestV3,
21+
SetDepositAccountRequestV3,
2122
SetLeverageRequestV3,
2223
SubAccountTransferRequestV3,
2324
SwitchDeductRequestV3,
@@ -93,6 +94,7 @@ import {
9394
SubAccountV3,
9495
SubTransferRecordV3,
9596
SubUnifiedAssetV3,
97+
SwitchStatusResponseV3,
9698
TransferResponseV3,
9799
UpdateSubAccountApiKeyResponseV3,
98100
WithdrawRecordV3,
@@ -119,6 +121,7 @@ import {
119121
OpenInterestV3,
120122
OrderBookV3,
121123
PositionTierV3,
124+
ProofOfReservesV3,
122125
PublicFillV3,
123126
RiskReserveV3,
124127
TickerV3,
@@ -142,6 +145,7 @@ import {
142145
OrderInfoV3,
143146
PlaceBatchOrdersResponseV3,
144147
PlaceOrderResponseV3,
148+
PositionAdlRankV3,
145149
PositionHistoryV3,
146150
UnfilledOrderV3,
147151
} from './types/response/v3/trade.js';
@@ -278,6 +282,13 @@ export class RestClientV3 extends BaseRestClient {
278282
return this.get('/api/v3/market/fills', params);
279283
}
280284

285+
/**
286+
* Get Proof Of Reserves
287+
*/
288+
getProofOfReserves(): Promise<APIResponse<ProofOfReservesV3>> {
289+
return this.get('/api/v3/market/proof-of-reserves');
290+
}
291+
281292
/**
282293
* Get Open Interest
283294
*/
@@ -466,6 +477,18 @@ export class RestClientV3 extends BaseRestClient {
466477
return this.getPrivate('/api/v3/account/convert-records', params);
467478
}
468479

480+
/**
481+
* Set up deposit account - Configure default recharge account for a certain symbol
482+
* This configuration item remains valid for a long time. That is, once a user sets a default
483+
* recharge account for a certain symbol, it will be retained permanently, and there is no need to reconfigure it.
484+
* Permission: UTA mgt. (read & write)
485+
*/
486+
setDepositAccount(
487+
params: SetDepositAccountRequestV3,
488+
): Promise<APIResponse<string>> {
489+
return this.postPrivate('/api/v3/account/deposit-account', params);
490+
}
491+
469492
/**
470493
* Switch Deduct - Set BGB deduction
471494
*/
@@ -496,6 +519,27 @@ export class RestClientV3 extends BaseRestClient {
496519
return this.getPrivate('/api/v3/account/fee-rate', params);
497520
}
498521

522+
/**
523+
* Switch Account - Switch to classic account mode
524+
* Only supports parent accounts.
525+
* This endpoint is only used for switching to classic account mode.
526+
* Please note that since the account switching process takes approximately 1 minute,
527+
* the successful response you receive only indicates that the request has been received,
528+
* and does not mean that the account has been successfully switched to the classic account.
529+
* Please use the query switching status interface to confirm whether the account switching is successful.
530+
*/
531+
switchAccount(): Promise<APIResponse<null>> {
532+
return this.postPrivate('/api/v3/account/switch');
533+
}
534+
535+
/**
536+
* Get Switch Status - Get account switching status
537+
* Only supports parent accounts.
538+
*/
539+
getSwitchStatus(): Promise<APIResponse<SwitchStatusResponseV3>> {
540+
return this.getPrivate('/api/v3/account/switch-status');
541+
}
542+
499543
/**
500544
*
501545
* =====SubAccount======= endpoints
@@ -851,6 +895,13 @@ export class RestClientV3 extends BaseRestClient {
851895
return this.postPrivate('/api/v3/account/max-open-available', params);
852896
}
853897

898+
/**
899+
* Get Position ADL Rank - Get position auto-deleveraging ranking
900+
*/
901+
getPositionAdlRank(): Promise<APIResponse<PositionAdlRankV3[]>> {
902+
return this.getPrivate('/api/v3/position/adlRank');
903+
}
904+
854905
/**
855906
* CountDown Cancel All
856907
*/

src/types/request/v3/account.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,3 +250,8 @@ export interface GetWithdrawRecordsRequestV3 {
250250
limit?: string;
251251
cursor?: string;
252252
}
253+
254+
export interface SetDepositAccountRequestV3 {
255+
coin: string;
256+
accountType: 'funding' | 'unified' | 'otc';
257+
}

src/types/response/v3/account.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,3 +227,7 @@ export interface WithdrawRecordV3 {
227227
createdTime: string;
228228
updatedTime: string;
229229
}
230+
231+
export interface SwitchStatusResponseV3 {
232+
status: 'processProcessing' | 'successSuccess' | 'failFailed';
233+
}

src/types/response/v3/public.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export interface PositionTierV3 {
7272
}
7373

7474
export interface RiskReserveRecordV3 {
75-
type: 'in' | 'out';
75+
balance: string;
7676
amount: string;
7777
ts: string;
7878
}
@@ -166,3 +166,14 @@ export interface TickerV3 {
166166
deliveryTime?: string;
167167
deliveryStatus?: string;
168168
}
169+
170+
export interface ProofOfReservesV3 {
171+
merkleRootHash: string;
172+
totalReserveRatio: string;
173+
list: {
174+
coin: string;
175+
userAssets: string;
176+
platformAssets: string;
177+
reserveRatio: string;
178+
}[];
179+
}

src/types/response/v3/trade.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,3 +206,10 @@ export interface PlaceOrderResponseV3 {
206206
orderId: string;
207207
clientOid: string;
208208
}
209+
210+
export interface PositionAdlRankV3 {
211+
symbol: string;
212+
marginCoin: string;
213+
adlRank: string;
214+
holdSide: 'long' | 'short';
215+
}

0 commit comments

Comments
 (0)