gateio-api 1.1.11 → 1.2.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.
- package/README.md +93 -86
- package/dist/cjs/WebsocketAPIClient.d.ts +136 -0
- package/dist/cjs/WebsocketAPIClient.js +197 -0
- package/dist/cjs/WebsocketAPIClient.js.map +1 -0
- package/dist/cjs/WebsocketClient.d.ts +14 -2
- package/dist/cjs/WebsocketClient.js +102 -20
- package/dist/cjs/WebsocketClient.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lib/BaseRestClient.js +17 -0
- package/dist/cjs/lib/BaseRestClient.js.map +1 -1
- package/dist/cjs/lib/BaseWSClient.d.ts +14 -3
- package/dist/cjs/lib/BaseWSClient.js +95 -24
- package/dist/cjs/lib/BaseWSClient.js.map +1 -1
- package/dist/cjs/lib/logger.d.ts +1 -0
- package/dist/cjs/lib/requestUtils.d.ts +11 -0
- package/dist/cjs/lib/requestUtils.js.map +1 -1
- package/dist/cjs/lib/websocket/WsStore.d.ts +13 -2
- package/dist/cjs/lib/websocket/WsStore.js +44 -19
- package/dist/cjs/lib/websocket/WsStore.js.map +1 -1
- package/dist/cjs/lib/websocket/WsStore.types.d.ts +10 -3
- package/dist/cjs/lib/websocket/WsStore.types.js +1 -1
- package/dist/cjs/lib/websocket/WsStore.types.js.map +1 -1
- package/dist/cjs/types/websockets/wsAPI.d.ts +193 -38
- package/dist/cjs/types/websockets/wsAPI.js +0 -5
- package/dist/cjs/types/websockets/wsAPI.js.map +1 -1
- package/dist/mjs/WebsocketAPIClient.d.ts +136 -0
- package/dist/mjs/WebsocketAPIClient.js +193 -0
- package/dist/mjs/WebsocketAPIClient.js.map +1 -0
- package/dist/mjs/WebsocketClient.d.ts +14 -2
- package/dist/mjs/WebsocketClient.js +102 -20
- package/dist/mjs/WebsocketClient.js.map +1 -1
- package/dist/mjs/index.d.ts +1 -0
- package/dist/mjs/index.js +1 -0
- package/dist/mjs/index.js.map +1 -1
- package/dist/mjs/lib/BaseRestClient.js +17 -0
- package/dist/mjs/lib/BaseRestClient.js.map +1 -1
- package/dist/mjs/lib/BaseWSClient.d.ts +14 -3
- package/dist/mjs/lib/BaseWSClient.js +95 -24
- package/dist/mjs/lib/BaseWSClient.js.map +1 -1
- package/dist/mjs/lib/logger.d.ts +1 -0
- package/dist/mjs/lib/requestUtils.d.ts +11 -0
- package/dist/mjs/lib/requestUtils.js.map +1 -1
- package/dist/mjs/lib/websocket/WsStore.d.ts +13 -2
- package/dist/mjs/lib/websocket/WsStore.js +39 -14
- package/dist/mjs/lib/websocket/WsStore.js.map +1 -1
- package/dist/mjs/lib/websocket/WsStore.types.d.ts +10 -3
- package/dist/mjs/lib/websocket/WsStore.types.js +1 -1
- package/dist/mjs/lib/websocket/WsStore.types.js.map +1 -1
- package/dist/mjs/types/websockets/wsAPI.d.ts +193 -38
- package/dist/mjs/types/websockets/wsAPI.js +0 -5
- package/dist/mjs/types/websockets/wsAPI.js.map +1 -1
- package/package.json +6 -2
|
@@ -6,6 +6,6 @@ export var WsConnectionStateEnum;
|
|
|
6
6
|
WsConnectionStateEnum[WsConnectionStateEnum["CLOSING"] = 3] = "CLOSING";
|
|
7
7
|
WsConnectionStateEnum[WsConnectionStateEnum["RECONNECTING"] = 4] = "RECONNECTING";
|
|
8
8
|
// ERROR_RECONNECTING = 5,
|
|
9
|
-
|
|
9
|
+
WsConnectionStateEnum[WsConnectionStateEnum["ERROR"] = 5] = "ERROR";
|
|
10
10
|
})(WsConnectionStateEnum || (WsConnectionStateEnum = {}));
|
|
11
11
|
//# sourceMappingURL=WsStore.types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WsStore.types.js","sourceRoot":"","sources":["../../../../src/lib/websocket/WsStore.types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WsStore.types.js","sourceRoot":"","sources":["../../../../src/lib/websocket/WsStore.types.ts"],"names":[],"mappings":"AAGA,MAAM,CAAN,IAAY,qBAQX;AARD,WAAY,qBAAqB;IAC/B,uEAAW,CAAA;IACX,6EAAc,CAAA;IACd,2EAAa,CAAA;IACb,uEAAW,CAAA;IACX,iFAAgB,CAAA;IAChB,0BAA0B;IAC1B,mEAAS,CAAA;AACX,CAAC,EARW,qBAAqB,KAArB,qBAAqB,QAQhC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { WsKey } from '../../lib/websocket/websocket-util.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export type SpotWSAPITopic = 'spot.login' | 'spot.order_place' | 'spot.order_cancel' | 'spot.order_cancel_ids' | 'spot.order_cancel_cp' | 'spot.order_amend' | 'spot.order_status';
|
|
5
|
-
export type FuturesWSAPITopic = 'futures.login' | 'futures.order_place' | 'futures.order_batch_place' | 'futures.order_cancel' | 'futures.order_cancel_cp' | 'futures.order_amend' | 'futures.order_list' | 'futures.order_status';
|
|
2
|
+
export type SpotWSAPITopic = 'spot.login' | 'spot.order_place' | 'spot.order_cancel' | 'spot.order_cancel_ids' | 'spot.order_cancel_cp' | 'spot.order_amend' | 'spot.order_status' | 'spot.order_list';
|
|
3
|
+
export type FuturesWSAPITopic = 'futures.login' | 'futures.order_place' | 'futures.order_batch_place' | 'futures.order_cancel' | 'futures.order_cancel_cp' | 'futures.order_amend' | 'futures.order_list' | 'futures.order_status' | 'futures.order_cancel_ids';
|
|
6
4
|
export type WSAPITopic = SpotWSAPITopic | FuturesWSAPITopic;
|
|
5
|
+
export type WSAPIWsKey = keyof WsAPIWsKeyTopicMap;
|
|
7
6
|
export interface WsAPIWsKeyTopicMap {
|
|
8
7
|
spotV4: SpotWSAPITopic;
|
|
9
8
|
perpFuturesUSDTV4: FuturesWSAPITopic;
|
|
@@ -14,26 +13,21 @@ export interface WsAPIWsKeyTopicMap {
|
|
|
14
13
|
export interface WsAPITopicRequestParamMap {
|
|
15
14
|
'spot.login': undefined;
|
|
16
15
|
'futures.login': undefined;
|
|
17
|
-
'spot.order_place':
|
|
18
|
-
'spot.order_cancel':
|
|
19
|
-
'spot.order_cancel_ids':
|
|
20
|
-
'spot.order_cancel_cp':
|
|
21
|
-
'spot.order_amend':
|
|
22
|
-
'spot.order_status':
|
|
23
|
-
'
|
|
24
|
-
'futures.
|
|
25
|
-
'futures.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
'futures.order_cancel_cp':
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
'futures.order_amend': Omit<UpdateFuturesOrderReq, 'settle'>;
|
|
33
|
-
'futures.order_list': Omit<GetFuturesOrdersReq, 'settle'>;
|
|
34
|
-
'futures.order_status': {
|
|
35
|
-
order_id: string;
|
|
36
|
-
};
|
|
16
|
+
'spot.order_place': WSAPISpotOrderPlaceReq;
|
|
17
|
+
'spot.order_cancel': WSAPISpotOrderCancelReq;
|
|
18
|
+
'spot.order_cancel_ids': WSAPISpotOrderCancelIdsReq[];
|
|
19
|
+
'spot.order_cancel_cp': WSAPISpotOrderCancelCPReq;
|
|
20
|
+
'spot.order_amend': WSAPISpotOrderAmendReq;
|
|
21
|
+
'spot.order_status': WSAPISpotOrderStatusReq;
|
|
22
|
+
'spot.order_list': WSAPISpotOrderListReq;
|
|
23
|
+
'futures.order_place': WSAPIFuturesOrderPlaceReq;
|
|
24
|
+
'futures.order_batch_place': WSAPIFuturesOrderPlaceReq[];
|
|
25
|
+
'futures.order_cancel': WSAPIFuturesOrderCancelReq;
|
|
26
|
+
'futures.order_cancel_ids': string[];
|
|
27
|
+
'futures.order_cancel_cp': WSAPIFuturesOrderCancelCPReq;
|
|
28
|
+
'futures.order_amend': WSAPIFuturesOrderAmendReq;
|
|
29
|
+
'futures.order_list': WSAPIFuturesOrderListReq;
|
|
30
|
+
'futures.order_status': WSAPIFuturesOrderStatusReq;
|
|
37
31
|
}
|
|
38
32
|
export type WsAPITopicRequestParams = WsAPITopicRequestParamMap[keyof WsAPITopicRequestParamMap];
|
|
39
33
|
export interface WSAPIResponseHeader<TChannel extends WSAPITopic> {
|
|
@@ -73,22 +67,24 @@ export interface WSAPIOrderStatusResponse {
|
|
|
73
67
|
create_time_ms: number;
|
|
74
68
|
}
|
|
75
69
|
export type WSAPIResponseData = WSAPILoginResponse | WSAPIOrderStatusResponse;
|
|
76
|
-
export interface WsAPITopicResponseMap
|
|
70
|
+
export interface WsAPITopicResponseMap {
|
|
77
71
|
'spot.login': WSAPIResponse<WSAPILoginResponse, 'spot.login'>;
|
|
78
72
|
'futures.login': WSAPIResponse<WSAPILoginResponse, 'futures.login'>;
|
|
79
|
-
'spot.order_place': WSAPIResponse<
|
|
80
|
-
'spot.order_cancel': WSAPIResponse<
|
|
81
|
-
'spot.order_cancel_ids': WSAPIResponse<
|
|
82
|
-
'spot.order_cancel_cp': WSAPIResponse<
|
|
83
|
-
'spot.order_amend': WSAPIResponse<
|
|
84
|
-
'spot.order_status': WSAPIResponse<
|
|
85
|
-
'
|
|
86
|
-
'futures.
|
|
87
|
-
'futures.
|
|
88
|
-
'futures.
|
|
89
|
-
'futures.
|
|
90
|
-
'futures.
|
|
91
|
-
'futures.
|
|
73
|
+
'spot.order_place': WSAPIResponse<WSAPISpotOrder, 'spot.order_place'>;
|
|
74
|
+
'spot.order_cancel': WSAPIResponse<WSAPISpotOrder, 'spot.order_cancel'>;
|
|
75
|
+
'spot.order_cancel_ids': WSAPIResponse<WSAPISpotOrderCancelIdsRespItem[], 'spot.order_cancel_ids'>;
|
|
76
|
+
'spot.order_cancel_cp': WSAPIResponse<WSAPISpotOrder[], 'spot.order_cancel_cp'>;
|
|
77
|
+
'spot.order_amend': WSAPIResponse<WSAPISpotOrder, 'spot.order_amend'>;
|
|
78
|
+
'spot.order_status': WSAPIResponse<WSAPISpotOrder, 'spot.order_status'>;
|
|
79
|
+
'spot.order_list': WSAPIResponse<WSAPISpotOrder[], 'spot.order_list'>;
|
|
80
|
+
'futures.order_place': WSAPIResponse<WSAPIFuturesOrder, 'futures.order_place'>;
|
|
81
|
+
'futures.order_batch_place': WSAPIResponse<WSAPIFuturesOrderBatchPlaceRespItem[], 'futures.order_batch_place'>;
|
|
82
|
+
'futures.order_cancel': WSAPIResponse<WSAPIFuturesOrder, 'futures.order_cancel'>;
|
|
83
|
+
'futures.order_cancel_ids': WSAPIResponse<WSAPIFuturesOrderCancelIdsRespItem[], 'futures.order_cancel_ids'>;
|
|
84
|
+
'futures.order_cancel_cp': WSAPIResponse<WSAPIFuturesOrder[], 'futures.order_cancel_cp'>;
|
|
85
|
+
'futures.order_amend': WSAPIResponse<WSAPIFuturesOrder, 'futures.order_amend'>;
|
|
86
|
+
'futures.order_list': WSAPIResponse<WSAPIFuturesOrder[], 'futures.order_list'>;
|
|
87
|
+
'futures.order_status': WSAPIResponse<WSAPIFuturesOrder, 'futures.order_status'>;
|
|
92
88
|
}
|
|
93
89
|
export interface WSAPIResponse<TResponseData extends object = WSAPIResponseData | object, TChannel extends WSAPITopic = WSAPITopic> {
|
|
94
90
|
wsKey: WsKey;
|
|
@@ -99,3 +95,162 @@ export interface WSAPIResponse<TResponseData extends object = WSAPIResponseData
|
|
|
99
95
|
/** Auto-generated */
|
|
100
96
|
request_id: string;
|
|
101
97
|
}
|
|
98
|
+
export interface WSAPISpotOrderPlaceReq {
|
|
99
|
+
text?: string;
|
|
100
|
+
currency_pair: string;
|
|
101
|
+
type?: 'limit' | 'market';
|
|
102
|
+
account?: 'spot' | 'margin' | 'unified' | 'cross_margin';
|
|
103
|
+
side: 'buy' | 'sell';
|
|
104
|
+
amount: string;
|
|
105
|
+
price?: string;
|
|
106
|
+
time_in_force?: 'gtc' | 'ioc' | 'poc' | 'fok';
|
|
107
|
+
iceberg?: string;
|
|
108
|
+
auto_borrow?: boolean;
|
|
109
|
+
auto_repay?: boolean;
|
|
110
|
+
stp_act?: 'cn' | 'co' | 'cb';
|
|
111
|
+
action_mode?: 'ACK' | 'RESULT' | 'FULL';
|
|
112
|
+
}
|
|
113
|
+
export interface WSAPISpotOrderCancelReq {
|
|
114
|
+
order_id: string;
|
|
115
|
+
currency_pair: string;
|
|
116
|
+
account?: string;
|
|
117
|
+
}
|
|
118
|
+
export interface WSAPISpotOrderCancelIdsReq {
|
|
119
|
+
currency_pair: string;
|
|
120
|
+
id: string;
|
|
121
|
+
account?: string;
|
|
122
|
+
}
|
|
123
|
+
export interface WSAPISpotOrderCancelCPReq {
|
|
124
|
+
currency_pair: string;
|
|
125
|
+
side?: 'buy' | 'sell';
|
|
126
|
+
account?: string;
|
|
127
|
+
}
|
|
128
|
+
export interface WSAPISpotOrderAmendReq {
|
|
129
|
+
amount?: string;
|
|
130
|
+
price?: string;
|
|
131
|
+
amend_text?: string;
|
|
132
|
+
order_id: string;
|
|
133
|
+
currency_pair: string;
|
|
134
|
+
account?: string;
|
|
135
|
+
}
|
|
136
|
+
export interface WSAPISpotOrderStatusReq {
|
|
137
|
+
order_id: string;
|
|
138
|
+
currency_pair: string;
|
|
139
|
+
account?: string;
|
|
140
|
+
}
|
|
141
|
+
export interface WSAPISpotOrderListReq {
|
|
142
|
+
currency_pair: string;
|
|
143
|
+
status: 'open' | 'finished';
|
|
144
|
+
page?: number;
|
|
145
|
+
limit?: number;
|
|
146
|
+
account?: string;
|
|
147
|
+
from?: number;
|
|
148
|
+
to?: number;
|
|
149
|
+
side?: 'buy' | 'sell';
|
|
150
|
+
}
|
|
151
|
+
export interface WSAPIFuturesOrderPlaceReq {
|
|
152
|
+
contract: string;
|
|
153
|
+
size: number;
|
|
154
|
+
iceberg?: number;
|
|
155
|
+
price?: string;
|
|
156
|
+
close?: boolean;
|
|
157
|
+
reduce_only?: boolean;
|
|
158
|
+
tif?: 'gtc' | 'ioc' | 'poc' | 'fok';
|
|
159
|
+
text?: string;
|
|
160
|
+
auto_size?: 'close_long' | 'close_short';
|
|
161
|
+
stp_act?: 'cn' | 'co' | 'cb';
|
|
162
|
+
}
|
|
163
|
+
export interface WSAPIFuturesOrderCancelReq {
|
|
164
|
+
order_id: string;
|
|
165
|
+
}
|
|
166
|
+
export interface WSAPIFuturesOrderCancelCPReq {
|
|
167
|
+
contract: string;
|
|
168
|
+
side?: 'bid' | 'ask';
|
|
169
|
+
}
|
|
170
|
+
export interface WSAPIFuturesOrderAmendReq {
|
|
171
|
+
order_id: string;
|
|
172
|
+
price?: string;
|
|
173
|
+
size?: number;
|
|
174
|
+
amend_text?: string;
|
|
175
|
+
}
|
|
176
|
+
export interface WSAPIFuturesOrderListReq {
|
|
177
|
+
contract: string;
|
|
178
|
+
status: 'open' | 'finished';
|
|
179
|
+
limit?: number;
|
|
180
|
+
offset?: number;
|
|
181
|
+
last_id?: string;
|
|
182
|
+
count_total?: number;
|
|
183
|
+
}
|
|
184
|
+
export interface WSAPIFuturesOrderStatusReq {
|
|
185
|
+
order_id: string;
|
|
186
|
+
}
|
|
187
|
+
export interface WSAPISpotOrder {
|
|
188
|
+
id: string;
|
|
189
|
+
text: string;
|
|
190
|
+
amend_text: string;
|
|
191
|
+
create_time: string;
|
|
192
|
+
update_time: string;
|
|
193
|
+
create_time_ms: number;
|
|
194
|
+
update_time_ms: number;
|
|
195
|
+
status: string;
|
|
196
|
+
currency_pair: string;
|
|
197
|
+
type: string;
|
|
198
|
+
account: string;
|
|
199
|
+
side: string;
|
|
200
|
+
amount: string;
|
|
201
|
+
price: string;
|
|
202
|
+
time_in_force: string;
|
|
203
|
+
iceberg: string;
|
|
204
|
+
left: string;
|
|
205
|
+
fill_price?: string;
|
|
206
|
+
filled_amount?: string;
|
|
207
|
+
filled_total: string;
|
|
208
|
+
avg_deal_price?: string;
|
|
209
|
+
fee: string;
|
|
210
|
+
fee_currency: string;
|
|
211
|
+
point_fee: string;
|
|
212
|
+
gt_fee: string;
|
|
213
|
+
gt_maker_fee?: string;
|
|
214
|
+
gt_taker_fee?: string;
|
|
215
|
+
gt_discount?: boolean;
|
|
216
|
+
rebated_fee: string;
|
|
217
|
+
rebated_fee_currency: string;
|
|
218
|
+
stp_id?: number;
|
|
219
|
+
stp_act?: string;
|
|
220
|
+
finish_as: string;
|
|
221
|
+
}
|
|
222
|
+
export interface WSAPISpotOrderCancelIdsRespItem {
|
|
223
|
+
currency_pair: string;
|
|
224
|
+
id: string;
|
|
225
|
+
succeeded: boolean;
|
|
226
|
+
}
|
|
227
|
+
export interface WSAPIFuturesOrder {
|
|
228
|
+
id: number;
|
|
229
|
+
user: number;
|
|
230
|
+
create_time: number;
|
|
231
|
+
finish_time?: number;
|
|
232
|
+
update_time?: number;
|
|
233
|
+
finish_as?: string;
|
|
234
|
+
status: string;
|
|
235
|
+
contract: string;
|
|
236
|
+
size: number;
|
|
237
|
+
price: string;
|
|
238
|
+
tif: string;
|
|
239
|
+
left?: number;
|
|
240
|
+
fill_price: string;
|
|
241
|
+
text: string;
|
|
242
|
+
tkfr: string;
|
|
243
|
+
mkfr: string;
|
|
244
|
+
stp_id?: number;
|
|
245
|
+
stp_act?: string;
|
|
246
|
+
amend_text?: string;
|
|
247
|
+
}
|
|
248
|
+
export interface WSAPIFuturesOrderBatchPlaceRespItem extends WSAPIFuturesOrder {
|
|
249
|
+
succeeded: boolean;
|
|
250
|
+
}
|
|
251
|
+
export interface WSAPIFuturesOrderCancelIdsRespItem {
|
|
252
|
+
id: string;
|
|
253
|
+
user_id: number;
|
|
254
|
+
succeeded?: boolean;
|
|
255
|
+
message?: string;
|
|
256
|
+
}
|
|
@@ -1,7 +1,2 @@
|
|
|
1
1
|
export {};
|
|
2
|
-
// export interface WsAPIResponseMap<TChannel extends WSAPITopic = WSAPITopic> {
|
|
3
|
-
// 'spot.login': WSAPIResponse<WSAPILoginResponse, TChannel>;
|
|
4
|
-
// 'futures.login': WSAPIResponse<WSAPILoginResponse, TChannel>;
|
|
5
|
-
// string: object;
|
|
6
|
-
// }
|
|
7
2
|
//# sourceMappingURL=wsAPI.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wsAPI.js","sourceRoot":"","sources":["../../../../src/types/websockets/wsAPI.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wsAPI.js","sourceRoot":"","sources":["../../../../src/types/websockets/wsAPI.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gateio-api",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Complete &
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "Complete & Robust Node.js SDK for Gate.com's REST APIs, WebSockets & WebSocket APIs, with TypeScript declarations.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"clean": "rm -rf dist/*",
|
|
7
7
|
"build": "rm -fr dist/* && tsc -p tsconfig.esm.json && tsc -p tsconfig.cjs.json && bash ./postBuild.sh",
|
|
@@ -49,12 +49,16 @@
|
|
|
49
49
|
"keywords": [
|
|
50
50
|
"Gate",
|
|
51
51
|
"Gate.io",
|
|
52
|
+
"Gate.com",
|
|
52
53
|
"Gate api",
|
|
53
54
|
"Gate.io api",
|
|
55
|
+
"Gate.com api",
|
|
54
56
|
"Gate nodejs",
|
|
55
57
|
"Gate javascript",
|
|
58
|
+
"Gate javascript websocket api",
|
|
56
59
|
"Gate typescript",
|
|
57
60
|
"Gate js",
|
|
61
|
+
"Gate ts",
|
|
58
62
|
"Gate api node",
|
|
59
63
|
"Gate sdk javascript",
|
|
60
64
|
"algo trading",
|