bitget-api 3.0.12 → 3.1.0

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.
Files changed (82) hide show
  1. package/README.md +4 -13
  2. package/dist/cjs/index.d.ts +0 -10
  3. package/dist/cjs/index.js +0 -10
  4. package/dist/cjs/index.js.map +1 -1
  5. package/dist/cjs/rest-client-v2.d.ts +1 -1
  6. package/dist/cjs/rest-client-v3.d.ts +1 -1
  7. package/dist/cjs/types/request/v2/futures.d.ts +1 -1
  8. package/dist/cjs/types/shared.d.ts +6 -0
  9. package/dist/cjs/types/websockets/ws-general.d.ts +3 -1
  10. package/dist/cjs/util/BaseRestClient.js +5 -0
  11. package/dist/cjs/util/BaseRestClient.js.map +1 -1
  12. package/dist/mjs/index.d.ts +0 -10
  13. package/dist/mjs/index.js +0 -10
  14. package/dist/mjs/index.js.map +1 -1
  15. package/dist/mjs/rest-client-v2.d.ts +1 -1
  16. package/dist/mjs/rest-client-v3.d.ts +1 -1
  17. package/dist/mjs/types/request/v2/futures.d.ts +1 -1
  18. package/dist/mjs/types/shared.d.ts +6 -0
  19. package/dist/mjs/types/websockets/ws-general.d.ts +3 -1
  20. package/dist/mjs/util/BaseRestClient.js +5 -0
  21. package/dist/mjs/util/BaseRestClient.js.map +1 -1
  22. package/package.json +3 -2
  23. package/dist/cjs/broker-client.d.ts +0 -127
  24. package/dist/cjs/broker-client.js +0 -165
  25. package/dist/cjs/broker-client.js.map +0 -1
  26. package/dist/cjs/futures-client.d.ts +0 -184
  27. package/dist/cjs/futures-client.js +0 -480
  28. package/dist/cjs/futures-client.js.map +0 -1
  29. package/dist/cjs/spot-client.d.ts +0 -154
  30. package/dist/cjs/spot-client.js +0 -280
  31. package/dist/cjs/spot-client.js.map +0 -1
  32. package/dist/cjs/types/request/v1/brokerV1.d.ts +0 -23
  33. package/dist/cjs/types/request/v1/brokerV1.js +0 -3
  34. package/dist/cjs/types/request/v1/brokerV1.js.map +0 -1
  35. package/dist/cjs/types/request/v1/futuresV1.d.ts +0 -168
  36. package/dist/cjs/types/request/v1/futuresV1.js +0 -3
  37. package/dist/cjs/types/request/v1/futuresV1.js.map +0 -1
  38. package/dist/cjs/types/request/v1/spotV1.d.ts +0 -105
  39. package/dist/cjs/types/request/v1/spotV1.js +0 -3
  40. package/dist/cjs/types/request/v1/spotV1.js.map +0 -1
  41. package/dist/cjs/types/response/v1/futures.d.ts +0 -72
  42. package/dist/cjs/types/response/v1/futures.js +0 -3
  43. package/dist/cjs/types/response/v1/futures.js.map +0 -1
  44. package/dist/cjs/types/response/v1/shared.d.ts +0 -15
  45. package/dist/cjs/types/response/v1/shared.js +0 -3
  46. package/dist/cjs/types/response/v1/shared.js.map +0 -1
  47. package/dist/cjs/types/response/v1/spot.d.ts +0 -65
  48. package/dist/cjs/types/response/v1/spot.js +0 -3
  49. package/dist/cjs/types/response/v1/spot.js.map +0 -1
  50. package/dist/cjs/websocket-client-legacy-v1.d.ts +0 -127
  51. package/dist/cjs/websocket-client-legacy-v1.js +0 -509
  52. package/dist/cjs/websocket-client-legacy-v1.js.map +0 -1
  53. package/dist/mjs/broker-client.d.ts +0 -127
  54. package/dist/mjs/broker-client.js +0 -158
  55. package/dist/mjs/broker-client.js.map +0 -1
  56. package/dist/mjs/futures-client.d.ts +0 -184
  57. package/dist/mjs/futures-client.js +0 -473
  58. package/dist/mjs/futures-client.js.map +0 -1
  59. package/dist/mjs/spot-client.d.ts +0 -154
  60. package/dist/mjs/spot-client.js +0 -273
  61. package/dist/mjs/spot-client.js.map +0 -1
  62. package/dist/mjs/types/request/v1/brokerV1.d.ts +0 -23
  63. package/dist/mjs/types/request/v1/brokerV1.js +0 -2
  64. package/dist/mjs/types/request/v1/brokerV1.js.map +0 -1
  65. package/dist/mjs/types/request/v1/futuresV1.d.ts +0 -168
  66. package/dist/mjs/types/request/v1/futuresV1.js +0 -2
  67. package/dist/mjs/types/request/v1/futuresV1.js.map +0 -1
  68. package/dist/mjs/types/request/v1/spotV1.d.ts +0 -105
  69. package/dist/mjs/types/request/v1/spotV1.js +0 -2
  70. package/dist/mjs/types/request/v1/spotV1.js.map +0 -1
  71. package/dist/mjs/types/response/v1/futures.d.ts +0 -72
  72. package/dist/mjs/types/response/v1/futures.js +0 -2
  73. package/dist/mjs/types/response/v1/futures.js.map +0 -1
  74. package/dist/mjs/types/response/v1/shared.d.ts +0 -15
  75. package/dist/mjs/types/response/v1/shared.js +0 -2
  76. package/dist/mjs/types/response/v1/shared.js.map +0 -1
  77. package/dist/mjs/types/response/v1/spot.d.ts +0 -65
  78. package/dist/mjs/types/response/v1/spot.js +0 -2
  79. package/dist/mjs/types/response/v1/spot.js.map +0 -1
  80. package/dist/mjs/websocket-client-legacy-v1.d.ts +0 -127
  81. package/dist/mjs/websocket-client-legacy-v1.js +0 -502
  82. package/dist/mjs/websocket-client-legacy-v1.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"futures.js","sourceRoot":"","sources":["../../../../../src/types/response/v1/futures.ts"],"names":[],"mappings":""}
@@ -1,15 +0,0 @@
1
- export interface APIResponse<T> {
2
- code: string;
3
- requestTime: number;
4
- msg: 'success' | string;
5
- data: T;
6
- }
7
- export interface VIPFeeRate {
8
- level: number;
9
- dealAmount: string;
10
- assetAmount: string;
11
- takerFeeRate?: string;
12
- makerFeeRate?: number;
13
- withdrawAmount: string;
14
- withdrawAmountUSDT: string;
15
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=shared.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../../src/types/response/v1/shared.ts"],"names":[],"mappings":""}
@@ -1,65 +0,0 @@
1
- export interface CoinBalance {
2
- coinId: number;
3
- coinName: string;
4
- available: string;
5
- frozen: string;
6
- lock: string;
7
- uTime: string;
8
- }
9
- export interface SymbolRules {
10
- symbol: string;
11
- symbolName: string;
12
- baseCoin: string;
13
- quoteCoin: string;
14
- minTradeAmount: string;
15
- maxTradeAmount: string;
16
- takerFeeRate: string;
17
- makerFeeRate: string;
18
- priceScale: string;
19
- quantityScale: string;
20
- status: string;
21
- }
22
- export interface SpotOrderResult {
23
- orderId: string;
24
- clientOrderId: string;
25
- }
26
- export interface SpotPlanOrder {
27
- orderId: string;
28
- clientOid: string;
29
- symbol: string;
30
- size: string;
31
- executePrice: string;
32
- triggerPrice: string;
33
- status: string;
34
- orderType: string;
35
- side: string;
36
- triggerType: string;
37
- enterPointSource: string;
38
- cTime: number;
39
- }
40
- export interface SpotMarketTrade {
41
- symbol: string;
42
- tradeId: string;
43
- side: 'buy' | 'sell';
44
- fillPrice: string;
45
- fillQuantity: string;
46
- fillTime: string;
47
- }
48
- export interface SpotAccountAsset {
49
- coin: string;
50
- available: string;
51
- frozen: string;
52
- locked: string;
53
- limitAvailable: string;
54
- uTime: string;
55
- }
56
- export interface SpotAccountBill {
57
- cTime: string;
58
- coino: string;
59
- groupType: string;
60
- businessType: 'SMALL_EXCHANGE_USER_IN' | 'SMALL_EXCHANGE_USER_OUT' | 'AIRDROP_REWARD' | 'WITHDRAW' | string;
61
- size: string;
62
- balance: string;
63
- fees: string;
64
- billd: string;
65
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=spot.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spot.js","sourceRoot":"","sources":["../../../../../src/types/response/v1/spot.ts"],"names":[],"mappings":""}
@@ -1,127 +0,0 @@
1
- import { EventEmitter } from 'events';
2
- import WebSocket from 'isomorphic-ws';
3
- import { BitgetInstType, WSClientConfigurableOptions, WsKey, WsTopic, WsTopicSubscribeEventArgs } from './types/websockets/ws-general.js';
4
- import { DefaultLogger } from './util/logger.js';
5
- export type WsClientEvent = 'open' | 'update' | 'close' | 'exception' | 'reconnect' | 'reconnected' | 'response';
6
- interface WebsocketClientEvents {
7
- /** Connection opened. If this connection was previously opened and reconnected, expect the reconnected event instead */
8
- open: (evt: {
9
- wsKey: WsKey;
10
- event: any;
11
- }) => void;
12
- /** Reconnecting a dropped connection */
13
- reconnect: (evt: {
14
- wsKey: WsKey;
15
- event: any;
16
- }) => void;
17
- /** Successfully reconnected a connection that dropped */
18
- reconnected: (evt: {
19
- wsKey: WsKey;
20
- event: any;
21
- }) => void;
22
- /** Connection closed */
23
- close: (evt: {
24
- wsKey: WsKey;
25
- event: any;
26
- }) => void;
27
- /** Received reply to websocket command (e.g. after subscribing to topics) */
28
- response: (response: any & {
29
- wsKey: WsKey;
30
- }) => void;
31
- /** Received data for topic */
32
- update: (response: any & {
33
- wsKey: WsKey;
34
- }) => void;
35
- /** Exception from ws client OR custom listeners (e.g. if you throw inside your event handler) */
36
- exception: (response: any & {
37
- wsKey: WsKey;
38
- }) => void;
39
- /** Confirmation that a connection successfully authenticated */
40
- authenticated: (event: {
41
- wsKey: WsKey;
42
- event: any;
43
- }) => void;
44
- }
45
- export declare interface WebsocketClientLegacyV1 {
46
- on<U extends keyof WebsocketClientEvents>(event: U, listener: WebsocketClientEvents[U]): this;
47
- emit<U extends keyof WebsocketClientEvents>(event: U, ...args: Parameters<WebsocketClientEvents[U]>): boolean;
48
- }
49
- /**
50
- * @deprecated use WebsocketClientV2 instead
51
- */
52
- export declare class WebsocketClientLegacyV1 extends EventEmitter {
53
- private logger;
54
- private options;
55
- private wsStore;
56
- constructor(options: WSClientConfigurableOptions, logger?: typeof DefaultLogger);
57
- /**
58
- * Subscribe to topics & track/persist them. They will be automatically resubscribed to if the connection drops/reconnects.
59
- * @param wsTopics topic or list of topics
60
- * @param isPrivateTopic optional - the library will try to detect private topics, you can use this to mark a topic as private (if the topic isn't recognised yet)
61
- */
62
- subscribe(wsTopics: WsTopicSubscribeEventArgs[] | WsTopicSubscribeEventArgs, isPrivateTopic?: boolean): void;
63
- /**
64
- * Unsubscribe from topics & remove them from memory. They won't be re-subscribed to if the connection reconnects.
65
- * @param wsTopics topic or list of topics
66
- * @param isPrivateTopic optional - the library will try to detect private topics, you can use this to mark a topic as private (if the topic isn't recognised yet)
67
- */
68
- unsubscribe(wsTopics: WsTopicSubscribeEventArgs[] | WsTopicSubscribeEventArgs, isPrivateTopic?: boolean): void;
69
- /** Get the WsStore that tracks websockets & topics */
70
- getWsStore(): typeof this.wsStore;
71
- close(wsKey: WsKey, force?: boolean): void;
72
- closeAll(force?: boolean): void;
73
- /**
74
- * Request connection of all dependent (public & private) websockets, instead of waiting for automatic connection by library
75
- */
76
- connectAll(): Promise<WebSocket | undefined>[];
77
- /**
78
- * Request connection to a specific websocket, instead of waiting for automatic connection.
79
- */
80
- private connect;
81
- private parseWsError;
82
- private getWsAuthSignature;
83
- /** Get a signature, build the auth request and send it */
84
- private sendAuthRequest;
85
- private reconnectWithDelay;
86
- private ping;
87
- private clearTimers;
88
- private clearPingTimer;
89
- private clearPongTimer;
90
- /**
91
- * @private Use the `subscribe(topics)` method to subscribe to topics. Send WS message to subscribe to topics.
92
- */
93
- private requestSubscribeTopics;
94
- /**
95
- * @private Use the `unsubscribe(topics)` method to unsubscribe from topics. Send WS message to unsubscribe from topics.
96
- */
97
- private requestUnsubscribeTopics;
98
- tryWsSend(wsKey: WsKey, wsMessage: string): void;
99
- private connectToWsUrl;
100
- private onWsOpen;
101
- /** Handle subscription to private topics _after_ authentication successfully completes asynchronously */
102
- private onWsAuthenticated;
103
- private onWsMessage;
104
- private onWsClose;
105
- private getWs;
106
- private setWsState;
107
- private getWsUrl;
108
- /**
109
- * Subscribe to a topic
110
- * @param instType instrument type (refer to API docs).
111
- * @param topic topic name (e.g. "ticker").
112
- * @param instId instrument ID (e.g. "BTCUSDT"). Use "default" for private topics.
113
- *
114
- * @deprecated use WebsocketClientV2 instead
115
- */
116
- subscribeTopic(instType: BitgetInstType, topic: WsTopic, instId?: string): void;
117
- /**
118
- * Unsubscribe from a topic
119
- * @param instType instrument type (refer to API docs).
120
- * @param topic topic name (e.g. "ticker").
121
- * @param instId instrument ID (e.g. "BTCUSDT"). Use "default" for private topics to get all symbols.
122
- *
123
- * @deprecated use WebsocketClientV2 instead
124
- */
125
- unsubscribeTopic(instType: BitgetInstType, topic: WsTopic, instId?: string): void;
126
- }
127
- export {};