bitget-api 3.1.9 → 3.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/llms.txt CHANGED
@@ -49,7 +49,7 @@ Notes:
49
49
  Directory Structure
50
50
  ================================================================
51
51
  examples/
52
- Auth/
52
+ auth/
53
53
  fasterHmacSign.ts
54
54
  rest-private-rsa.md
55
55
  rest-private-rsa.ts
@@ -157,76 +157,7 @@ Files
157
157
  ================================================================
158
158
 
159
159
  ================
160
- File: examples/Auth/fasterHmacSign.ts
161
- ================
162
- import { createHmac } from 'crypto';
163
- ⋮----
164
- import {
165
- DefaultLogger,
166
- RestClientV3,
167
- WebsocketClientV3,
168
- } from '../../src/index.js';
169
- ⋮----
170
- // or
171
- // import { createHmac } from 'crypto';
172
- // import { DefaultLogger, RestClientV3, WebsocketClientV3 } from 'bitget-api';
173
- ⋮----
174
- /**
175
- * Injecting a custom signMessage function.
176
- *
177
- * As of version 3.0.0 of the bitget-api Node.js/TypeScript/JavaScript
178
- * SDK for Bitget, the SDK uses the Web Crypto API for signing requests.
179
- * While it is compatible with Node and Browser environments, it is
180
- * slightly slower than using Node's native crypto module (only
181
- * available in backend Node environments).
182
- *
183
- * For latency sensitive users, you can inject the previous node crypto sign
184
- * method (or your own even faster implementation), if this change affects you.
185
- *
186
- * This example demonstrates how to inject a custom sign function, to achieve
187
- * the same peformance as seen before the Web Crypto API was introduced.
188
- *
189
- * For context on standard usage, the "signMessage" function is used:
190
- * - During every single API call
191
- * - After opening a new private WebSocket connection
192
- */
193
- ⋮----
194
- /**
195
- * Set this to true to enable demo trading:
196
- */
197
- ⋮----
198
- /**
199
- * Overkill in almost every case, but if you need any optimisation available,
200
- * you can inject a faster sign mechanism such as node's native createHmac:
201
- */
202
- ⋮----
203
- // Optional, uncomment the "trace" override to log a lot more info about what the WS client is doing
204
- ⋮----
205
- // trace: (...params) => console.log('trace', ...params),
206
- ⋮----
207
- /**
208
- * Set this to true to enable demo trading for the private account data WS
209
- * Topics: order,execution,position,wallet,greeks
210
- */
211
- ⋮----
212
- /**
213
- * Overkill in almost every case, but if you need any optimisation available,
214
- * you can inject a faster sign mechanism such as node's native createHmac:
215
- */
216
- ⋮----
217
- function setWsClientEventListeners(
218
- websocketClient: WebsocketClientV3,
219
- accountRef: string,
220
- ): Promise<void>
221
- ⋮----
222
- // console.log('raw message received ', JSON.stringify(data, null, 2));
223
- ⋮----
224
- // Simple promise to ensure we're subscribed before trying anything else
225
- ⋮----
226
- // Start trading
227
-
228
- ================
229
- File: examples/Auth/rest-private-rsa.md
160
+ File: examples/auth/rest-private-rsa.md
230
161
  ================
231
162
  # RSA Authentication with Bitget APIs in Node.js, JavaScript & TypeScript
232
163
 
@@ -338,29 +269,6 @@ const clientV3 = new RestClientV3({
338
269
 
339
270
  For a complete example, refer to the [rest-private-rsa.ts](./rest-private-rsa.ts) file on GitHub.
340
271
 
341
- ================
342
- File: examples/Auth/rest-private-rsa.ts
343
- ================
344
- import { RestClientV2, RestClientV3 } from '../../src/index.js';
345
- ⋮----
346
- // Import frmo NPM:
347
- // import { RestClientV2, RestClientV3 } from 'bitget-api';
348
- // or if you prefer require:
349
- // const { RestClientV2, RestClientV3 } = require('bitget-api');
350
- ⋮----
351
- // Received after creating a new API key with a self-generated RSA public key on Bitget
352
- ⋮----
353
- // The self-generated RSA private key, this is never directly given to Bitget, but used to generate a signature
354
- // Note: this MUST include the "BEGIN PRIVATE KEY" header so that the SDK understands this is RSA auth
355
- ⋮----
356
- // This is set by you when registering your RSA API key in Bitget's website.
357
- ⋮----
358
- // const wsClient = new WebsocketClientV2({
359
- // apiKey: API_KEY,
360
- // apiSecret: rsaPrivateKey,
361
- // apiPass: API_PASS,
362
- // });
363
-
364
272
  ================
365
273
  File: examples/README.md
366
274
  ================
@@ -2075,6 +1983,18 @@ export interface WSPositionSnapshotUMCBL extends WsBaseEvent<'snapshot'> {
2075
1983
  };
2076
1984
  data: WsPositionSnapshotDataUMCBL[];
2077
1985
  }
1986
+ ⋮----
1987
+ /** Classic V2 depth channel push data. checksum removed May 2026 - use seq instead */
1988
+ export interface WsDepthBookDataV2 {
1989
+ asks: [string, string][];
1990
+ bids: [string, string][];
1991
+ ts: string;
1992
+ seq: string;
1993
+ /** Futures books channel only - previous push serial number */
1994
+ pseq?: string;
1995
+ }
1996
+ ⋮----
1997
+ /** Futures books channel only - previous push serial number */
2078
1998
 
2079
1999
  ================
2080
2000
  File: src/websocket-client-v2.ts
@@ -2626,6 +2546,29 @@ File: tsconfig.linting.json
2626
2546
  ]
2627
2547
  }
2628
2548
 
2549
+ ================
2550
+ File: examples/auth/rest-private-rsa.ts
2551
+ ================
2552
+ import { RestClientV2, RestClientV3 } from '../../src/index.js';
2553
+ ⋮----
2554
+ // Import frmo NPM:
2555
+ // import { RestClientV2, RestClientV3 } from 'bitget-api';
2556
+ // or if you prefer require:
2557
+ // const { RestClientV2, RestClientV3 } = require('bitget-api');
2558
+ ⋮----
2559
+ // Received after creating a new API key with a self-generated RSA public key on Bitget
2560
+ ⋮----
2561
+ // The self-generated RSA private key, this is never directly given to Bitget, but used to generate a signature
2562
+ // Note: this MUST include the "BEGIN PRIVATE KEY" header so that the SDK understands this is RSA auth
2563
+ ⋮----
2564
+ // This is set by you when registering your RSA API key in Bitget's website.
2565
+ ⋮----
2566
+ // const wsClient = new WebsocketClientV2({
2567
+ // apiKey: API_KEY,
2568
+ // apiSecret: rsaPrivateKey,
2569
+ // apiPass: API_PASS,
2570
+ // });
2571
+
2629
2572
  ================
2630
2573
  File: examples/V2 - Classic/Rest/rest-private-futures.ts
2631
2574
  ================
@@ -2728,11 +2671,6 @@ import { RestClientV3 } from '../../../src/index.js';
2728
2671
  // or
2729
2672
  // import { RestClientV3 } from 'bitget-api';
2730
2673
 
2731
- ================
2732
- File: src/constants/enum.ts
2733
- ================
2734
- /** Parameter verification exception margin mode == FIXED */
2735
-
2736
2674
  ================
2737
2675
  File: src/types/request/v2/common.ts
2738
2676
  ================
@@ -3469,7 +3407,12 @@ export type StrategyTriggerByV3 = 'market' | 'mark';
3469
3407
  export type StrategyTriggerOrderTypeV3 = 'limit' | 'market';
3470
3408
  ⋮----
3471
3409
  export interface PlaceStrategyOrderRequestV3 {
3472
- category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES';
3410
+ category:
3411
+ | 'SPOT'
3412
+ | 'MARGIN'
3413
+ | 'USDT-FUTURES'
3414
+ | 'COIN-FUTURES'
3415
+ | 'USDC-FUTURES';
3473
3416
  symbol: string;
3474
3417
  clientOid?: string;
3475
3418
  type?: StrategyOrderTypeV3;
@@ -3519,12 +3462,22 @@ export interface CancelStrategyOrderRequestV3 {
3519
3462
  }
3520
3463
  ⋮----
3521
3464
  export interface GetUnfilledStrategyOrdersRequestV3 {
3522
- category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES';
3465
+ category:
3466
+ | 'SPOT'
3467
+ | 'MARGIN'
3468
+ | 'USDT-FUTURES'
3469
+ | 'COIN-FUTURES'
3470
+ | 'USDC-FUTURES';
3523
3471
  type?: StrategyOrderTypeV3;
3524
3472
  }
3525
3473
  ⋮----
3526
3474
  export interface GetHistoryStrategyOrdersRequestV3 {
3527
- category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES';
3475
+ category:
3476
+ | 'SPOT'
3477
+ | 'MARGIN'
3478
+ | 'USDT-FUTURES'
3479
+ | 'COIN-FUTURES'
3480
+ | 'USDC-FUTURES';
3528
3481
  type?: StrategyOrderTypeV3;
3529
3482
  startTime?: string;
3530
3483
  endTime?: string;
@@ -3651,6 +3604,36 @@ export interface ModifyOrderRequestV3 {
3651
3604
  qty?: string;
3652
3605
  price?: string;
3653
3606
  autoCancel?: 'yes' | 'no';
3607
+ symbol?: string;
3608
+ category?:
3609
+ | 'SPOT'
3610
+ | 'MARGIN'
3611
+ | 'USDT-FUTURES'
3612
+ | 'COIN-FUTURES'
3613
+ | 'USDC-FUTURES';
3614
+ tpTriggerBy?: 'market' | 'mark';
3615
+ slTriggerBy?: 'market' | 'mark';
3616
+ takeProfit?: string;
3617
+ stopLoss?: string;
3618
+ tpOrderType?: 'limit' | 'market';
3619
+ slOrderType?: 'limit' | 'market';
3620
+ tpLimitPrice?: string;
3621
+ slLimitPrice?: string;
3622
+ }
3623
+ ⋮----
3624
+ export interface PlaceRealityOrderRequestV3 {
3625
+ symbol: string;
3626
+ side: 'buy' | 'sell';
3627
+ orderType: 'limit' | 'market';
3628
+ qty: string;
3629
+ price?: string;
3630
+ clientOid?: string;
3631
+ }
3632
+ ⋮----
3633
+ export interface CancelRealityOrderRequestV3 {
3634
+ symbol: string;
3635
+ orderId?: string;
3636
+ clientOid?: string;
3654
3637
  }
3655
3638
  ⋮----
3656
3639
  export interface PlaceBatchOrdersRequestV3 {
@@ -5709,6 +5692,75 @@ dist
5709
5692
  repomix.sh
5710
5693
  coverage
5711
5694
 
5695
+ ================
5696
+ File: examples/auth/fasterHmacSign.ts
5697
+ ================
5698
+ import { createHmac } from 'crypto';
5699
+ ⋮----
5700
+ import {
5701
+ DefaultLogger,
5702
+ RestClientV3,
5703
+ WebsocketClientV3,
5704
+ } from '../../src/index.js';
5705
+ ⋮----
5706
+ // or
5707
+ // import { createHmac } from 'crypto';
5708
+ // import { DefaultLogger, RestClientV3, WebsocketClientV3 } from 'bitget-api';
5709
+ ⋮----
5710
+ /**
5711
+ * Injecting a custom signMessage function.
5712
+ *
5713
+ * As of version 3.0.0 of the bitget-api Node.js/TypeScript/JavaScript
5714
+ * SDK for Bitget, the SDK uses the Web Crypto API for signing requests.
5715
+ * While it is compatible with Node and Browser environments, it is
5716
+ * slightly slower than using Node's native crypto module (only
5717
+ * available in backend Node environments).
5718
+ *
5719
+ * For latency sensitive users, you can inject the previous node crypto sign
5720
+ * method (or your own even faster implementation), if this change affects you.
5721
+ *
5722
+ * This example demonstrates how to inject a custom sign function, to achieve
5723
+ * the same peformance as seen before the Web Crypto API was introduced.
5724
+ *
5725
+ * For context on standard usage, the "signMessage" function is used:
5726
+ * - During every single API call
5727
+ * - After opening a new private WebSocket connection
5728
+ */
5729
+ ⋮----
5730
+ /**
5731
+ * Set this to true to enable demo trading:
5732
+ */
5733
+ ⋮----
5734
+ /**
5735
+ * Overkill in almost every case, but if you need any optimisation available,
5736
+ * you can inject a faster sign mechanism such as node's native createHmac:
5737
+ */
5738
+ ⋮----
5739
+ // Optional, uncomment the "trace" override to log a lot more info about what the WS client is doing
5740
+ ⋮----
5741
+ // trace: (...params) => console.log('trace', ...params),
5742
+ ⋮----
5743
+ /**
5744
+ * Set this to true to enable demo trading for the private account data WS
5745
+ * Topics: order,execution,position,wallet,greeks
5746
+ */
5747
+ ⋮----
5748
+ /**
5749
+ * Overkill in almost every case, but if you need any optimisation available,
5750
+ * you can inject a faster sign mechanism such as node's native createHmac:
5751
+ */
5752
+ ⋮----
5753
+ function setWsClientEventListeners(
5754
+ websocketClient: WebsocketClientV3,
5755
+ accountRef: string,
5756
+ ): Promise<void>
5757
+ ⋮----
5758
+ // console.log('raw message received ', JSON.stringify(data, null, 2));
5759
+ ⋮----
5760
+ // Simple promise to ensure we're subscribed before trying anything else
5761
+ ⋮----
5762
+ // Start trading
5763
+
5712
5764
  ================
5713
5765
  File: examples/V2 - Classic/Rest/rest-trade-futures.ts
5714
5766
  ================
@@ -6240,6 +6292,11 @@ import {
6240
6292
  }
6241
6293
  */
6242
6294
 
6295
+ ================
6296
+ File: src/constants/enum.ts
6297
+ ================
6298
+ /** Parameter verification exception margin mode == FIXED */
6299
+
6243
6300
  ================
6244
6301
  File: src/types/request/v3/broker.ts
6245
6302
  ================
@@ -6812,6 +6869,7 @@ export interface OrderInfoV3 {
6812
6869
  orderStatus: string;
6813
6870
  posSide: string;
6814
6871
  holdMode: string;
6872
+ delegateType?: string;
6815
6873
  reduceOnly: string;
6816
6874
  feeDetail: FeeDetailV3[];
6817
6875
  cancelReason: string;
@@ -6952,6 +7010,19 @@ export interface CurrentPositionV3 {
6952
7010
  updatedTime: string;
6953
7011
  }
6954
7012
  ⋮----
7013
+ export interface LoanDataDebtCoinV3 {
7014
+ coin: string;
7015
+ debt: string;
7016
+ interestFreeAmount: string;
7017
+ interestRateNextHour: string;
7018
+ }
7019
+ ⋮----
7020
+ export interface LoanDataV3 {
7021
+ currentLoans: string;
7022
+ interestPaymentTime: string;
7023
+ debtCoinList: LoanDataDebtCoinV3[];
7024
+ }
7025
+ ⋮----
6955
7026
  export interface ModifyOrderResponseV3 {
6956
7027
  orderId: string;
6957
7028
  clientOid: string;
@@ -8404,12 +8475,20 @@ export interface GetContractsOiRequestV3 {
8404
8475
  }
8405
8476
  ⋮----
8406
8477
  export interface GetCurrentFundingRateRequestV3 {
8407
- symbol: string;
8478
+ category?: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES';
8479
+ symbol?: string;
8408
8480
  }
8409
8481
  ⋮----
8410
- export interface GetHistoryFundingRateRequestV3 {
8482
+ export interface GetLiquidationsRequestV3 {
8411
8483
  category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES';
8412
- symbol: string;
8484
+ symbol?: string;
8485
+ limit?: string;
8486
+ cursor?: string;
8487
+ }
8488
+ ⋮----
8489
+ export interface GetHistoryFundingRateRequestV3 {
8490
+ category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES';
8491
+ symbol: string;
8413
8492
  cursor?: string;
8414
8493
  limit?: string;
8415
8494
  }
@@ -8451,7 +8530,7 @@ export interface GetInstrumentsRequestV3 {
8451
8530
  ⋮----
8452
8531
  export interface GetMarketFeeGroupRequestV3 {
8453
8532
  category: 'SPOT' | 'FUTURES';
8454
- group?: 'GROUP_A' | 'GROUP_B' | 'GROUP_C';
8533
+ group?: 'DEFAULT' | 'GROUP_A' | 'GROUP_B' | 'GROUP_C';
8455
8534
  }
8456
8535
  ⋮----
8457
8536
  export interface GetMarketScoreWeightsRequestV3 {
@@ -8472,6 +8551,54 @@ export interface GetTickersRequestV3 {
8472
8551
  export interface GetIndexComponentsRequestV3 {
8473
8552
  symbol: string;
8474
8553
  }
8554
+ ⋮----
8555
+ export interface GetRpiOrderBookRequestV3 {
8556
+ category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES';
8557
+ symbol: string;
8558
+ limit?: string;
8559
+ }
8560
+ ⋮----
8561
+ export interface GetCashDividendRecordsRequestV3 {
8562
+ symbol: string;
8563
+ type: 'pending' | 'paid';
8564
+ cursor?: string;
8565
+ limit?: string;
8566
+ }
8567
+ ⋮----
8568
+ export interface GetSpotWhaleFlowRequestV3 {
8569
+ symbol: string;
8570
+ }
8571
+ ⋮----
8572
+ export interface GetSpotFundFlowRequestV3 {
8573
+ symbol: string;
8574
+ period?: string;
8575
+ }
8576
+ ⋮----
8577
+ export interface GetSpotNetFlowRequestV3 {
8578
+ symbol: string;
8579
+ }
8580
+ ⋮----
8581
+ export interface GetMarginLongShortRequestV3 {
8582
+ symbol: string;
8583
+ period?: '24h' | '30d';
8584
+ coin?: string;
8585
+ }
8586
+ ⋮----
8587
+ export interface GetMarginLoanGrowthRequestV3 {
8588
+ symbol: string;
8589
+ period?: string;
8590
+ coin?: string;
8591
+ }
8592
+ ⋮----
8593
+ export interface GetMarginIsolatedBorrowRequestV3 {
8594
+ symbol: string;
8595
+ period?: string;
8596
+ }
8597
+ ⋮----
8598
+ export interface GetFuturesTradingDataRequestV3 {
8599
+ symbol: string;
8600
+ period?: string;
8601
+ }
8475
8602
 
8476
8603
  ================
8477
8604
  File: src/types/response/v2/broker.ts
@@ -9535,6 +9662,8 @@ export interface FuturesIsolatedSymbolV2 {
9535
9662
  File: src/types/response/v3/account.ts
9536
9663
  ================
9537
9664
  // Account Management Response Types
9665
+ import type { CollateralTypeV3 } from '../../request/v3/account.js';
9666
+ ⋮----
9538
9667
  export interface AccountSymbolConfigV3 {
9539
9668
  category: string;
9540
9669
  symbol: string;
@@ -9603,8 +9732,16 @@ export interface AccountAssetV3 {
9603
9732
  available: string;
9604
9733
  debt: string;
9605
9734
  locked: string;
9735
+ /** Position value in USD */
9736
+ positionValue?: string;
9737
+ /** Account leverage (non-negative) */
9738
+ leverage?: string;
9606
9739
  }
9607
9740
  ⋮----
9741
+ /** Position value in USD */
9742
+ ⋮----
9743
+ /** Account leverage (non-negative) */
9744
+ ⋮----
9608
9745
  export interface AccountAssetsV3 {
9609
9746
  accountEquity: string;
9610
9747
  usdtEquity: string;
@@ -9639,8 +9776,14 @@ export interface FinancialRecordV3 {
9639
9776
  fee: string;
9640
9777
  balance: string;
9641
9778
  ts: string;
9779
+ /** crossed | isolated */
9780
+ positionType?: string;
9781
+ positionAmount?: string;
9782
+ positionBalance?: string;
9642
9783
  }
9643
9784
  ⋮----
9785
+ /** crossed | isolated */
9786
+ ⋮----
9644
9787
  export interface PaymentCoinV3 {
9645
9788
  coin: string;
9646
9789
  size: string;
@@ -9724,8 +9867,15 @@ export interface WithdrawAddressBookV3 {
9724
9867
  ⋮----
9725
9868
  // Transfer Response Types
9726
9869
  ⋮----
9870
+ export interface AllSymbolFeeRateV3 {
9871
+ symbol: string;
9872
+ makerFeeRate: string;
9873
+ takerFeeRate: string;
9874
+ }
9875
+ ⋮----
9727
9876
  export interface TransferResponseV3 {
9728
9877
  transferId: string;
9878
+ clientOid?: string;
9729
9879
  }
9730
9880
  ⋮----
9731
9881
  export interface SubTransferRecordV3 {
@@ -9844,151 +9994,475 @@ export interface TaxRecordV3 {
9844
9994
  balance: string;
9845
9995
  ts: string;
9846
9996
  }
9847
-
9848
- ================
9849
- File: src/types/request/v3/account.ts
9850
- ================
9851
- // Account Management Request Types
9852
- ⋮----
9853
- export type AccountAdjustModeV3 = 'basic' | 'advanced' | 'delta' | 'isolated';
9854
9997
  ⋮----
9855
- export interface AdjustAccountModeRequestV3 {
9856
- mode: AccountAdjustModeV3;
9857
- /** Sub-account UID when the master account switches mode for a sub-account */
9858
- targetUid?: string;
9998
+ export interface CollateralTypeConfigV3 {
9999
+ collateralType: CollateralTypeV3;
10000
+ /** Returned when collateralType=custom */
10001
+ collateralCoins?: string;
9859
10002
  }
9860
10003
  ⋮----
9861
- /** Sub-account UID when the master account switches mode for a sub-account */
10004
+ /** Returned when collateralType=custom */
9862
10005
  ⋮----
9863
- export interface SetLeverageRequestV3 {
9864
- category: 'MARGIN' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES';
9865
- symbol?: string;
9866
- leverage: string;
9867
- coin?: string;
9868
- posSide?: 'long' | 'short';
10006
+ export interface CustomCollateralCoinV3 {
10007
+ collateralCoin: string;
9869
10008
  }
9870
10009
  ⋮----
9871
- export interface GetConvertRecordsRequestV3 {
9872
- fromCoin: string;
9873
- toCoin: string;
9874
- startTime?: string;
9875
- endTime?: string;
9876
- limit?: string;
9877
- cursor?: string;
10010
+ export interface PreSetLeverageV3 {
10011
+ estMaxOpen?: string;
10012
+ estMaxBorrowable?: string;
10013
+ requiredMargin: string;
10014
+ marginChange: string;
9878
10015
  }
9879
10016
  ⋮----
9880
- export interface GetFinancialRecordsRequestV3 {
9881
- category:
9882
- | 'SPOT'
9883
- | 'MARGIN'
9884
- | 'USDT-FUTURES'
9885
- | 'COIN-FUTURES'
9886
- | 'USDC-FUTURES';
9887
- coin?: string;
9888
- type?: string;
9889
- startTime?: string;
9890
- endTime?: string;
9891
- limit?: string;
9892
- cursor?: string;
10017
+ export interface MaxWithdrawalV3 {
10018
+ coin: string;
10019
+ otcMaxWithdrawal: string;
10020
+ spotMaxWithdrawal: string;
10021
+ utaMaxWithdrawal: string;
10022
+ totalMaxWithdrawal: string;
9893
10023
  }
10024
+
10025
+ ================
10026
+ File: src/types/websockets/ws-general.ts
10027
+ ================
10028
+ import type { ClientRequestArgs } from 'http';
10029
+ import WebSocket from 'isomorphic-ws';
9894
10030
  ⋮----
9895
- export interface RepayRequestV3 {
9896
- repayableCoinList: string[];
9897
- paymentCoinList: string[];
9898
- }
10031
+ import { RestClientOptions } from '../../util/requestUtils.js';
10032
+ import { WS_KEY_MAP } from '../../util/websocket-util.js';
10033
+ import { FuturesProductTypeV2 } from '../request/shared.js';
9899
10034
  ⋮----
9900
- // Sub-account Management Request Types
10035
+ export type BitgetInstType = 'SP' | 'SPBL' | 'MC' | 'UMCBL' | 'DMCBL';
10036
+ export type BitgetInstTypeV2 = 'SPOT' | FuturesProductTypeV2;
10037
+ export type BitgetInstTypeV3 =
10038
+ | 'UTA' // for account-level topics
10039
+ | 'spot'
10040
+ | 'usdt-futures'
10041
+ | 'coin-futures'
10042
+ | 'usdc-futures';
9901
10043
  ⋮----
9902
- export interface CreateSubAccountApiKeyRequestV3 {
9903
- subUid: string;
9904
- note: string;
9905
- type: 'read_write' | 'read_only';
9906
- passphrase: string;
9907
- permissions: string[];
9908
- ips: string[];
9909
- }
10044
+ | 'UTA' // for account-level topics
9910
10045
  ⋮----
9911
- export interface DeleteSubAccountApiKeyRequestV3 {
9912
- apiKey: string;
9913
- }
10046
+ /**
10047
+ *
10048
+ * V1 list of topics for WebSocket consumers
10049
+ *
10050
+ */
9914
10051
  ⋮----
9915
- export interface GetSubAccountApiKeysRequestV3 {
9916
- subUid: string;
9917
- limit?: string;
9918
- cursor?: string;
9919
- }
10052
+ export type WsPublicSpotTopic =
10053
+ | 'ticker'
10054
+ | 'candle1W'
10055
+ | 'candle1D'
10056
+ | 'candle12H'
10057
+ | 'candle4H'
10058
+ | 'candle1H'
10059
+ | 'candle30m'
10060
+ | 'candle15m'
10061
+ | 'candle5m'
10062
+ | 'candle1m'
10063
+ | 'books'
10064
+ | 'books5'
10065
+ | 'trade';
9920
10066
  ⋮----
9921
- export interface UpdateSubAccountApiKeyRequestV3 {
9922
- apiKey: string;
9923
- passphrase: string;
9924
- type?: 'read_write' | 'read_only';
9925
- permissions?: string[];
9926
- ips?: string[];
9927
- }
10067
+ // Futures currently has the same public topics as spot
10068
+ export type WsPublicFuturesTopic = WsPublicSpotTopic;
10069
+ export type WsPrivateSpotTopic = 'account' | 'orders';
9928
10070
  ⋮----
9929
- export interface CreateSubAccountRequestV3 {
9930
- username: string;
9931
- accountMode?: 'classic' | 'unified';
9932
- note?: string;
9933
- }
10071
+ export type WsPrivateFuturesTopic =
10072
+ | 'account'
10073
+ | 'positions'
10074
+ | 'orders'
10075
+ | 'ordersAlgo';
9934
10076
  ⋮----
9935
- export interface FreezeSubAccountRequestV3 {
9936
- subUid: string;
9937
- operation: 'freeze' | 'unfreeze';
9938
- }
10077
+ export type WsPublicTopic = WsPublicSpotTopic | WsPublicFuturesTopic;
9939
10078
  ⋮----
9940
- export interface GetSubAccountListRequestV3 {
9941
- limit?: string;
9942
- cursor?: string;
9943
- }
10079
+ export type WsPrivateTopic = WsPrivateSpotTopic | WsPrivateFuturesTopic;
10080
+ export type WsTopic = WsPublicTopic | WsPrivateTopic;
9944
10081
  ⋮----
9945
- // Transfer Request Types
10082
+ /**
10083
+ *
10084
+ * V2 list of topics for WebSocket consumers
10085
+ *
10086
+ */
9946
10087
  ⋮----
9947
- export interface TransferRequestV3 {
9948
- fromType:
9949
- | 'spot'
9950
- | 'p2p'
9951
- | 'coin-futures'
9952
- | 'usdt-futures'
9953
- | 'usdc-futures'
9954
- | 'crossed-margin'
9955
- | 'isolated-margin'
9956
- | 'uta';
9957
- toType:
9958
- | 'spot'
9959
- | 'p2p'
9960
- | 'coin-futures'
9961
- | 'usdt-futures'
9962
- | 'usdc-futures'
9963
- | 'crossed-margin'
9964
- | 'isolated-margin'
9965
- | 'uta';
9966
- amount: string;
9967
- coin: string;
9968
- symbol?: string;
9969
- /** Enable automatic margin borrowing when balance insufficient. yes | no */
9970
- allowBorrow?: 'yes' | 'no';
9971
- }
10088
+ export type WsPublicTopicV2 =
10089
+ | 'index-price' // margin only
10090
+ | 'ticker'
10091
+ | 'candle1m'
10092
+ | 'candle5m'
10093
+ | 'candle15m'
10094
+ | 'candle30m'
10095
+ | 'candle1H'
10096
+ | 'candle4H'
10097
+ | 'candle6H'
10098
+ | 'candle12H'
10099
+ | 'candle1D'
10100
+ | 'candle3D'
10101
+ | 'candle1W'
10102
+ | 'candle1M'
10103
+ | 'candle6Hutc'
10104
+ | 'candle12Hutc'
10105
+ | 'candle1Dutc'
10106
+ | 'candle3Dutc'
10107
+ | 'candle1Wutc'
10108
+ | 'candle1Mutc'
10109
+ | 'trade'
10110
+ | 'books'
10111
+ | 'books1'
10112
+ | 'books5'
10113
+ | 'books15';
9972
10114
  ⋮----
9973
- /** Enable automatic margin borrowing when balance insufficient. yes | no */
10115
+ | 'index-price' // margin only
9974
10116
  ⋮----
9975
- export interface GetTransferableCoinsRequestV3 {
9976
- fromType:
9977
- | 'spot'
9978
- | 'p2p'
9979
- | 'coin-futures'
9980
- | 'usdt-futures'
9981
- | 'usdc-futures'
9982
- | 'crossed-margin'
9983
- | 'isolated-margin'
9984
- | 'uta';
9985
- toType:
9986
- | 'spot'
9987
- | 'p2p'
9988
- | 'coin-futures'
9989
- | 'usdt-futures'
9990
- | 'usdc-futures'
9991
- | 'crossed-margin'
10117
+ // Also update PRIVATE_TOPICS_V2 if this is updated
10118
+ export type WSPrivateTopicFuturesV2 =
10119
+ | 'positions'
10120
+ | 'orders-algo'
10121
+ | 'positions-history';
10122
+ ⋮----
10123
+ // Also update PRIVATE_TOPICS_V2 if this is updated
10124
+ export type WSPrivateTopicMarginV2 =
10125
+ | 'orders-crossed'
10126
+ | 'account-crossed'
10127
+ | 'account-isolated'
10128
+ | 'orders-isolated';
10129
+ ⋮----
10130
+ // Also update PRIVATE_TOPICS_V2 if this is updated
10131
+ export type WsPrivateTopicV2 =
10132
+ | 'account'
10133
+ | 'orders'
10134
+ | WSPrivateTopicFuturesV2
10135
+ | WSPrivateTopicMarginV2;
10136
+ ⋮----
10137
+ export type WsTopicV2 = WsPublicTopicV2 | WsPrivateTopicV2;
10138
+ ⋮----
10139
+ /**
10140
+ *
10141
+ * V3 / UTA list of topics for WebSocket consumers
10142
+ *
10143
+ */
10144
+ export type WsPublicTopicV3 = 'ticker' | 'kline' | 'books' | 'publicTrade';
10145
+ // Also update PRIVATE_TOPICS_V3 if this is updated
10146
+ export type WsPrivateTopicV3 =
10147
+ | 'account'
10148
+ | 'position'
10149
+ | 'fill'
10150
+ | 'order'
10151
+ | 'strategy-order';
10152
+ export type WsTopicV3 = WsPublicTopicV3 | WsPrivateTopicV3;
10153
+ ⋮----
10154
+ /** This is used to differentiate between each of the available websocket streams */
10155
+ export type WsKey = (typeof WS_KEY_MAP)[keyof typeof WS_KEY_MAP];
10156
+ ⋮----
10157
+ /**
10158
+ * Event args for subscribing/unsubscribing
10159
+ */
10160
+ ⋮----
10161
+ export interface WsTopicSubscribeEventArgs {
10162
+ instType: BitgetInstType;
10163
+ channel: WsTopic;
10164
+ instId?: string;
10165
+ }
10166
+ ⋮----
10167
+ export type WsTopicSubscribePublicArgsV2 = {
10168
+ instType: BitgetInstTypeV2;
10169
+ channel: WsPublicTopicV2;
10170
+ /** The symbol, e.g. "BTCUSDT" */
10171
+ instId: string;
10172
+ };
10173
+ ⋮----
10174
+ /** The symbol, e.g. "BTCUSDT" */
10175
+ ⋮----
10176
+ export type WsInstIdChannelsV2 =
10177
+ | 'orders'
10178
+ | WSPrivateTopicFuturesV2
10179
+ | 'orders-crossed'
10180
+ | 'orders-isolated';
10181
+ ⋮----
10182
+ export type WsTopicSubscribePrivateInstIdArgsV2 = {
10183
+ instType: BitgetInstTypeV2;
10184
+ channel: WsInstIdChannelsV2;
10185
+ /** The symbol, e.g. "BTCUSDT" */
10186
+ instId?: string;
10187
+ };
10188
+ ⋮----
10189
+ /** The symbol, e.g. "BTCUSDT" */
10190
+ ⋮----
10191
+ export type WsCoinChannelsV2 =
10192
+ | 'account'
10193
+ | 'account-crossed'
10194
+ | 'account-isolated';
10195
+ ⋮----
10196
+ export type WsTopicSubscribePrivateCoinArgsV2 = {
10197
+ instType: BitgetInstTypeV2;
10198
+ channel: WsCoinChannelsV2;
10199
+ coin: 'default' | string;
10200
+ };
10201
+ ⋮----
10202
+ export type WsTopicSubscribePrivateArgsV2 =
10203
+ | WsTopicSubscribePrivateInstIdArgsV2
10204
+ | WsTopicSubscribePrivateCoinArgsV2;
10205
+ ⋮----
10206
+ export type WsTopicSubscribeEventArgsV2 =
10207
+ | WsTopicSubscribePublicArgsV2
10208
+ | WsTopicSubscribePrivateArgsV2;
10209
+ ⋮----
10210
+ /** General configuration for the WebsocketClient */
10211
+ export interface WSClientConfigurableOptions {
10212
+ /** Your API key */
10213
+ apiKey?: string;
10214
+
10215
+ /** Your API secret */
10216
+ apiSecret?: string;
10217
+
10218
+ /** The passphrase you set when creating the API Key (NOT your account password) */
10219
+ apiPass?: string;
10220
+
10221
+ /**
10222
+ * Set to `true` to connect to Bitget's demo trading WebSockets:
10223
+ *
10224
+ * - V2: https://www.bitget.com/api-doc/common/demotrading/websocket
10225
+ * - V3/UTA: https://www.bitget.com/api-doc/uta/guide#demo-trading
10226
+ */
10227
+ demoTrading?: boolean;
10228
+
10229
+ /** Define a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 seconds */
10230
+ recvWindow?: number;
10231
+
10232
+ // Disable ping/pong ws heartbeat mechanism (not recommended)
10233
+ disableHeartbeat?: boolean;
10234
+
10235
+ /** How often to check if the connection is alive */
10236
+ pingInterval?: number;
10237
+
10238
+ /** How long to wait for a pong (heartbeat reply) before assuming the connection is dead */
10239
+ pongTimeout?: number;
10240
+
10241
+ /** Delay in milliseconds before respawning the connection */
10242
+ reconnectTimeout?: number;
10243
+
10244
+ requestOptions?: RestClientOptions;
10245
+
10246
+ wsOptions?: {
10247
+ protocols?: string[];
10248
+ agent?: any;
10249
+ } & Partial<WebSocket.ClientOptions | ClientRequestArgs>;
10250
+
10251
+ wsUrl?: string;
10252
+
10253
+ /**
10254
+ * Allows you to provide a custom "signMessage" function, e.g. to use node's much faster createHmac method
10255
+ *
10256
+ * Look in the examples folder for a demonstration on using node's createHmac instead.
10257
+ */
10258
+ customSignMessageFn?: (message: string, secret: string) => Promise<string>;
10259
+ }
10260
+ ⋮----
10261
+ /** Your API key */
10262
+ ⋮----
10263
+ /** Your API secret */
10264
+ ⋮----
10265
+ /** The passphrase you set when creating the API Key (NOT your account password) */
10266
+ ⋮----
10267
+ /**
10268
+ * Set to `true` to connect to Bitget's demo trading WebSockets:
10269
+ *
10270
+ * - V2: https://www.bitget.com/api-doc/common/demotrading/websocket
10271
+ * - V3/UTA: https://www.bitget.com/api-doc/uta/guide#demo-trading
10272
+ */
10273
+ ⋮----
10274
+ /** Define a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 seconds */
10275
+ ⋮----
10276
+ // Disable ping/pong ws heartbeat mechanism (not recommended)
10277
+ ⋮----
10278
+ /** How often to check if the connection is alive */
10279
+ ⋮----
10280
+ /** How long to wait for a pong (heartbeat reply) before assuming the connection is dead */
10281
+ ⋮----
10282
+ /** Delay in milliseconds before respawning the connection */
10283
+ ⋮----
10284
+ /**
10285
+ * Allows you to provide a custom "signMessage" function, e.g. to use node's much faster createHmac method
10286
+ *
10287
+ * Look in the examples folder for a demonstration on using node's createHmac instead.
10288
+ */
10289
+ ⋮----
10290
+ export interface WebsocketClientOptions extends WSClientConfigurableOptions {
10291
+ pingInterval: number;
10292
+ pongTimeout: number;
10293
+ reconnectTimeout: number;
10294
+ recvWindow: number;
10295
+ authPrivateConnectionsOnConnect: boolean;
10296
+ authPrivateRequests: boolean;
10297
+ }
10298
+
10299
+ ================
10300
+ File: src/types/request/v3/account.ts
10301
+ ================
10302
+ // Account Management Request Types
10303
+ ⋮----
10304
+ export type AccountAdjustModeV3 = 'basic' | 'advanced' | 'delta' | 'isolated';
10305
+ ⋮----
10306
+ export interface AdjustAccountModeRequestV3 {
10307
+ mode: AccountAdjustModeV3;
10308
+ /** Sub-account UID when the master account switches mode for a sub-account */
10309
+ targetUid?: string;
10310
+ }
10311
+ ⋮----
10312
+ /** Sub-account UID when the master account switches mode for a sub-account */
10313
+ ⋮----
10314
+ export interface SetLeverageRequestV3 {
10315
+ category: 'MARGIN' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES';
10316
+ symbol?: string;
10317
+ leverage: string;
10318
+ coin?: string;
10319
+ posSide?: 'long' | 'short';
10320
+ /** Futures only. Defaults to crossed */
10321
+ marginMode?: 'crossed' | 'isolated';
10322
+ /** Isolated two-way mode: long leverage. Takes priority over leverage when both set */
10323
+ longLeverage?: string;
10324
+ /** Isolated two-way mode: short leverage. Takes priority over leverage when both set */
10325
+ shortLeverage?: string;
10326
+ }
10327
+ ⋮----
10328
+ /** Futures only. Defaults to crossed */
10329
+ ⋮----
10330
+ /** Isolated two-way mode: long leverage. Takes priority over leverage when both set */
10331
+ ⋮----
10332
+ /** Isolated two-way mode: short leverage. Takes priority over leverage when both set */
10333
+ ⋮----
10334
+ export interface GetAllFeeRatesRequestV3 {
10335
+ category:
10336
+ | 'SPOT'
10337
+ | 'MARGIN'
10338
+ | 'USDT-FUTURES'
10339
+ | 'COIN-FUTURES'
10340
+ | 'USDC-FUTURES';
10341
+ symbol?: string;
10342
+ }
10343
+ ⋮----
10344
+ export interface GetConvertRecordsRequestV3 {
10345
+ fromCoin?: string;
10346
+ toCoin?: string;
10347
+ startTime?: string;
10348
+ endTime?: string;
10349
+ limit?: string;
10350
+ cursor?: string;
10351
+ }
10352
+ ⋮----
10353
+ export interface GetFinancialRecordsRequestV3 {
10354
+ category:
10355
+ | 'SPOT'
10356
+ | 'MARGIN'
10357
+ | 'USDT-FUTURES'
10358
+ | 'COIN-FUTURES'
10359
+ | 'USDC-FUTURES';
10360
+ coin?: string;
10361
+ type?: string;
10362
+ startTime?: string;
10363
+ endTime?: string;
10364
+ limit?: string;
10365
+ cursor?: string;
10366
+ }
10367
+ ⋮----
10368
+ export interface RepayRequestV3 {
10369
+ repayableCoinList: string[];
10370
+ paymentCoinList: string[];
10371
+ }
10372
+ ⋮----
10373
+ // Sub-account Management Request Types
10374
+ ⋮----
10375
+ export interface CreateSubAccountApiKeyRequestV3 {
10376
+ subUid: string;
10377
+ note: string;
10378
+ type: 'read_write' | 'read_only';
10379
+ passphrase: string;
10380
+ permissions: string[];
10381
+ ips: string[];
10382
+ }
10383
+ ⋮----
10384
+ export interface DeleteSubAccountApiKeyRequestV3 {
10385
+ apiKey: string;
10386
+ }
10387
+ ⋮----
10388
+ export interface GetSubAccountApiKeysRequestV3 {
10389
+ subUid: string;
10390
+ limit?: string;
10391
+ cursor?: string;
10392
+ }
10393
+ ⋮----
10394
+ export interface UpdateSubAccountApiKeyRequestV3 {
10395
+ apiKey: string;
10396
+ passphrase: string;
10397
+ type?: 'read_write' | 'read_only';
10398
+ permissions?: string[];
10399
+ ips?: string[];
10400
+ }
10401
+ ⋮----
10402
+ export interface CreateSubAccountRequestV3 {
10403
+ username: string;
10404
+ accountMode?: 'classic' | 'unified';
10405
+ note?: string;
10406
+ }
10407
+ ⋮----
10408
+ export interface FreezeSubAccountRequestV3 {
10409
+ subUid: string;
10410
+ operation: 'freeze' | 'unfreeze';
10411
+ }
10412
+ ⋮----
10413
+ export interface GetSubAccountListRequestV3 {
10414
+ limit?: string;
10415
+ cursor?: string;
10416
+ }
10417
+ ⋮----
10418
+ // Transfer Request Types
10419
+ ⋮----
10420
+ export interface TransferRequestV3 {
10421
+ clientOid?: string;
10422
+ fromType:
10423
+ | 'spot'
10424
+ | 'p2p'
10425
+ | 'coin-futures'
10426
+ | 'usdt-futures'
10427
+ | 'usdc-futures'
10428
+ | 'crossed-margin'
10429
+ | 'isolated-margin'
10430
+ | 'uta';
10431
+ toType:
10432
+ | 'spot'
10433
+ | 'p2p'
10434
+ | 'coin-futures'
10435
+ | 'usdt-futures'
10436
+ | 'usdc-futures'
10437
+ | 'crossed-margin'
10438
+ | 'isolated-margin'
10439
+ | 'uta';
10440
+ amount: string;
10441
+ coin: string;
10442
+ symbol?: string;
10443
+ /** Enable automatic margin borrowing when balance insufficient. yes | no */
10444
+ allowBorrow?: 'yes' | 'no';
10445
+ }
10446
+ ⋮----
10447
+ /** Enable automatic margin borrowing when balance insufficient. yes | no */
10448
+ ⋮----
10449
+ export interface GetTransferableCoinsRequestV3 {
10450
+ fromType:
10451
+ | 'spot'
10452
+ | 'p2p'
10453
+ | 'coin-futures'
10454
+ | 'usdt-futures'
10455
+ | 'usdc-futures'
10456
+ | 'crossed-margin'
10457
+ | 'isolated-margin'
10458
+ | 'uta';
10459
+ toType:
10460
+ | 'spot'
10461
+ | 'p2p'
10462
+ | 'coin-futures'
10463
+ | 'usdt-futures'
10464
+ | 'usdc-futures'
10465
+ | 'crossed-margin'
9992
10466
  | 'isolated-margin'
9993
10467
  | 'uta';
9994
10468
  }
@@ -10094,6 +10568,8 @@ export interface GetSubDepositRecordsRequestV3 {
10094
10568
  export interface WithdrawRequestV3 {
10095
10569
  coin: string;
10096
10570
  chain?: string;
10571
+ /** Deduct from funding, uta, and/or otc accounts (comma-separated). Order: funding -> otc -> uta */
10572
+ accountType?: string;
10097
10573
  transferType: 'on_chain' | 'internal_transfer';
10098
10574
  address: string;
10099
10575
  innerToType?: 'uid' | 'email' | 'mobile';
@@ -10109,6 +10585,8 @@ export interface WithdrawRequestV3 {
10109
10585
  lastName?: string;
10110
10586
  }
10111
10587
  ⋮----
10588
+ /** Deduct from funding, uta, and/or otc accounts (comma-separated). Order: funding -> otc -> uta */
10589
+ ⋮----
10112
10590
  export interface GetWithdrawRecordsRequestV3 {
10113
10591
  coin?: string;
10114
10592
  orderId?: string;
@@ -10160,6 +10638,38 @@ export interface GetTaxRecordsRequestV3 {
10160
10638
  limit?: string;
10161
10639
  cursor?: string;
10162
10640
  }
10641
+ ⋮----
10642
+ export type CollateralTypeV3 = 'mainstream' | 'all' | 'custom';
10643
+ ⋮----
10644
+ export interface SetCollateralTypeRequestV3 {
10645
+ collateralType: CollateralTypeV3;
10646
+ /** Required when collateralType=custom. Comma-separated coin names */
10647
+ collateralCoins?: string;
10648
+ }
10649
+ ⋮----
10650
+ /** Required when collateralType=custom. Comma-separated coin names */
10651
+ ⋮----
10652
+ export interface PreSetLeverageRequestV3 {
10653
+ category: 'MARGIN' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES';
10654
+ symbol?: string;
10655
+ coin?: string;
10656
+ marginMode: 'isolated' | 'cross';
10657
+ leverage?: string;
10658
+ longLeverage?: string;
10659
+ shortLeverage?: string;
10660
+ }
10661
+ ⋮----
10662
+ export interface SetMarginRequestV3 {
10663
+ category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES';
10664
+ symbol: string;
10665
+ posSide: 'long' | 'short';
10666
+ operation: 'add' | 'remove';
10667
+ amount: string;
10668
+ }
10669
+ ⋮----
10670
+ export interface GetMaxWithdrawalRequestV3 {
10671
+ coin: string;
10672
+ }
10163
10673
 
10164
10674
  ================
10165
10675
  File: src/types/response/v3/public.ts
@@ -10203,6 +10713,8 @@ export interface CurrentFundingRateV3 {
10203
10713
  nextUpdate: string;
10204
10714
  minFundingRate: string;
10205
10715
  maxFundingRate: string;
10716
+ cashDividend?: string;
10717
+ cashDividendNextUpdate?: string;
10206
10718
  }
10207
10719
  ⋮----
10208
10720
  export interface DiscountRateTierV3 {
@@ -10313,6 +10825,9 @@ export interface InstrumentV3 {
10313
10825
  maintainTime: string;
10314
10826
  areaSymbol?: string;
10315
10827
 
10828
+ /** yes = Reality stock token, no = non-Reality stock token */
10829
+ isReality?: 'yes' | 'no';
10830
+
10316
10831
  // Futures specific fields
10317
10832
  makerFeeRate?: string;
10318
10833
  takerFeeRate?: string;
@@ -10340,6 +10855,8 @@ export interface InstrumentV3 {
10340
10855
  userMinBorrow?: string;
10341
10856
  }
10342
10857
  ⋮----
10858
+ /** yes = Reality stock token, no = non-Reality stock token */
10859
+ ⋮----
10343
10860
  // Futures specific fields
10344
10861
  ⋮----
10345
10862
  /** Launch time - Unix millisecond timestamp. Null for some margin pairs. */
@@ -10355,8 +10872,12 @@ export interface MarketFeeGroupLabelV3 {
10355
10872
  export interface MarketFeeGroupTierV3 {
10356
10873
  level: string;
10357
10874
  makerFeeRate: string;
10875
+ /** PRO1~PRO6 only. Taker fee rate in decimal form */
10876
+ takerFeeRate?: string;
10358
10877
  }
10359
10878
  ⋮----
10879
+ /** PRO1~PRO6 only. Taker fee rate in decimal form */
10880
+ ⋮----
10360
10881
  export interface MarketFeeGroupV3 {
10361
10882
  category: string;
10362
10883
  group: string;
@@ -10373,6 +10894,19 @@ export interface MarketScoreWeightV3 {
10373
10894
  weight: string;
10374
10895
  }
10375
10896
  ⋮----
10897
+ export interface LiquidationV3 {
10898
+ symbol: string;
10899
+ side: 'buy' | 'sell';
10900
+ price: string;
10901
+ amount: string;
10902
+ ts: string;
10903
+ }
10904
+ ⋮----
10905
+ export interface LiquidationsV3 {
10906
+ list: LiquidationV3[];
10907
+ cursor?: string;
10908
+ }
10909
+ ⋮----
10376
10910
  export interface OrderBookV3 {
10377
10911
  a: string[][]; // asks - [price, size]
10378
10912
  b: string[][]; // bids - [price, size]
@@ -10388,322 +10922,134 @@ export interface TickerV3 {
10388
10922
  lastPrice: string;
10389
10923
  openPrice24h: string;
10390
10924
  highPrice24h: string;
10391
- lowPrice24h: string;
10392
- ask1Price: string;
10393
- bid1Price: string;
10394
- bid1Size: string;
10395
- ask1Size: string;
10396
- price24hPcnt: string;
10397
- volume24h: string;
10398
- turnover24h: string;
10399
-
10400
- // Futures specific fields
10401
- indexPrice?: string;
10402
- markPrice?: string;
10403
- fundingRate?: string;
10404
- openInterest?: string;
10405
- deliveryStartTime?: string;
10406
- deliveryTime?: string;
10407
- deliveryStatus?: string;
10408
- }
10409
- ⋮----
10410
- // Futures specific fields
10411
- ⋮----
10412
- export interface ProofOfReservesV3 {
10413
- merkleRootHash: string;
10414
- totalReserveRatio: string;
10415
- list: {
10416
- coin: string;
10417
- userAssets: string;
10418
- platformAssets: string;
10419
- reserveRatio: string;
10420
- }[];
10421
- }
10422
- ⋮----
10423
- export interface IndexComponentV3 {
10424
- exchange: string;
10425
- spotPair: string;
10426
- equivalentPrice: string;
10427
- weight: string;
10428
- }
10429
- ⋮----
10430
- export interface IndexPriceComponentsV3 {
10431
- symbol: string;
10432
- componentList: IndexComponentV3[];
10433
- }
10434
-
10435
- ================
10436
- File: src/types/websockets/ws-general.ts
10437
- ================
10438
- import type { ClientRequestArgs } from 'http';
10439
- import WebSocket from 'isomorphic-ws';
10440
- ⋮----
10441
- import { RestClientOptions } from '../../util/requestUtils.js';
10442
- import { WS_KEY_MAP } from '../../util/websocket-util.js';
10443
- import { FuturesProductTypeV2 } from '../request/shared.js';
10444
- ⋮----
10445
- export type BitgetInstType = 'SP' | 'SPBL' | 'MC' | 'UMCBL' | 'DMCBL';
10446
- export type BitgetInstTypeV2 = 'SPOT' | FuturesProductTypeV2;
10447
- export type BitgetInstTypeV3 =
10448
- | 'UTA' // for account-level topics
10449
- | 'spot'
10450
- | 'usdt-futures'
10451
- | 'coin-futures'
10452
- | 'usdc-futures';
10453
- ⋮----
10454
- | 'UTA' // for account-level topics
10455
- ⋮----
10456
- /**
10457
- *
10458
- * V1 list of topics for WebSocket consumers
10459
- *
10460
- */
10461
- ⋮----
10462
- export type WsPublicSpotTopic =
10463
- | 'ticker'
10464
- | 'candle1W'
10465
- | 'candle1D'
10466
- | 'candle12H'
10467
- | 'candle4H'
10468
- | 'candle1H'
10469
- | 'candle30m'
10470
- | 'candle15m'
10471
- | 'candle5m'
10472
- | 'candle1m'
10473
- | 'books'
10474
- | 'books5'
10475
- | 'trade';
10476
- ⋮----
10477
- // Futures currently has the same public topics as spot
10478
- export type WsPublicFuturesTopic = WsPublicSpotTopic;
10479
- export type WsPrivateSpotTopic = 'account' | 'orders';
10480
- ⋮----
10481
- export type WsPrivateFuturesTopic =
10482
- | 'account'
10483
- | 'positions'
10484
- | 'orders'
10485
- | 'ordersAlgo';
10486
- ⋮----
10487
- export type WsPublicTopic = WsPublicSpotTopic | WsPublicFuturesTopic;
10488
- ⋮----
10489
- export type WsPrivateTopic = WsPrivateSpotTopic | WsPrivateFuturesTopic;
10490
- export type WsTopic = WsPublicTopic | WsPrivateTopic;
10491
- ⋮----
10492
- /**
10493
- *
10494
- * V2 list of topics for WebSocket consumers
10495
- *
10496
- */
10497
- ⋮----
10498
- export type WsPublicTopicV2 =
10499
- | 'index-price' // margin only
10500
- | 'ticker'
10501
- | 'candle1m'
10502
- | 'candle5m'
10503
- | 'candle15m'
10504
- | 'candle30m'
10505
- | 'candle1H'
10506
- | 'candle4H'
10507
- | 'candle6H'
10508
- | 'candle12H'
10509
- | 'candle1D'
10510
- | 'candle3D'
10511
- | 'candle1W'
10512
- | 'candle1M'
10513
- | 'candle6Hutc'
10514
- | 'candle12Hutc'
10515
- | 'candle1Dutc'
10516
- | 'candle3Dutc'
10517
- | 'candle1Wutc'
10518
- | 'candle1Mutc'
10519
- | 'trade'
10520
- | 'books'
10521
- | 'books1'
10522
- | 'books5'
10523
- | 'books15';
10524
- ⋮----
10525
- | 'index-price' // margin only
10526
- ⋮----
10527
- // Also update PRIVATE_TOPICS_V2 if this is updated
10528
- export type WSPrivateTopicFuturesV2 =
10529
- | 'positions'
10530
- | 'orders-algo'
10531
- | 'positions-history';
10532
- ⋮----
10533
- // Also update PRIVATE_TOPICS_V2 if this is updated
10534
- export type WSPrivateTopicMarginV2 =
10535
- | 'orders-crossed'
10536
- | 'account-crossed'
10537
- | 'account-isolated'
10538
- | 'orders-isolated';
10539
- ⋮----
10540
- // Also update PRIVATE_TOPICS_V2 if this is updated
10541
- export type WsPrivateTopicV2 =
10542
- | 'account'
10543
- | 'orders'
10544
- | WSPrivateTopicFuturesV2
10545
- | WSPrivateTopicMarginV2;
10546
- ⋮----
10547
- export type WsTopicV2 = WsPublicTopicV2 | WsPrivateTopicV2;
10548
- ⋮----
10549
- /**
10550
- *
10551
- * V3 / UTA list of topics for WebSocket consumers
10552
- *
10553
- */
10554
- export type WsPublicTopicV3 = 'ticker' | 'kline' | 'books' | 'publicTrade';
10555
- // Also update PRIVATE_TOPICS_V3 if this is updated
10556
- export type WsPrivateTopicV3 =
10557
- | 'account'
10558
- | 'position'
10559
- | 'fill'
10560
- | 'order'
10561
- | 'strategy-order';
10562
- export type WsTopicV3 = WsPublicTopicV3 | WsPrivateTopicV3;
10563
- ⋮----
10564
- /** This is used to differentiate between each of the available websocket streams */
10565
- export type WsKey = (typeof WS_KEY_MAP)[keyof typeof WS_KEY_MAP];
10566
- ⋮----
10567
- /**
10568
- * Event args for subscribing/unsubscribing
10569
- */
10570
- ⋮----
10571
- export interface WsTopicSubscribeEventArgs {
10572
- instType: BitgetInstType;
10573
- channel: WsTopic;
10574
- instId?: string;
10575
- }
10576
- ⋮----
10577
- export type WsTopicSubscribePublicArgsV2 = {
10578
- instType: BitgetInstTypeV2;
10579
- channel: WsPublicTopicV2;
10580
- /** The symbol, e.g. "BTCUSDT" */
10581
- instId: string;
10582
- };
10583
- ⋮----
10584
- /** The symbol, e.g. "BTCUSDT" */
10585
- ⋮----
10586
- export type WsInstIdChannelsV2 =
10587
- | 'orders'
10588
- | WSPrivateTopicFuturesV2
10589
- | 'orders-crossed'
10590
- | 'orders-isolated';
10591
- ⋮----
10592
- export type WsTopicSubscribePrivateInstIdArgsV2 = {
10593
- instType: BitgetInstTypeV2;
10594
- channel: WsInstIdChannelsV2;
10595
- /** The symbol, e.g. "BTCUSDT" */
10596
- instId?: string;
10597
- };
10925
+ lowPrice24h: string;
10926
+ ask1Price: string;
10927
+ bid1Price: string;
10928
+ bid1Size: string;
10929
+ ask1Size: string;
10930
+ price24hPcnt: string;
10931
+ volume24h: string;
10932
+ turnover24h: string;
10933
+
10934
+ // Futures specific fields
10935
+ indexPrice?: string;
10936
+ markPrice?: string;
10937
+ fundingRate?: string;
10938
+ openInterest?: string;
10939
+ deliveryStartTime?: string;
10940
+ deliveryTime?: string;
10941
+ deliveryStatus?: string;
10942
+ }
10598
10943
  ⋮----
10599
- /** The symbol, e.g. "BTCUSDT" */
10944
+ // Futures specific fields
10600
10945
  ⋮----
10601
- export type WsCoinChannelsV2 =
10602
- | 'account'
10603
- | 'account-crossed'
10604
- | 'account-isolated';
10946
+ export interface ProofOfReservesV3 {
10947
+ merkleRootHash: string;
10948
+ totalReserveRatio: string;
10949
+ list: {
10950
+ coin: string;
10951
+ userAssets: string;
10952
+ platformAssets: string;
10953
+ reserveRatio: string;
10954
+ }[];
10955
+ }
10605
10956
  ⋮----
10606
- export type WsTopicSubscribePrivateCoinArgsV2 = {
10607
- instType: BitgetInstTypeV2;
10608
- channel: WsCoinChannelsV2;
10609
- coin: 'default' | string;
10610
- };
10957
+ export interface IndexComponentV3 {
10958
+ exchange: string;
10959
+ spotPair: string;
10960
+ equivalentPrice: string;
10961
+ weight: string;
10962
+ }
10611
10963
  ⋮----
10612
- export type WsTopicSubscribePrivateArgsV2 =
10613
- | WsTopicSubscribePrivateInstIdArgsV2
10614
- | WsTopicSubscribePrivateCoinArgsV2;
10964
+ export interface IndexPriceComponentsV3 {
10965
+ symbol: string;
10966
+ componentList: IndexComponentV3[];
10967
+ }
10615
10968
  ⋮----
10616
- export type WsTopicSubscribeEventArgsV2 =
10617
- | WsTopicSubscribePublicArgsV2
10618
- | WsTopicSubscribePrivateArgsV2;
10969
+ export interface RpiSymbolV3 {
10970
+ category: 'spot' | 'usdt-futures' | 'coin-futures' | 'usdc-futures';
10971
+ symbol: string;
10972
+ }
10619
10973
  ⋮----
10620
- /** General configuration for the WebsocketClient */
10621
- export interface WSClientConfigurableOptions {
10622
- /** Your API key */
10623
- apiKey?: string;
10624
-
10625
- /** Your API secret */
10626
- apiSecret?: string;
10627
-
10628
- /** The passphrase you set when creating the API Key (NOT your account password) */
10629
- apiPass?: string;
10630
-
10631
- /**
10632
- * Set to `true` to connect to Bitget's demo trading WebSockets:
10633
- *
10634
- * - V2: https://www.bitget.com/api-doc/common/demotrading/websocket
10635
- * - V3/UTA: https://www.bitget.com/api-doc/uta/guide#demo-trading
10636
- */
10637
- demoTrading?: boolean;
10638
-
10639
- /** Define a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 seconds */
10640
- recvWindow?: number;
10641
-
10642
- // Disable ping/pong ws heartbeat mechanism (not recommended)
10643
- disableHeartbeat?: boolean;
10644
-
10645
- /** How often to check if the connection is alive */
10646
- pingInterval?: number;
10647
-
10648
- /** How long to wait for a pong (heartbeat reply) before assuming the connection is dead */
10649
- pongTimeout?: number;
10650
-
10651
- /** Delay in milliseconds before respawning the connection */
10652
- reconnectTimeout?: number;
10653
-
10654
- requestOptions?: RestClientOptions;
10655
-
10656
- wsOptions?: {
10657
- protocols?: string[];
10658
- agent?: any;
10659
- } & Partial<WebSocket.ClientOptions | ClientRequestArgs>;
10660
-
10661
- wsUrl?: string;
10662
-
10663
- /**
10664
- * Allows you to provide a custom "signMessage" function, e.g. to use node's much faster createHmac method
10665
- *
10666
- * Look in the examples folder for a demonstration on using node's createHmac instead.
10667
- */
10668
- customSignMessageFn?: (message: string, secret: string) => Promise<string>;
10974
+ /** RPI order book depth: [price, nonRpiQty, rpiQty] */
10975
+ export interface RpiOrderBookV3 {
10976
+ a: [string, string, string][];
10977
+ b: [string, string, string][];
10978
+ ts: string;
10669
10979
  }
10670
10980
  ⋮----
10671
- /** Your API key */
10981
+ export interface CashDividendRecordV3 {
10982
+ symbol: string;
10983
+ exDividendDate: string;
10984
+ cashDividendPerShare: string;
10985
+ cashDividendTimestamp: string;
10986
+ }
10672
10987
  ⋮----
10673
- /** Your API secret */
10988
+ export interface SpotWhaleFlowV3 {
10989
+ volume: string;
10990
+ date: string;
10991
+ }
10674
10992
  ⋮----
10675
- /** The passphrase you set when creating the API Key (NOT your account password) */
10993
+ export interface SpotNetFlowV3 {
10994
+ netFlow: string;
10995
+ ts: string;
10996
+ }
10676
10997
  ⋮----
10677
- /**
10678
- * Set to `true` to connect to Bitget's demo trading WebSockets:
10679
- *
10680
- * - V2: https://www.bitget.com/api-doc/common/demotrading/websocket
10681
- * - V3/UTA: https://www.bitget.com/api-doc/uta/guide#demo-trading
10682
- */
10998
+ export interface SpotFundFlowV3 {
10999
+ whaleBuyVolume: string;
11000
+ dolphinBuyVolume: string;
11001
+ fishBuyVolume: string;
11002
+ whaleSellVolume: string;
11003
+ dolphinSellVolume: string;
11004
+ fishSellVolume: string;
11005
+ whaleBuyRatio: string;
11006
+ dolphinBuyRatio: string;
11007
+ fishBuyRatio: string;
11008
+ whaleSellRatio: string;
11009
+ dolphinSellRatio: string;
11010
+ fishSellRatio: string;
11011
+ }
10683
11012
  ⋮----
10684
- /** Define a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 seconds */
11013
+ export interface MarginLongShortV3 {
11014
+ longShortRatio: string;
11015
+ ts: string;
11016
+ }
10685
11017
  ⋮----
10686
- // Disable ping/pong ws heartbeat mechanism (not recommended)
11018
+ export interface MarginLoanGrowthV3 {
11019
+ growthRate: string;
11020
+ ts: string;
11021
+ }
10687
11022
  ⋮----
10688
- /** How often to check if the connection is alive */
11023
+ export interface MarginIsolatedBorrowV3 {
11024
+ borrowRate: string;
11025
+ ts: string;
11026
+ }
10689
11027
  ⋮----
10690
- /** How long to wait for a pong (heartbeat reply) before assuming the connection is dead */
11028
+ export interface FuturesActiveBuySellV3 {
11029
+ buyVolume: string;
11030
+ sellVolume: string;
11031
+ ts: string;
11032
+ }
10691
11033
  ⋮----
10692
- /** Delay in milliseconds before respawning the connection */
11034
+ export interface FuturesLongShortV3 {
11035
+ longRatio: string;
11036
+ shortRatio: string;
11037
+ longShortRatio: string;
11038
+ ts: string;
11039
+ }
10693
11040
  ⋮----
10694
- /**
10695
- * Allows you to provide a custom "signMessage" function, e.g. to use node's much faster createHmac method
10696
- *
10697
- * Look in the examples folder for a demonstration on using node's createHmac instead.
10698
- */
11041
+ export interface FuturesPositionLongShortV3 {
11042
+ longPositionRatio: string;
11043
+ shortPositionRatio: string;
11044
+ longShortPositionRatio: string;
11045
+ ts: string;
11046
+ }
10699
11047
  ⋮----
10700
- export interface WebsocketClientOptions extends WSClientConfigurableOptions {
10701
- pingInterval: number;
10702
- pongTimeout: number;
10703
- reconnectTimeout: number;
10704
- recvWindow: number;
10705
- authPrivateConnectionsOnConnect: boolean;
10706
- authPrivateRequests: boolean;
11048
+ export interface FuturesAccountLongShortV3 {
11049
+ longAccountRatio: string;
11050
+ shortAccountRatio: string;
11051
+ longShortAccountRatio: string;
11052
+ ts: string;
10707
11053
  }
10708
11054
 
10709
11055
  ================
@@ -10723,6 +11069,7 @@ File: README.md
10723
11069
  [![last commit](https://img.shields.io/github/last-commit/tiagosiebler/bitget-api)][1]
10724
11070
  [![CodeFactor](https://www.codefactor.io/repository/github/tiagosiebler/bitget-api/badge)](https://www.codefactor.io/repository/github/tiagosiebler/bitget-api)
10725
11071
  [![Telegram](https://img.shields.io/badge/chat-on%20telegram-blue.svg)](https://t.me/nodetraders)
11072
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/tiagosiebler/bitget-api)
10726
11073
 
10727
11074
  <p align="center">
10728
11075
  <a href="https://www.npmjs.com/package/bitget-api">
@@ -13963,6 +14310,7 @@ import {
13963
14310
  CreateSubAccountRequestV3,
13964
14311
  DeleteSubAccountApiKeyRequestV3,
13965
14312
  FreezeSubAccountRequestV3,
14313
+ GetAllFeeRatesRequestV3,
13966
14314
  GetConvertRecordsRequestV3,
13967
14315
  GetDepositAddressRequestV3,
13968
14316
  GetDepositRecordsRequestV3,
@@ -13970,6 +14318,7 @@ import {
13970
14318
  GetFinancialRecordsRequestV3,
13971
14319
  GetFundingAssetsRequestV3,
13972
14320
  GetMaxTransferableRequestV3,
14321
+ GetMaxWithdrawalRequestV3,
13973
14322
  GetOpenInterestLimitRequestV3,
13974
14323
  GetSubAccountApiKeysRequestV3,
13975
14324
  GetSubAccountListRequestV3,
@@ -13981,9 +14330,12 @@ import {
13981
14330
  GetTransferableCoinsRequestV3,
13982
14331
  GetWithdrawAddressBookRequestV3,
13983
14332
  GetWithdrawRecordsRequestV3,
14333
+ PreSetLeverageRequestV3,
13984
14334
  RepayRequestV3,
14335
+ SetCollateralTypeRequestV3,
13985
14336
  SetDepositAccountRequestV3,
13986
14337
  SetLeverageRequestV3,
14338
+ SetMarginRequestV3,
13987
14339
  SubAccountTransferRequestV3,
13988
14340
  SwitchDeductRequestV3,
13989
14341
  TransferRequestV3,
@@ -14054,13 +14406,19 @@ import {
14054
14406
  } from './types/request/v3/p2p.js';
14055
14407
  import {
14056
14408
  GetCandlesRequestV3,
14409
+ GetCashDividendRecordsRequestV3,
14057
14410
  GetContractsOiRequestV3,
14058
14411
  GetCurrentFundingRateRequestV3,
14412
+ GetFuturesTradingDataRequestV3,
14059
14413
  GetHistoryCandlesRequestV3,
14060
14414
  GetHistoryFundingRateRequestV3,
14061
14415
  GetIndexComponentsRequestV3,
14062
14416
  GetInstrumentsRequestV3,
14417
+ GetLiquidationsRequestV3,
14418
+ GetMarginIsolatedBorrowRequestV3,
14419
+ GetMarginLoanGrowthRequestV3,
14063
14420
  GetMarginLoansRequestV3,
14421
+ GetMarginLongShortRequestV3,
14064
14422
  GetMarketFeeGroupRequestV3,
14065
14423
  GetMarketScoreWeightsRequestV3,
14066
14424
  GetOpenInterestRequestV3,
@@ -14069,6 +14427,10 @@ import {
14069
14427
  GetPublicFillsRequestV3,
14070
14428
  GetRiskReserveAllRequestV3,
14071
14429
  GetRiskReserveRequestV3,
14430
+ GetRpiOrderBookRequestV3,
14431
+ GetSpotFundFlowRequestV3,
14432
+ GetSpotNetFlowRequestV3,
14433
+ GetSpotWhaleFlowRequestV3,
14072
14434
  GetTickersRequestV3,
14073
14435
  } from './types/request/v3/public.js';
14074
14436
  import {
@@ -14083,6 +14445,7 @@ import {
14083
14445
  CancelAllOrdersRequestV3,
14084
14446
  CancelBatchOrdersRequestV3,
14085
14447
  CancelOrderRequestV3,
14448
+ CancelRealityOrderRequestV3,
14086
14449
  CloseAllPositionsRequestV3,
14087
14450
  CountdownCancelAllRequestV3,
14088
14451
  GetCurrentPositionRequestV3,
@@ -14095,22 +14458,28 @@ import {
14095
14458
  ModifyOrderRequestV3,
14096
14459
  PlaceBatchOrdersRequestV3,
14097
14460
  PlaceOrderRequestV3,
14461
+ PlaceRealityOrderRequestV3,
14098
14462
  } from './types/request/v3/trade.js';
14099
14463
  import {
14100
14464
  AccountAssetsV3,
14101
14465
  AccountDeltaInfoV3,
14102
14466
  AccountInfoV3,
14103
14467
  AccountSettingsV3,
14468
+ AllSymbolFeeRateV3,
14469
+ CollateralTypeConfigV3,
14104
14470
  ConvertRecordV3,
14105
14471
  CreateSubAccountApiKeyResponseV3,
14106
14472
  CreateSubAccountResponseV3,
14473
+ CustomCollateralCoinV3,
14107
14474
  DepositAddressV3,
14108
14475
  DepositRecordV3,
14109
14476
  FinancialRecordV3,
14110
14477
  FundingAssetV3,
14111
14478
  MaxTransferableV3,
14479
+ MaxWithdrawalV3,
14112
14480
  OpenInterestLimitV3,
14113
14481
  PaymentCoinV3,
14482
+ PreSetLeverageV3,
14114
14483
  RepayableCoinV3,
14115
14484
  RepayResponseV3,
14116
14485
  SubAccountApiKeyV3,
@@ -14192,13 +14561,22 @@ import {
14192
14561
  } from './types/response/v3/p2p.js';
14193
14562
  import {
14194
14563
  CandlestickV3,
14564
+ CashDividendRecordV3,
14195
14565
  ContractOiV3,
14196
14566
  CurrentFundingRateV3,
14197
14567
  DiscountRateV3,
14568
+ FuturesAccountLongShortV3,
14569
+ FuturesActiveBuySellV3,
14570
+ FuturesLongShortV3,
14571
+ FuturesPositionLongShortV3,
14198
14572
  HistoryFundingRateV3,
14199
14573
  IndexPriceComponentsV3,
14200
14574
  InstrumentV3,
14575
+ LiquidationsV3,
14576
+ MarginIsolatedBorrowV3,
14577
+ MarginLoanGrowthV3,
14201
14578
  MarginLoanV3,
14579
+ MarginLongShortV3,
14202
14580
  MarketFeeGroupV3,
14203
14581
  MarketScoreWeightV3,
14204
14582
  OpenInterestV3,
@@ -14209,6 +14587,11 @@ import {
14209
14587
  RiskReserveAllV3,
14210
14588
  RiskReserveHourV3,
14211
14589
  RiskReserveV3,
14590
+ RpiOrderBookV3,
14591
+ RpiSymbolV3,
14592
+ SpotFundFlowV3,
14593
+ SpotNetFlowV3,
14594
+ SpotWhaleFlowV3,
14212
14595
  TickerV3,
14213
14596
  } from './types/response/v3/public.js';
14214
14597
  import {
@@ -14226,6 +14609,7 @@ import {
14226
14609
  FillV3,
14227
14610
  GetMaxOpenAvailableResponseV3,
14228
14611
  HistoryOrderV3,
14612
+ LoanDataV3,
14229
14613
  ModifyOrderResponseV3,
14230
14614
  OrderInfoV3,
14231
14615
  PlaceBatchOrdersResponseV3,
@@ -14299,6 +14683,102 @@ getMarketFeeGroup(
14299
14683
  params: GetMarketFeeGroupRequestV3,
14300
14684
  ): Promise<APIResponse<MarketFeeGroupV3[]>>
14301
14685
  ⋮----
14686
+ /**
14687
+ * Get Liquidations History - Query historical liquidation order data (last 3 days)
14688
+ */
14689
+ getLiquidations(
14690
+ params: GetLiquidationsRequestV3,
14691
+ ): Promise<APIResponse<LiquidationsV3>>
14692
+ ⋮----
14693
+ /**
14694
+ * Get RPI Symbols - Trading pairs supporting Retail Price Improvement
14695
+ */
14696
+ getRpiSymbols(): Promise<APIResponse<RpiSymbolV3[]>>
14697
+ ⋮----
14698
+ /**
14699
+ * Get RPI OrderBook - Depth with RPI and non-RPI quantities per price level
14700
+ */
14701
+ getRpiOrderBook(
14702
+ params: GetRpiOrderBookRequestV3,
14703
+ ): Promise<APIResponse<RpiOrderBookV3>>
14704
+ ⋮----
14705
+ /**
14706
+ * Get Cash Dividend Records - RWA stock futures cash dividend records
14707
+ */
14708
+ getCashDividendRecords(
14709
+ params: GetCashDividendRecordsRequestV3,
14710
+ ): Promise<APIResponse<CashDividendRecordV3[]>>
14711
+ ⋮----
14712
+ /**
14713
+ * Get Spot Whale Net Flow Data
14714
+ */
14715
+ getSpotWhaleFlow(
14716
+ params: GetSpotWhaleFlowRequestV3,
14717
+ ): Promise<APIResponse<SpotWhaleFlowV3[]>>
14718
+ ⋮----
14719
+ /**
14720
+ * Get Spot Fund Flow Data
14721
+ */
14722
+ getSpotFundFlow(
14723
+ params: GetSpotFundFlowRequestV3,
14724
+ ): Promise<APIResponse<SpotFundFlowV3>>
14725
+ ⋮----
14726
+ /**
14727
+ * Get Spot 24H Net Capital Inflow Data
14728
+ */
14729
+ getSpotNetFlow(
14730
+ params: GetSpotNetFlowRequestV3,
14731
+ ): Promise<APIResponse<SpotNetFlowV3[]>>
14732
+ ⋮----
14733
+ /**
14734
+ * Get Margin Long Short Ratio Data
14735
+ */
14736
+ getMarginLongShort(
14737
+ params: GetMarginLongShortRequestV3,
14738
+ ): Promise<APIResponse<MarginLongShortV3[]>>
14739
+ ⋮----
14740
+ /**
14741
+ * Get Margin Loan Growth Rate Data
14742
+ */
14743
+ getMarginLoanGrowth(
14744
+ params: GetMarginLoanGrowthRequestV3,
14745
+ ): Promise<APIResponse<MarginLoanGrowthV3[]>>
14746
+ ⋮----
14747
+ /**
14748
+ * Get Isolated Margin Borrowing Ratio Data
14749
+ */
14750
+ getMarginIsolatedBorrow(
14751
+ params: GetMarginIsolatedBorrowRequestV3,
14752
+ ): Promise<APIResponse<MarginIsolatedBorrowV3[]>>
14753
+ ⋮----
14754
+ /**
14755
+ * Get Futures Active Buy Sell Volume Data
14756
+ */
14757
+ getFuturesActiveBuySell(
14758
+ params: GetFuturesTradingDataRequestV3,
14759
+ ): Promise<APIResponse<FuturesActiveBuySellV3[]>>
14760
+ ⋮----
14761
+ /**
14762
+ * Get Futures Long Short Ratio Data
14763
+ */
14764
+ getFuturesLongShort(
14765
+ params: GetFuturesTradingDataRequestV3,
14766
+ ): Promise<APIResponse<FuturesLongShortV3[]>>
14767
+ ⋮----
14768
+ /**
14769
+ * Get Futures Active Long Short Position Data
14770
+ */
14771
+ getFuturesPositionLongShort(
14772
+ params: GetFuturesTradingDataRequestV3,
14773
+ ): Promise<APIResponse<FuturesPositionLongShortV3[]>>
14774
+ ⋮----
14775
+ /**
14776
+ * Get Futures Active Long Short Account Data
14777
+ */
14778
+ getFuturesAccountLongShort(
14779
+ params: GetFuturesTradingDataRequestV3,
14780
+ ): Promise<APIResponse<FuturesAccountLongShortV3[]>>
14781
+ ⋮----
14302
14782
  /**
14303
14783
  * Get Market Maker Score Weight - Query score weights per symbol
14304
14784
  */
@@ -14525,6 +15005,42 @@ setHoldMode(params: {
14525
15005
  holdMode: 'one_way_mode' | 'hedge_mode';
14526
15006
  }): Promise<APIResponse<string>>
14527
15007
  ⋮----
15008
+ /**
15009
+ * Get Collateral Type - Query unified account collateral configuration
15010
+ */
15011
+ getCollateralType(): Promise<APIResponse<CollateralTypeConfigV3>>
15012
+ ⋮----
15013
+ /**
15014
+ * Set Collateral Type - Configure unified account collateral type
15015
+ */
15016
+ setCollateralType(
15017
+ params: SetCollateralTypeRequestV3,
15018
+ ): Promise<APIResponse<string>>
15019
+ ⋮----
15020
+ /**
15021
+ * Get Custom Collateral Coins - Platform-supported custom collateral coins
15022
+ */
15023
+ getCustomCollateralCoins(): Promise<APIResponse<CustomCollateralCoinV3[]>>
15024
+ ⋮----
15025
+ /**
15026
+ * Pre Set Leverage - Preview leverage adjustment impact without applying
15027
+ */
15028
+ preSetLeverage(
15029
+ params: PreSetLeverageRequestV3,
15030
+ ): Promise<APIResponse<PreSetLeverageV3>>
15031
+ ⋮----
15032
+ /**
15033
+ * Set Margin - Adjust isolated margin position margin amount
15034
+ */
15035
+ setMargin(params: SetMarginRequestV3): Promise<APIResponse<string>>
15036
+ ⋮----
15037
+ /**
15038
+ * Get Max Withdrawal - Max withdrawable amount for a coin in unified account
15039
+ */
15040
+ getMaxWithdrawal(
15041
+ params: GetMaxWithdrawalRequestV3,
15042
+ ): Promise<APIResponse<MaxWithdrawalV3>>
15043
+ ⋮----
14528
15044
  /**
14529
15045
  * Get Financial Records
14530
15046
  */
@@ -14610,6 +15126,13 @@ getFeeRate(params: GetFeeRateRequestV3): Promise<
14610
15126
  > {
14611
15127
  return this.getPrivate('/api/v3/account/fee-rate', params);
14612
15128
  ⋮----
15129
+ /**
15130
+ * Get All Symbol Fee Rates - Query fee rates for all trading pairs under a product type
15131
+ */
15132
+ getAllFeeRates(
15133
+ params: GetAllFeeRatesRequestV3,
15134
+ ): Promise<APIResponse<AllSymbolFeeRateV3[]>>
15135
+ ⋮----
14613
15136
  /**
14614
15137
  * Get Max Transferable
14615
15138
  *
@@ -14867,6 +15390,25 @@ modifyOrder(
14867
15390
  params: ModifyOrderRequestV3,
14868
15391
  ): Promise<APIResponse<ModifyOrderResponseV3>>
14869
15392
  ⋮----
15393
+ /**
15394
+ * Place Reality Order - Limit or market order for Reality stock trading pairs
15395
+ */
15396
+ placeRealityOrder(
15397
+ params: PlaceRealityOrderRequestV3,
15398
+ ): Promise<APIResponse<PlaceOrderResponseV3>>
15399
+ ⋮----
15400
+ /**
15401
+ * Cancel Reality Order - Cancel an unfilled or partially filled Reality stock order
15402
+ */
15403
+ cancelRealityOrder(
15404
+ params: CancelRealityOrderRequestV3,
15405
+ ): Promise<APIResponse<CancelOrderResponseV3>>
15406
+ ⋮----
15407
+ /**
15408
+ * Get Loan Data - Query current loan data for the unified trading account
15409
+ */
15410
+ getLoanData(): Promise<APIResponse<LoanDataV3>>
15411
+ ⋮----
14870
15412
  /**
14871
15413
  * Cancel Order
14872
15414
  */
@@ -15421,7 +15963,7 @@ File: package.json
15421
15963
  ================
15422
15964
  {
15423
15965
  "name": "bitget-api",
15424
- "version": "3.1.8",
15966
+ "version": "3.1.11",
15425
15967
  "description": "Complete Node.js & JavaScript SDK for Bitget V1-V3 REST APIs & WebSockets, with TypeScript & end-to-end tests.",
15426
15968
  "scripts": {
15427
15969
  "test": "jest",
@@ -15473,9 +16015,7 @@ File: package.json
15473
16015
  "jest": "^29.7.0",
15474
16016
  "ts-jest": "^29.4.0",
15475
16017
  "ts-node": "^10.9.2",
15476
- "typescript": "^5.7.3"
15477
- },
15478
- "optionalDependencies": {
16018
+ "typescript": "^5.7.3",
15479
16019
  "source-map-loader": "^4.0.0",
15480
16020
  "ts-loader": "^9.5.4",
15481
16021
  "webpack": "^5.74.0",