@binance/convert 4.0.1 → 4.0.2
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/dist/chunk.mjs +13 -0
- package/dist/index.d.mts +997 -1116
- package/dist/index.d.ts +999 -1116
- package/dist/index.js +646 -849
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +569 -845
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,879 +1,676 @@
|
|
|
1
|
-
|
|
1
|
+
//#region rolldown:runtime
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
var __export = (all) => {
|
|
4
|
+
let target = {};
|
|
5
|
+
for (var name$1 in all) __defProp(target, name$1, {
|
|
6
|
+
get: all[name$1],
|
|
7
|
+
enumerable: true
|
|
8
|
+
});
|
|
9
|
+
return target;
|
|
9
10
|
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var index_exports = {};
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
BadRequestError: () => import_common5.BadRequestError,
|
|
24
|
-
CONVERT_REST_API_PROD_URL: () => import_common5.CONVERT_REST_API_PROD_URL,
|
|
25
|
-
ConnectorClientError: () => import_common5.ConnectorClientError,
|
|
26
|
-
Convert: () => Convert,
|
|
27
|
-
ConvertRestAPI: () => rest_api_exports,
|
|
28
|
-
ForbiddenError: () => import_common5.ForbiddenError,
|
|
29
|
-
NetworkError: () => import_common5.NetworkError,
|
|
30
|
-
NotFoundError: () => import_common5.NotFoundError,
|
|
31
|
-
RateLimitBanError: () => import_common5.RateLimitBanError,
|
|
32
|
-
RequiredError: () => import_common5.RequiredError,
|
|
33
|
-
ServerError: () => import_common5.ServerError,
|
|
34
|
-
TooManyRequestsError: () => import_common5.TooManyRequestsError,
|
|
35
|
-
UnauthorizedError: () => import_common5.UnauthorizedError
|
|
36
|
-
});
|
|
37
|
-
module.exports = __toCommonJS(index_exports);
|
|
38
11
|
|
|
39
|
-
|
|
40
|
-
|
|
12
|
+
//#endregion
|
|
13
|
+
let __binance_common = require("@binance/common");
|
|
41
14
|
|
|
42
|
-
|
|
15
|
+
//#region package.json
|
|
43
16
|
var name = "@binance/convert";
|
|
44
|
-
var version = "4.0.
|
|
45
|
-
|
|
46
|
-
// src/rest-api/index.ts
|
|
47
|
-
var rest_api_exports = {};
|
|
48
|
-
__export(rest_api_exports, {
|
|
49
|
-
MarketDataApi: () => MarketDataApi,
|
|
50
|
-
RestAPI: () => RestAPI,
|
|
51
|
-
TradeApi: () => TradeApi
|
|
52
|
-
});
|
|
17
|
+
var version = "4.0.2";
|
|
53
18
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
queryOrderQuantityPrecisionPerAsset: async (recvWindow) => {
|
|
100
|
-
const localVarQueryParameter = {};
|
|
101
|
-
if (recvWindow !== void 0 && recvWindow !== null) {
|
|
102
|
-
localVarQueryParameter["recvWindow"] = recvWindow;
|
|
103
|
-
}
|
|
104
|
-
let _timeUnit;
|
|
105
|
-
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
|
|
106
|
-
return {
|
|
107
|
-
endpoint: "/sapi/v1/convert/assetInfo",
|
|
108
|
-
method: "GET",
|
|
109
|
-
params: localVarQueryParameter,
|
|
110
|
-
timeUnit: _timeUnit
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
};
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/rest-api/modules/market-data-api.ts
|
|
21
|
+
/**
|
|
22
|
+
* Binance Convert REST API
|
|
23
|
+
*
|
|
24
|
+
* OpenAPI Specification for the Binance Convert REST API
|
|
25
|
+
*
|
|
26
|
+
* The version of the OpenAPI document: 1.0.0
|
|
27
|
+
*
|
|
28
|
+
*
|
|
29
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
30
|
+
* https://openapi-generator.tech
|
|
31
|
+
* Do not edit the class manually.
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* MarketDataApi - axios parameter creator
|
|
35
|
+
*/
|
|
36
|
+
const MarketDataApiAxiosParamCreator = function(configuration) {
|
|
37
|
+
return {
|
|
38
|
+
listAllConvertPairs: async (fromAsset, toAsset) => {
|
|
39
|
+
const localVarQueryParameter = {};
|
|
40
|
+
if (fromAsset !== void 0 && fromAsset !== null) localVarQueryParameter["fromAsset"] = fromAsset;
|
|
41
|
+
if (toAsset !== void 0 && toAsset !== null) localVarQueryParameter["toAsset"] = toAsset;
|
|
42
|
+
let _timeUnit;
|
|
43
|
+
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
|
|
44
|
+
return {
|
|
45
|
+
endpoint: "/sapi/v1/convert/exchangeInfo",
|
|
46
|
+
method: "GET",
|
|
47
|
+
params: localVarQueryParameter,
|
|
48
|
+
timeUnit: _timeUnit
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
queryOrderQuantityPrecisionPerAsset: async (recvWindow) => {
|
|
52
|
+
const localVarQueryParameter = {};
|
|
53
|
+
if (recvWindow !== void 0 && recvWindow !== null) localVarQueryParameter["recvWindow"] = recvWindow;
|
|
54
|
+
let _timeUnit;
|
|
55
|
+
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
|
|
56
|
+
return {
|
|
57
|
+
endpoint: "/sapi/v1/convert/assetInfo",
|
|
58
|
+
method: "GET",
|
|
59
|
+
params: localVarQueryParameter,
|
|
60
|
+
timeUnit: _timeUnit
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
};
|
|
114
64
|
};
|
|
65
|
+
/**
|
|
66
|
+
* MarketDataApi - object-oriented interface
|
|
67
|
+
* @class MarketDataApi
|
|
68
|
+
*/
|
|
115
69
|
var MarketDataApi = class {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
* @param {QueryOrderQuantityPrecisionPerAssetRequest} requestParameters Request parameters.
|
|
156
|
-
* @returns {Promise<RestApiResponse<QueryOrderQuantityPrecisionPerAssetResponse>>}
|
|
157
|
-
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
158
|
-
* @memberof MarketDataApi
|
|
159
|
-
* @see {@link https://developers.binance.com/docs/convert/market-data/Query-order-quantity-precision-per-asset Binance API Documentation}
|
|
160
|
-
*/
|
|
161
|
-
async queryOrderQuantityPrecisionPerAsset(requestParameters = {}) {
|
|
162
|
-
const localVarAxiosArgs = await this.localVarAxiosParamCreator.queryOrderQuantityPrecisionPerAsset(
|
|
163
|
-
requestParameters?.recvWindow
|
|
164
|
-
);
|
|
165
|
-
return (0, import_common.sendRequest)(
|
|
166
|
-
this.configuration,
|
|
167
|
-
localVarAxiosArgs.endpoint,
|
|
168
|
-
localVarAxiosArgs.method,
|
|
169
|
-
localVarAxiosArgs.params,
|
|
170
|
-
localVarAxiosArgs?.timeUnit,
|
|
171
|
-
{ isSigned: true }
|
|
172
|
-
);
|
|
173
|
-
}
|
|
70
|
+
constructor(configuration) {
|
|
71
|
+
this.configuration = configuration;
|
|
72
|
+
this.localVarAxiosParamCreator = MarketDataApiAxiosParamCreator(configuration);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Query for all convertible token pairs and the tokens’ respective upper/lower limits
|
|
76
|
+
*
|
|
77
|
+
* User needs to supply either or both of the input parameter
|
|
78
|
+
* If not defined for both fromAsset and toAsset, only partial token pairs will be returned
|
|
79
|
+
*
|
|
80
|
+
* Weight: 3000(IP)
|
|
81
|
+
*
|
|
82
|
+
* @summary List All Convert Pairs
|
|
83
|
+
* @param {ListAllConvertPairsRequest} requestParameters Request parameters.
|
|
84
|
+
* @returns {Promise<RestApiResponse<ListAllConvertPairsResponse>>}
|
|
85
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
86
|
+
* @memberof MarketDataApi
|
|
87
|
+
* @see {@link https://developers.binance.com/docs/convert/market-data/ Binance API Documentation}
|
|
88
|
+
*/
|
|
89
|
+
async listAllConvertPairs(requestParameters = {}) {
|
|
90
|
+
const localVarAxiosArgs = await this.localVarAxiosParamCreator.listAllConvertPairs(requestParameters?.fromAsset, requestParameters?.toAsset);
|
|
91
|
+
return (0, __binance_common.sendRequest)(this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: false });
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Query for supported asset’s precision information
|
|
95
|
+
*
|
|
96
|
+
* Weight: 100(IP)
|
|
97
|
+
*
|
|
98
|
+
* @summary Query order quantity precision per asset(USER_DATA)
|
|
99
|
+
* @param {QueryOrderQuantityPrecisionPerAssetRequest} requestParameters Request parameters.
|
|
100
|
+
* @returns {Promise<RestApiResponse<QueryOrderQuantityPrecisionPerAssetResponse>>}
|
|
101
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
102
|
+
* @memberof MarketDataApi
|
|
103
|
+
* @see {@link https://developers.binance.com/docs/convert/market-data/Query-order-quantity-precision-per-asset Binance API Documentation}
|
|
104
|
+
*/
|
|
105
|
+
async queryOrderQuantityPrecisionPerAsset(requestParameters = {}) {
|
|
106
|
+
const localVarAxiosArgs = await this.localVarAxiosParamCreator.queryOrderQuantityPrecisionPerAsset(requestParameters?.recvWindow);
|
|
107
|
+
return (0, __binance_common.sendRequest)(this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true });
|
|
108
|
+
}
|
|
174
109
|
};
|
|
175
110
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
* Either `baseAmount` or `quoteAmount` is used.
|
|
312
|
-
*
|
|
313
|
-
* Weight: 500(UID)
|
|
314
|
-
*
|
|
315
|
-
* @summary Place limit order (USER_DATA)
|
|
316
|
-
* @param {string} baseAsset base asset (use the response `fromIsBase` from `GET /sapi/v1/convert/exchangeInfo` api to check which one is baseAsset )
|
|
317
|
-
* @param {string} quoteAsset quote asset
|
|
318
|
-
* @param {number} limitPrice Symbol limit price (from baseAsset to quoteAsset)
|
|
319
|
-
* @param {string} side `BUY` or `SELL`
|
|
320
|
-
* @param {string} expiredType 1_D, 3_D, 7_D, 30_D (D means day)
|
|
321
|
-
* @param {number} [baseAmount] Base asset amount. (One of `baseAmount` or `quoteAmount` is required)
|
|
322
|
-
* @param {number} [quoteAmount] Quote asset amount. (One of `baseAmount` or `quoteAmount` is required)
|
|
323
|
-
* @param {string} [walletType] It is to choose which wallet of assets. The wallet selection is `SPOT`, `FUNDING` and `EARN`. Combination of wallet is supported i.e. `SPOT_FUNDING`, `FUNDING_EARN`, `SPOT_FUNDING_EARN` or `SPOT_EARN` Default is `SPOT`.
|
|
324
|
-
* @param {number | bigint} [recvWindow] The value cannot be greater than 60000
|
|
325
|
-
*
|
|
326
|
-
* @throws {RequiredError}
|
|
327
|
-
*/
|
|
328
|
-
placeLimitOrder: async (baseAsset, quoteAsset, limitPrice, side, expiredType, baseAmount, quoteAmount, walletType, recvWindow) => {
|
|
329
|
-
(0, import_common2.assertParamExists)("placeLimitOrder", "baseAsset", baseAsset);
|
|
330
|
-
(0, import_common2.assertParamExists)("placeLimitOrder", "quoteAsset", quoteAsset);
|
|
331
|
-
(0, import_common2.assertParamExists)("placeLimitOrder", "limitPrice", limitPrice);
|
|
332
|
-
(0, import_common2.assertParamExists)("placeLimitOrder", "side", side);
|
|
333
|
-
(0, import_common2.assertParamExists)("placeLimitOrder", "expiredType", expiredType);
|
|
334
|
-
const localVarQueryParameter = {};
|
|
335
|
-
if (baseAsset !== void 0 && baseAsset !== null) {
|
|
336
|
-
localVarQueryParameter["baseAsset"] = baseAsset;
|
|
337
|
-
}
|
|
338
|
-
if (quoteAsset !== void 0 && quoteAsset !== null) {
|
|
339
|
-
localVarQueryParameter["quoteAsset"] = quoteAsset;
|
|
340
|
-
}
|
|
341
|
-
if (limitPrice !== void 0 && limitPrice !== null) {
|
|
342
|
-
localVarQueryParameter["limitPrice"] = limitPrice;
|
|
343
|
-
}
|
|
344
|
-
if (baseAmount !== void 0 && baseAmount !== null) {
|
|
345
|
-
localVarQueryParameter["baseAmount"] = baseAmount;
|
|
346
|
-
}
|
|
347
|
-
if (quoteAmount !== void 0 && quoteAmount !== null) {
|
|
348
|
-
localVarQueryParameter["quoteAmount"] = quoteAmount;
|
|
349
|
-
}
|
|
350
|
-
if (side !== void 0 && side !== null) {
|
|
351
|
-
localVarQueryParameter["side"] = side;
|
|
352
|
-
}
|
|
353
|
-
if (walletType !== void 0 && walletType !== null) {
|
|
354
|
-
localVarQueryParameter["walletType"] = walletType;
|
|
355
|
-
}
|
|
356
|
-
if (expiredType !== void 0 && expiredType !== null) {
|
|
357
|
-
localVarQueryParameter["expiredType"] = expiredType;
|
|
358
|
-
}
|
|
359
|
-
if (recvWindow !== void 0 && recvWindow !== null) {
|
|
360
|
-
localVarQueryParameter["recvWindow"] = recvWindow;
|
|
361
|
-
}
|
|
362
|
-
let _timeUnit;
|
|
363
|
-
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
|
|
364
|
-
return {
|
|
365
|
-
endpoint: "/sapi/v1/convert/limit/placeOrder",
|
|
366
|
-
method: "POST",
|
|
367
|
-
params: localVarQueryParameter,
|
|
368
|
-
timeUnit: _timeUnit
|
|
369
|
-
};
|
|
370
|
-
},
|
|
371
|
-
/**
|
|
372
|
-
* Request a quote for the requested token pairs
|
|
373
|
-
*
|
|
374
|
-
* Weight: 3000(UID)
|
|
375
|
-
*
|
|
376
|
-
* @summary Query limit open orders (USER_DATA)
|
|
377
|
-
* @param {number | bigint} [recvWindow] The value cannot be greater than 60000
|
|
378
|
-
*
|
|
379
|
-
* @throws {RequiredError}
|
|
380
|
-
*/
|
|
381
|
-
queryLimitOpenOrders: async (recvWindow) => {
|
|
382
|
-
const localVarQueryParameter = {};
|
|
383
|
-
if (recvWindow !== void 0 && recvWindow !== null) {
|
|
384
|
-
localVarQueryParameter["recvWindow"] = recvWindow;
|
|
385
|
-
}
|
|
386
|
-
let _timeUnit;
|
|
387
|
-
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
|
|
388
|
-
return {
|
|
389
|
-
endpoint: "/sapi/v1/convert/limit/queryOpenOrders",
|
|
390
|
-
method: "GET",
|
|
391
|
-
params: localVarQueryParameter,
|
|
392
|
-
timeUnit: _timeUnit
|
|
393
|
-
};
|
|
394
|
-
},
|
|
395
|
-
/**
|
|
396
|
-
* Request a quote for the requested token pairs
|
|
397
|
-
*
|
|
398
|
-
* Either fromAmount or toAmount should be sent
|
|
399
|
-
* `quoteId` will be returned only if you have enough funds to convert
|
|
400
|
-
*
|
|
401
|
-
* Weight: 200(UID)
|
|
402
|
-
*
|
|
403
|
-
* @summary Send Quote Request(USER_DATA)
|
|
404
|
-
* @param {string} fromAsset
|
|
405
|
-
* @param {string} toAsset
|
|
406
|
-
* @param {number} [fromAmount] When specified, it is the amount you will be debited after the conversion
|
|
407
|
-
* @param {number} [toAmount] When specified, it is the amount you will be credited after the conversion
|
|
408
|
-
* @param {string} [walletType] It is to choose which wallet of assets. The wallet selection is `SPOT`, `FUNDING` and `EARN`. Combination of wallet is supported i.e. `SPOT_FUNDING`, `FUNDING_EARN`, `SPOT_FUNDING_EARN` or `SPOT_EARN` Default is `SPOT`.
|
|
409
|
-
* @param {string} [validTime] 10s, 30s, 1m, default 10s
|
|
410
|
-
* @param {number | bigint} [recvWindow] The value cannot be greater than 60000
|
|
411
|
-
*
|
|
412
|
-
* @throws {RequiredError}
|
|
413
|
-
*/
|
|
414
|
-
sendQuoteRequest: async (fromAsset, toAsset, fromAmount, toAmount, walletType, validTime, recvWindow) => {
|
|
415
|
-
(0, import_common2.assertParamExists)("sendQuoteRequest", "fromAsset", fromAsset);
|
|
416
|
-
(0, import_common2.assertParamExists)("sendQuoteRequest", "toAsset", toAsset);
|
|
417
|
-
const localVarQueryParameter = {};
|
|
418
|
-
if (fromAsset !== void 0 && fromAsset !== null) {
|
|
419
|
-
localVarQueryParameter["fromAsset"] = fromAsset;
|
|
420
|
-
}
|
|
421
|
-
if (toAsset !== void 0 && toAsset !== null) {
|
|
422
|
-
localVarQueryParameter["toAsset"] = toAsset;
|
|
423
|
-
}
|
|
424
|
-
if (fromAmount !== void 0 && fromAmount !== null) {
|
|
425
|
-
localVarQueryParameter["fromAmount"] = fromAmount;
|
|
426
|
-
}
|
|
427
|
-
if (toAmount !== void 0 && toAmount !== null) {
|
|
428
|
-
localVarQueryParameter["toAmount"] = toAmount;
|
|
429
|
-
}
|
|
430
|
-
if (walletType !== void 0 && walletType !== null) {
|
|
431
|
-
localVarQueryParameter["walletType"] = walletType;
|
|
432
|
-
}
|
|
433
|
-
if (validTime !== void 0 && validTime !== null) {
|
|
434
|
-
localVarQueryParameter["validTime"] = validTime;
|
|
435
|
-
}
|
|
436
|
-
if (recvWindow !== void 0 && recvWindow !== null) {
|
|
437
|
-
localVarQueryParameter["recvWindow"] = recvWindow;
|
|
438
|
-
}
|
|
439
|
-
let _timeUnit;
|
|
440
|
-
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
|
|
441
|
-
return {
|
|
442
|
-
endpoint: "/sapi/v1/convert/getQuote",
|
|
443
|
-
method: "POST",
|
|
444
|
-
params: localVarQueryParameter,
|
|
445
|
-
timeUnit: _timeUnit
|
|
446
|
-
};
|
|
447
|
-
}
|
|
448
|
-
};
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region src/rest-api/modules/trade-api.ts
|
|
113
|
+
/**
|
|
114
|
+
* Binance Convert REST API
|
|
115
|
+
*
|
|
116
|
+
* OpenAPI Specification for the Binance Convert REST API
|
|
117
|
+
*
|
|
118
|
+
* The version of the OpenAPI document: 1.0.0
|
|
119
|
+
*
|
|
120
|
+
*
|
|
121
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
122
|
+
* https://openapi-generator.tech
|
|
123
|
+
* Do not edit the class manually.
|
|
124
|
+
*/
|
|
125
|
+
/**
|
|
126
|
+
* TradeApi - axios parameter creator
|
|
127
|
+
*/
|
|
128
|
+
const TradeApiAxiosParamCreator = function(configuration) {
|
|
129
|
+
return {
|
|
130
|
+
acceptQuote: async (quoteId, recvWindow) => {
|
|
131
|
+
(0, __binance_common.assertParamExists)("acceptQuote", "quoteId", quoteId);
|
|
132
|
+
const localVarQueryParameter = {};
|
|
133
|
+
if (quoteId !== void 0 && quoteId !== null) localVarQueryParameter["quoteId"] = quoteId;
|
|
134
|
+
if (recvWindow !== void 0 && recvWindow !== null) localVarQueryParameter["recvWindow"] = recvWindow;
|
|
135
|
+
let _timeUnit;
|
|
136
|
+
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
|
|
137
|
+
return {
|
|
138
|
+
endpoint: "/sapi/v1/convert/acceptQuote",
|
|
139
|
+
method: "POST",
|
|
140
|
+
params: localVarQueryParameter,
|
|
141
|
+
timeUnit: _timeUnit
|
|
142
|
+
};
|
|
143
|
+
},
|
|
144
|
+
cancelLimitOrder: async (orderId, recvWindow) => {
|
|
145
|
+
(0, __binance_common.assertParamExists)("cancelLimitOrder", "orderId", orderId);
|
|
146
|
+
const localVarQueryParameter = {};
|
|
147
|
+
if (orderId !== void 0 && orderId !== null) localVarQueryParameter["orderId"] = orderId;
|
|
148
|
+
if (recvWindow !== void 0 && recvWindow !== null) localVarQueryParameter["recvWindow"] = recvWindow;
|
|
149
|
+
let _timeUnit;
|
|
150
|
+
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
|
|
151
|
+
return {
|
|
152
|
+
endpoint: "/sapi/v1/convert/limit/cancelOrder",
|
|
153
|
+
method: "POST",
|
|
154
|
+
params: localVarQueryParameter,
|
|
155
|
+
timeUnit: _timeUnit
|
|
156
|
+
};
|
|
157
|
+
},
|
|
158
|
+
getConvertTradeHistory: async (startTime, endTime, limit, recvWindow) => {
|
|
159
|
+
(0, __binance_common.assertParamExists)("getConvertTradeHistory", "startTime", startTime);
|
|
160
|
+
(0, __binance_common.assertParamExists)("getConvertTradeHistory", "endTime", endTime);
|
|
161
|
+
const localVarQueryParameter = {};
|
|
162
|
+
if (startTime !== void 0 && startTime !== null) localVarQueryParameter["startTime"] = startTime;
|
|
163
|
+
if (endTime !== void 0 && endTime !== null) localVarQueryParameter["endTime"] = endTime;
|
|
164
|
+
if (limit !== void 0 && limit !== null) localVarQueryParameter["limit"] = limit;
|
|
165
|
+
if (recvWindow !== void 0 && recvWindow !== null) localVarQueryParameter["recvWindow"] = recvWindow;
|
|
166
|
+
let _timeUnit;
|
|
167
|
+
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
|
|
168
|
+
return {
|
|
169
|
+
endpoint: "/sapi/v1/convert/tradeFlow",
|
|
170
|
+
method: "GET",
|
|
171
|
+
params: localVarQueryParameter,
|
|
172
|
+
timeUnit: _timeUnit
|
|
173
|
+
};
|
|
174
|
+
},
|
|
175
|
+
orderStatus: async (orderId, quoteId) => {
|
|
176
|
+
const localVarQueryParameter = {};
|
|
177
|
+
if (orderId !== void 0 && orderId !== null) localVarQueryParameter["orderId"] = orderId;
|
|
178
|
+
if (quoteId !== void 0 && quoteId !== null) localVarQueryParameter["quoteId"] = quoteId;
|
|
179
|
+
let _timeUnit;
|
|
180
|
+
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
|
|
181
|
+
return {
|
|
182
|
+
endpoint: "/sapi/v1/convert/orderStatus",
|
|
183
|
+
method: "GET",
|
|
184
|
+
params: localVarQueryParameter,
|
|
185
|
+
timeUnit: _timeUnit
|
|
186
|
+
};
|
|
187
|
+
},
|
|
188
|
+
placeLimitOrder: async (baseAsset, quoteAsset, limitPrice, side, expiredType, baseAmount, quoteAmount, walletType, recvWindow) => {
|
|
189
|
+
(0, __binance_common.assertParamExists)("placeLimitOrder", "baseAsset", baseAsset);
|
|
190
|
+
(0, __binance_common.assertParamExists)("placeLimitOrder", "quoteAsset", quoteAsset);
|
|
191
|
+
(0, __binance_common.assertParamExists)("placeLimitOrder", "limitPrice", limitPrice);
|
|
192
|
+
(0, __binance_common.assertParamExists)("placeLimitOrder", "side", side);
|
|
193
|
+
(0, __binance_common.assertParamExists)("placeLimitOrder", "expiredType", expiredType);
|
|
194
|
+
const localVarQueryParameter = {};
|
|
195
|
+
if (baseAsset !== void 0 && baseAsset !== null) localVarQueryParameter["baseAsset"] = baseAsset;
|
|
196
|
+
if (quoteAsset !== void 0 && quoteAsset !== null) localVarQueryParameter["quoteAsset"] = quoteAsset;
|
|
197
|
+
if (limitPrice !== void 0 && limitPrice !== null) localVarQueryParameter["limitPrice"] = limitPrice;
|
|
198
|
+
if (baseAmount !== void 0 && baseAmount !== null) localVarQueryParameter["baseAmount"] = baseAmount;
|
|
199
|
+
if (quoteAmount !== void 0 && quoteAmount !== null) localVarQueryParameter["quoteAmount"] = quoteAmount;
|
|
200
|
+
if (side !== void 0 && side !== null) localVarQueryParameter["side"] = side;
|
|
201
|
+
if (walletType !== void 0 && walletType !== null) localVarQueryParameter["walletType"] = walletType;
|
|
202
|
+
if (expiredType !== void 0 && expiredType !== null) localVarQueryParameter["expiredType"] = expiredType;
|
|
203
|
+
if (recvWindow !== void 0 && recvWindow !== null) localVarQueryParameter["recvWindow"] = recvWindow;
|
|
204
|
+
let _timeUnit;
|
|
205
|
+
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
|
|
206
|
+
return {
|
|
207
|
+
endpoint: "/sapi/v1/convert/limit/placeOrder",
|
|
208
|
+
method: "POST",
|
|
209
|
+
params: localVarQueryParameter,
|
|
210
|
+
timeUnit: _timeUnit
|
|
211
|
+
};
|
|
212
|
+
},
|
|
213
|
+
queryLimitOpenOrders: async (recvWindow) => {
|
|
214
|
+
const localVarQueryParameter = {};
|
|
215
|
+
if (recvWindow !== void 0 && recvWindow !== null) localVarQueryParameter["recvWindow"] = recvWindow;
|
|
216
|
+
let _timeUnit;
|
|
217
|
+
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
|
|
218
|
+
return {
|
|
219
|
+
endpoint: "/sapi/v1/convert/limit/queryOpenOrders",
|
|
220
|
+
method: "GET",
|
|
221
|
+
params: localVarQueryParameter,
|
|
222
|
+
timeUnit: _timeUnit
|
|
223
|
+
};
|
|
224
|
+
},
|
|
225
|
+
sendQuoteRequest: async (fromAsset, toAsset, fromAmount, toAmount, walletType, validTime, recvWindow) => {
|
|
226
|
+
(0, __binance_common.assertParamExists)("sendQuoteRequest", "fromAsset", fromAsset);
|
|
227
|
+
(0, __binance_common.assertParamExists)("sendQuoteRequest", "toAsset", toAsset);
|
|
228
|
+
const localVarQueryParameter = {};
|
|
229
|
+
if (fromAsset !== void 0 && fromAsset !== null) localVarQueryParameter["fromAsset"] = fromAsset;
|
|
230
|
+
if (toAsset !== void 0 && toAsset !== null) localVarQueryParameter["toAsset"] = toAsset;
|
|
231
|
+
if (fromAmount !== void 0 && fromAmount !== null) localVarQueryParameter["fromAmount"] = fromAmount;
|
|
232
|
+
if (toAmount !== void 0 && toAmount !== null) localVarQueryParameter["toAmount"] = toAmount;
|
|
233
|
+
if (walletType !== void 0 && walletType !== null) localVarQueryParameter["walletType"] = walletType;
|
|
234
|
+
if (validTime !== void 0 && validTime !== null) localVarQueryParameter["validTime"] = validTime;
|
|
235
|
+
if (recvWindow !== void 0 && recvWindow !== null) localVarQueryParameter["recvWindow"] = recvWindow;
|
|
236
|
+
let _timeUnit;
|
|
237
|
+
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
|
|
238
|
+
return {
|
|
239
|
+
endpoint: "/sapi/v1/convert/getQuote",
|
|
240
|
+
method: "POST",
|
|
241
|
+
params: localVarQueryParameter,
|
|
242
|
+
timeUnit: _timeUnit
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
};
|
|
449
246
|
};
|
|
247
|
+
/**
|
|
248
|
+
* TradeApi - object-oriented interface
|
|
249
|
+
* @class TradeApi
|
|
250
|
+
*/
|
|
450
251
|
var TradeApi = class {
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
* @memberof TradeApi
|
|
577
|
-
* @see {@link https://developers.binance.com/docs/convert/trade/Place-Order Binance API Documentation}
|
|
578
|
-
*/
|
|
579
|
-
async placeLimitOrder(requestParameters) {
|
|
580
|
-
const localVarAxiosArgs = await this.localVarAxiosParamCreator.placeLimitOrder(
|
|
581
|
-
requestParameters?.baseAsset,
|
|
582
|
-
requestParameters?.quoteAsset,
|
|
583
|
-
requestParameters?.limitPrice,
|
|
584
|
-
requestParameters?.side,
|
|
585
|
-
requestParameters?.expiredType,
|
|
586
|
-
requestParameters?.baseAmount,
|
|
587
|
-
requestParameters?.quoteAmount,
|
|
588
|
-
requestParameters?.walletType,
|
|
589
|
-
requestParameters?.recvWindow
|
|
590
|
-
);
|
|
591
|
-
return (0, import_common2.sendRequest)(
|
|
592
|
-
this.configuration,
|
|
593
|
-
localVarAxiosArgs.endpoint,
|
|
594
|
-
localVarAxiosArgs.method,
|
|
595
|
-
localVarAxiosArgs.params,
|
|
596
|
-
localVarAxiosArgs?.timeUnit,
|
|
597
|
-
{ isSigned: true }
|
|
598
|
-
);
|
|
599
|
-
}
|
|
600
|
-
/**
|
|
601
|
-
* Request a quote for the requested token pairs
|
|
602
|
-
*
|
|
603
|
-
* Weight: 3000(UID)
|
|
604
|
-
*
|
|
605
|
-
* @summary Query limit open orders (USER_DATA)
|
|
606
|
-
* @param {QueryLimitOpenOrdersRequest} requestParameters Request parameters.
|
|
607
|
-
* @returns {Promise<RestApiResponse<QueryLimitOpenOrdersResponse>>}
|
|
608
|
-
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
609
|
-
* @memberof TradeApi
|
|
610
|
-
* @see {@link https://developers.binance.com/docs/convert/trade/Query-Order Binance API Documentation}
|
|
611
|
-
*/
|
|
612
|
-
async queryLimitOpenOrders(requestParameters = {}) {
|
|
613
|
-
const localVarAxiosArgs = await this.localVarAxiosParamCreator.queryLimitOpenOrders(
|
|
614
|
-
requestParameters?.recvWindow
|
|
615
|
-
);
|
|
616
|
-
return (0, import_common2.sendRequest)(
|
|
617
|
-
this.configuration,
|
|
618
|
-
localVarAxiosArgs.endpoint,
|
|
619
|
-
localVarAxiosArgs.method,
|
|
620
|
-
localVarAxiosArgs.params,
|
|
621
|
-
localVarAxiosArgs?.timeUnit,
|
|
622
|
-
{ isSigned: true }
|
|
623
|
-
);
|
|
624
|
-
}
|
|
625
|
-
/**
|
|
626
|
-
* Request a quote for the requested token pairs
|
|
627
|
-
*
|
|
628
|
-
* Either fromAmount or toAmount should be sent
|
|
629
|
-
* `quoteId` will be returned only if you have enough funds to convert
|
|
630
|
-
*
|
|
631
|
-
* Weight: 200(UID)
|
|
632
|
-
*
|
|
633
|
-
* @summary Send Quote Request(USER_DATA)
|
|
634
|
-
* @param {SendQuoteRequestRequest} requestParameters Request parameters.
|
|
635
|
-
* @returns {Promise<RestApiResponse<SendQuoteRequestResponse>>}
|
|
636
|
-
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
637
|
-
* @memberof TradeApi
|
|
638
|
-
* @see {@link https://developers.binance.com/docs/convert/trade/Send-quote-request Binance API Documentation}
|
|
639
|
-
*/
|
|
640
|
-
async sendQuoteRequest(requestParameters) {
|
|
641
|
-
const localVarAxiosArgs = await this.localVarAxiosParamCreator.sendQuoteRequest(
|
|
642
|
-
requestParameters?.fromAsset,
|
|
643
|
-
requestParameters?.toAsset,
|
|
644
|
-
requestParameters?.fromAmount,
|
|
645
|
-
requestParameters?.toAmount,
|
|
646
|
-
requestParameters?.walletType,
|
|
647
|
-
requestParameters?.validTime,
|
|
648
|
-
requestParameters?.recvWindow
|
|
649
|
-
);
|
|
650
|
-
return (0, import_common2.sendRequest)(
|
|
651
|
-
this.configuration,
|
|
652
|
-
localVarAxiosArgs.endpoint,
|
|
653
|
-
localVarAxiosArgs.method,
|
|
654
|
-
localVarAxiosArgs.params,
|
|
655
|
-
localVarAxiosArgs?.timeUnit,
|
|
656
|
-
{ isSigned: true }
|
|
657
|
-
);
|
|
658
|
-
}
|
|
252
|
+
constructor(configuration) {
|
|
253
|
+
this.configuration = configuration;
|
|
254
|
+
this.localVarAxiosParamCreator = TradeApiAxiosParamCreator(configuration);
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Accept the offered quote by quote ID.
|
|
258
|
+
*
|
|
259
|
+
* Weight: 500(UID)
|
|
260
|
+
*
|
|
261
|
+
* @summary Accept Quote (TRADE)
|
|
262
|
+
* @param {AcceptQuoteRequest} requestParameters Request parameters.
|
|
263
|
+
* @returns {Promise<RestApiResponse<AcceptQuoteResponse>>}
|
|
264
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
265
|
+
* @memberof TradeApi
|
|
266
|
+
* @see {@link https://developers.binance.com/docs/convert/trade/Accept-Quote Binance API Documentation}
|
|
267
|
+
*/
|
|
268
|
+
async acceptQuote(requestParameters) {
|
|
269
|
+
const localVarAxiosArgs = await this.localVarAxiosParamCreator.acceptQuote(requestParameters?.quoteId, requestParameters?.recvWindow);
|
|
270
|
+
return (0, __binance_common.sendRequest)(this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true });
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Enable users to cancel a limit order
|
|
274
|
+
*
|
|
275
|
+
* Weight: 200(UID)
|
|
276
|
+
*
|
|
277
|
+
* @summary Cancel limit order (USER_DATA)
|
|
278
|
+
* @param {CancelLimitOrderRequest} requestParameters Request parameters.
|
|
279
|
+
* @returns {Promise<RestApiResponse<CancelLimitOrderResponse>>}
|
|
280
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
281
|
+
* @memberof TradeApi
|
|
282
|
+
* @see {@link https://developers.binance.com/docs/convert/trade/Cancel-Order Binance API Documentation}
|
|
283
|
+
*/
|
|
284
|
+
async cancelLimitOrder(requestParameters) {
|
|
285
|
+
const localVarAxiosArgs = await this.localVarAxiosParamCreator.cancelLimitOrder(requestParameters?.orderId, requestParameters?.recvWindow);
|
|
286
|
+
return (0, __binance_common.sendRequest)(this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true });
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Get Convert Trade History
|
|
290
|
+
*
|
|
291
|
+
* The max interval between startTime and endTime is 30 days.
|
|
292
|
+
*
|
|
293
|
+
* Weight: 3000
|
|
294
|
+
*
|
|
295
|
+
* @summary Get Convert Trade History(USER_DATA)
|
|
296
|
+
* @param {GetConvertTradeHistoryRequest} requestParameters Request parameters.
|
|
297
|
+
* @returns {Promise<RestApiResponse<GetConvertTradeHistoryResponse>>}
|
|
298
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
299
|
+
* @memberof TradeApi
|
|
300
|
+
* @see {@link https://developers.binance.com/docs/convert/trade/Get-Convert-Trade-History Binance API Documentation}
|
|
301
|
+
*/
|
|
302
|
+
async getConvertTradeHistory(requestParameters) {
|
|
303
|
+
const localVarAxiosArgs = await this.localVarAxiosParamCreator.getConvertTradeHistory(requestParameters?.startTime, requestParameters?.endTime, requestParameters?.limit, requestParameters?.recvWindow);
|
|
304
|
+
return (0, __binance_common.sendRequest)(this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true });
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Query order status by order ID.
|
|
308
|
+
*
|
|
309
|
+
* Weight: 100(UID)
|
|
310
|
+
*
|
|
311
|
+
* @summary Order status(USER_DATA)
|
|
312
|
+
* @param {OrderStatusRequest} requestParameters Request parameters.
|
|
313
|
+
* @returns {Promise<RestApiResponse<OrderStatusResponse>>}
|
|
314
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
315
|
+
* @memberof TradeApi
|
|
316
|
+
* @see {@link https://developers.binance.com/docs/convert/trade/Order-Status Binance API Documentation}
|
|
317
|
+
*/
|
|
318
|
+
async orderStatus(requestParameters = {}) {
|
|
319
|
+
const localVarAxiosArgs = await this.localVarAxiosParamCreator.orderStatus(requestParameters?.orderId, requestParameters?.quoteId);
|
|
320
|
+
return (0, __binance_common.sendRequest)(this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true });
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Enable users to place a limit order
|
|
324
|
+
*
|
|
325
|
+
* `baseAsset` or `quoteAsset` can be determined via `exchangeInfo` endpoint.
|
|
326
|
+
* Limit price is defined from `baseAsset` to `quoteAsset`.
|
|
327
|
+
* Either `baseAmount` or `quoteAmount` is used.
|
|
328
|
+
*
|
|
329
|
+
* Weight: 500(UID)
|
|
330
|
+
*
|
|
331
|
+
* @summary Place limit order (USER_DATA)
|
|
332
|
+
* @param {PlaceLimitOrderRequest} requestParameters Request parameters.
|
|
333
|
+
* @returns {Promise<RestApiResponse<PlaceLimitOrderResponse>>}
|
|
334
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
335
|
+
* @memberof TradeApi
|
|
336
|
+
* @see {@link https://developers.binance.com/docs/convert/trade/Place-Order Binance API Documentation}
|
|
337
|
+
*/
|
|
338
|
+
async placeLimitOrder(requestParameters) {
|
|
339
|
+
const localVarAxiosArgs = await this.localVarAxiosParamCreator.placeLimitOrder(requestParameters?.baseAsset, requestParameters?.quoteAsset, requestParameters?.limitPrice, requestParameters?.side, requestParameters?.expiredType, requestParameters?.baseAmount, requestParameters?.quoteAmount, requestParameters?.walletType, requestParameters?.recvWindow);
|
|
340
|
+
return (0, __binance_common.sendRequest)(this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true });
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Request a quote for the requested token pairs
|
|
344
|
+
*
|
|
345
|
+
* Weight: 3000(UID)
|
|
346
|
+
*
|
|
347
|
+
* @summary Query limit open orders (USER_DATA)
|
|
348
|
+
* @param {QueryLimitOpenOrdersRequest} requestParameters Request parameters.
|
|
349
|
+
* @returns {Promise<RestApiResponse<QueryLimitOpenOrdersResponse>>}
|
|
350
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
351
|
+
* @memberof TradeApi
|
|
352
|
+
* @see {@link https://developers.binance.com/docs/convert/trade/Query-Order Binance API Documentation}
|
|
353
|
+
*/
|
|
354
|
+
async queryLimitOpenOrders(requestParameters = {}) {
|
|
355
|
+
const localVarAxiosArgs = await this.localVarAxiosParamCreator.queryLimitOpenOrders(requestParameters?.recvWindow);
|
|
356
|
+
return (0, __binance_common.sendRequest)(this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true });
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Request a quote for the requested token pairs
|
|
360
|
+
*
|
|
361
|
+
* Either fromAmount or toAmount should be sent
|
|
362
|
+
* `quoteId` will be returned only if you have enough funds to convert
|
|
363
|
+
*
|
|
364
|
+
* Weight: 200(UID)
|
|
365
|
+
*
|
|
366
|
+
* @summary Send Quote Request(USER_DATA)
|
|
367
|
+
* @param {SendQuoteRequestRequest} requestParameters Request parameters.
|
|
368
|
+
* @returns {Promise<RestApiResponse<SendQuoteRequestResponse>>}
|
|
369
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
370
|
+
* @memberof TradeApi
|
|
371
|
+
* @see {@link https://developers.binance.com/docs/convert/trade/Send-quote-request Binance API Documentation}
|
|
372
|
+
*/
|
|
373
|
+
async sendQuoteRequest(requestParameters) {
|
|
374
|
+
const localVarAxiosArgs = await this.localVarAxiosParamCreator.sendQuoteRequest(requestParameters?.fromAsset, requestParameters?.toAsset, requestParameters?.fromAmount, requestParameters?.toAmount, requestParameters?.walletType, requestParameters?.validTime, requestParameters?.recvWindow);
|
|
375
|
+
return (0, __binance_common.sendRequest)(this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true });
|
|
376
|
+
}
|
|
659
377
|
};
|
|
660
378
|
|
|
661
|
-
|
|
662
|
-
|
|
379
|
+
//#endregion
|
|
380
|
+
//#region src/rest-api/rest-api.ts
|
|
381
|
+
/**
|
|
382
|
+
* Binance Convert REST API
|
|
383
|
+
*
|
|
384
|
+
* OpenAPI Specification for the Binance Convert REST API
|
|
385
|
+
*
|
|
386
|
+
* The version of the OpenAPI document: 1.0.0
|
|
387
|
+
*
|
|
388
|
+
*
|
|
389
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
390
|
+
* https://openapi-generator.tech
|
|
391
|
+
* Do not edit the class manually.
|
|
392
|
+
*/
|
|
663
393
|
var RestAPI = class {
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
394
|
+
constructor(configuration) {
|
|
395
|
+
this.configuration = configuration;
|
|
396
|
+
this.marketDataApi = new MarketDataApi(configuration);
|
|
397
|
+
this.tradeApi = new TradeApi(configuration);
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Generic function to send a request.
|
|
401
|
+
* @param endpoint - The API endpoint to call.
|
|
402
|
+
* @param method - HTTP method to use (GET, POST, DELETE, etc.).
|
|
403
|
+
* @param params - Query parameters for the request.
|
|
404
|
+
*
|
|
405
|
+
* @returns A promise resolving to the response data object.
|
|
406
|
+
*/
|
|
407
|
+
sendRequest(endpoint, method, params = {}) {
|
|
408
|
+
return (0, __binance_common.sendRequest)(this.configuration, endpoint, method, params, void 0);
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Generic function to send a signed request.
|
|
412
|
+
* @param endpoint - The API endpoint to call.
|
|
413
|
+
* @param method - HTTP method to use (GET, POST, DELETE, etc.).
|
|
414
|
+
* @param params - Query parameters for the request.
|
|
415
|
+
*
|
|
416
|
+
* @returns A promise resolving to the response data object.
|
|
417
|
+
*/
|
|
418
|
+
sendSignedRequest(endpoint, method, params = {}) {
|
|
419
|
+
return (0, __binance_common.sendRequest)(this.configuration, endpoint, method, params, void 0, { isSigned: true });
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Query for all convertible token pairs and the tokens’ respective upper/lower limits
|
|
423
|
+
*
|
|
424
|
+
* User needs to supply either or both of the input parameter
|
|
425
|
+
* If not defined for both fromAsset and toAsset, only partial token pairs will be returned
|
|
426
|
+
*
|
|
427
|
+
* Weight: 3000(IP)
|
|
428
|
+
*
|
|
429
|
+
* @summary List All Convert Pairs
|
|
430
|
+
* @param {ListAllConvertPairsRequest} requestParameters Request parameters.
|
|
431
|
+
*
|
|
432
|
+
* @returns {Promise<RestApiResponse<ListAllConvertPairsResponse>>}
|
|
433
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
434
|
+
* @see {@link https://developers.binance.com/docs/convert/market-data/ Binance API Documentation}
|
|
435
|
+
*/
|
|
436
|
+
listAllConvertPairs(requestParameters = {}) {
|
|
437
|
+
return this.marketDataApi.listAllConvertPairs(requestParameters);
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Query for supported asset’s precision information
|
|
441
|
+
*
|
|
442
|
+
* Weight: 100(IP)
|
|
443
|
+
*
|
|
444
|
+
* @summary Query order quantity precision per asset(USER_DATA)
|
|
445
|
+
* @param {QueryOrderQuantityPrecisionPerAssetRequest} requestParameters Request parameters.
|
|
446
|
+
*
|
|
447
|
+
* @returns {Promise<RestApiResponse<QueryOrderQuantityPrecisionPerAssetResponse>>}
|
|
448
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
449
|
+
* @see {@link https://developers.binance.com/docs/convert/market-data/Query-order-quantity-precision-per-asset Binance API Documentation}
|
|
450
|
+
*/
|
|
451
|
+
queryOrderQuantityPrecisionPerAsset(requestParameters = {}) {
|
|
452
|
+
return this.marketDataApi.queryOrderQuantityPrecisionPerAsset(requestParameters);
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Accept the offered quote by quote ID.
|
|
456
|
+
*
|
|
457
|
+
* Weight: 500(UID)
|
|
458
|
+
*
|
|
459
|
+
* @summary Accept Quote (TRADE)
|
|
460
|
+
* @param {AcceptQuoteRequest} requestParameters Request parameters.
|
|
461
|
+
*
|
|
462
|
+
* @returns {Promise<RestApiResponse<AcceptQuoteResponse>>}
|
|
463
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
464
|
+
* @see {@link https://developers.binance.com/docs/convert/trade/Accept-Quote Binance API Documentation}
|
|
465
|
+
*/
|
|
466
|
+
acceptQuote(requestParameters) {
|
|
467
|
+
return this.tradeApi.acceptQuote(requestParameters);
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Enable users to cancel a limit order
|
|
471
|
+
*
|
|
472
|
+
* Weight: 200(UID)
|
|
473
|
+
*
|
|
474
|
+
* @summary Cancel limit order (USER_DATA)
|
|
475
|
+
* @param {CancelLimitOrderRequest} requestParameters Request parameters.
|
|
476
|
+
*
|
|
477
|
+
* @returns {Promise<RestApiResponse<CancelLimitOrderResponse>>}
|
|
478
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
479
|
+
* @see {@link https://developers.binance.com/docs/convert/trade/Cancel-Order Binance API Documentation}
|
|
480
|
+
*/
|
|
481
|
+
cancelLimitOrder(requestParameters) {
|
|
482
|
+
return this.tradeApi.cancelLimitOrder(requestParameters);
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Get Convert Trade History
|
|
486
|
+
*
|
|
487
|
+
* The max interval between startTime and endTime is 30 days.
|
|
488
|
+
*
|
|
489
|
+
* Weight: 3000
|
|
490
|
+
*
|
|
491
|
+
* @summary Get Convert Trade History(USER_DATA)
|
|
492
|
+
* @param {GetConvertTradeHistoryRequest} requestParameters Request parameters.
|
|
493
|
+
*
|
|
494
|
+
* @returns {Promise<RestApiResponse<GetConvertTradeHistoryResponse>>}
|
|
495
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
496
|
+
* @see {@link https://developers.binance.com/docs/convert/trade/Get-Convert-Trade-History Binance API Documentation}
|
|
497
|
+
*/
|
|
498
|
+
getConvertTradeHistory(requestParameters) {
|
|
499
|
+
return this.tradeApi.getConvertTradeHistory(requestParameters);
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Query order status by order ID.
|
|
503
|
+
*
|
|
504
|
+
* Weight: 100(UID)
|
|
505
|
+
*
|
|
506
|
+
* @summary Order status(USER_DATA)
|
|
507
|
+
* @param {OrderStatusRequest} requestParameters Request parameters.
|
|
508
|
+
*
|
|
509
|
+
* @returns {Promise<RestApiResponse<OrderStatusResponse>>}
|
|
510
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
511
|
+
* @see {@link https://developers.binance.com/docs/convert/trade/Order-Status Binance API Documentation}
|
|
512
|
+
*/
|
|
513
|
+
orderStatus(requestParameters = {}) {
|
|
514
|
+
return this.tradeApi.orderStatus(requestParameters);
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Enable users to place a limit order
|
|
518
|
+
*
|
|
519
|
+
* `baseAsset` or `quoteAsset` can be determined via `exchangeInfo` endpoint.
|
|
520
|
+
* Limit price is defined from `baseAsset` to `quoteAsset`.
|
|
521
|
+
* Either `baseAmount` or `quoteAmount` is used.
|
|
522
|
+
*
|
|
523
|
+
* Weight: 500(UID)
|
|
524
|
+
*
|
|
525
|
+
* @summary Place limit order (USER_DATA)
|
|
526
|
+
* @param {PlaceLimitOrderRequest} requestParameters Request parameters.
|
|
527
|
+
*
|
|
528
|
+
* @returns {Promise<RestApiResponse<PlaceLimitOrderResponse>>}
|
|
529
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
530
|
+
* @see {@link https://developers.binance.com/docs/convert/trade/Place-Order Binance API Documentation}
|
|
531
|
+
*/
|
|
532
|
+
placeLimitOrder(requestParameters) {
|
|
533
|
+
return this.tradeApi.placeLimitOrder(requestParameters);
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* Request a quote for the requested token pairs
|
|
537
|
+
*
|
|
538
|
+
* Weight: 3000(UID)
|
|
539
|
+
*
|
|
540
|
+
* @summary Query limit open orders (USER_DATA)
|
|
541
|
+
* @param {QueryLimitOpenOrdersRequest} requestParameters Request parameters.
|
|
542
|
+
*
|
|
543
|
+
* @returns {Promise<RestApiResponse<QueryLimitOpenOrdersResponse>>}
|
|
544
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
545
|
+
* @see {@link https://developers.binance.com/docs/convert/trade/Query-Order Binance API Documentation}
|
|
546
|
+
*/
|
|
547
|
+
queryLimitOpenOrders(requestParameters = {}) {
|
|
548
|
+
return this.tradeApi.queryLimitOpenOrders(requestParameters);
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* Request a quote for the requested token pairs
|
|
552
|
+
*
|
|
553
|
+
* Either fromAmount or toAmount should be sent
|
|
554
|
+
* `quoteId` will be returned only if you have enough funds to convert
|
|
555
|
+
*
|
|
556
|
+
* Weight: 200(UID)
|
|
557
|
+
*
|
|
558
|
+
* @summary Send Quote Request(USER_DATA)
|
|
559
|
+
* @param {SendQuoteRequestRequest} requestParameters Request parameters.
|
|
560
|
+
*
|
|
561
|
+
* @returns {Promise<RestApiResponse<SendQuoteRequestResponse>>}
|
|
562
|
+
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
563
|
+
* @see {@link https://developers.binance.com/docs/convert/trade/Send-quote-request Binance API Documentation}
|
|
564
|
+
*/
|
|
565
|
+
sendQuoteRequest(requestParameters) {
|
|
566
|
+
return this.tradeApi.sendQuoteRequest(requestParameters);
|
|
567
|
+
}
|
|
568
|
+
};
|
|
569
|
+
|
|
570
|
+
//#endregion
|
|
571
|
+
//#region src/rest-api/index.ts
|
|
572
|
+
var rest_api_exports = /* @__PURE__ */ __export({
|
|
573
|
+
MarketDataApi: () => MarketDataApi,
|
|
574
|
+
RestAPI: () => RestAPI,
|
|
575
|
+
TradeApi: () => TradeApi
|
|
576
|
+
});
|
|
577
|
+
|
|
578
|
+
//#endregion
|
|
579
|
+
//#region src/convert.ts
|
|
580
|
+
var Convert = class {
|
|
581
|
+
constructor(config) {
|
|
582
|
+
const userAgent = (0, __binance_common.buildUserAgent)(name, version);
|
|
583
|
+
if (config?.configurationRestAPI) {
|
|
584
|
+
const configRestAPI = new __binance_common.ConfigurationRestAPI(config.configurationRestAPI);
|
|
585
|
+
configRestAPI.basePath = configRestAPI.basePath || __binance_common.CONVERT_REST_API_PROD_URL;
|
|
586
|
+
configRestAPI.baseOptions = configRestAPI.baseOptions || {};
|
|
587
|
+
configRestAPI.baseOptions.headers = {
|
|
588
|
+
...configRestAPI.baseOptions.headers || {},
|
|
589
|
+
"User-Agent": userAgent
|
|
590
|
+
};
|
|
591
|
+
this.restAPI = new RestAPI(configRestAPI);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
};
|
|
595
|
+
|
|
596
|
+
//#endregion
|
|
597
|
+
Object.defineProperty(exports, 'BadRequestError', {
|
|
598
|
+
enumerable: true,
|
|
599
|
+
get: function () {
|
|
600
|
+
return __binance_common.BadRequestError;
|
|
668
601
|
}
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
*
|
|
675
|
-
* @returns A promise resolving to the response data object.
|
|
676
|
-
*/
|
|
677
|
-
sendRequest(endpoint, method, params = {}) {
|
|
678
|
-
return (0, import_common3.sendRequest)(this.configuration, endpoint, method, params, void 0);
|
|
602
|
+
});
|
|
603
|
+
Object.defineProperty(exports, 'CONVERT_REST_API_PROD_URL', {
|
|
604
|
+
enumerable: true,
|
|
605
|
+
get: function () {
|
|
606
|
+
return __binance_common.CONVERT_REST_API_PROD_URL;
|
|
679
607
|
}
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
*
|
|
686
|
-
* @returns A promise resolving to the response data object.
|
|
687
|
-
*/
|
|
688
|
-
sendSignedRequest(endpoint, method, params = {}) {
|
|
689
|
-
return (0, import_common3.sendRequest)(this.configuration, endpoint, method, params, void 0, {
|
|
690
|
-
isSigned: true
|
|
691
|
-
});
|
|
608
|
+
});
|
|
609
|
+
Object.defineProperty(exports, 'ConfigurationConvert', {
|
|
610
|
+
enumerable: true,
|
|
611
|
+
get: function () {
|
|
612
|
+
return ConfigurationConvert;
|
|
692
613
|
}
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
*
|
|
699
|
-
* Weight: 3000(IP)
|
|
700
|
-
*
|
|
701
|
-
* @summary List All Convert Pairs
|
|
702
|
-
* @param {ListAllConvertPairsRequest} requestParameters Request parameters.
|
|
703
|
-
*
|
|
704
|
-
* @returns {Promise<RestApiResponse<ListAllConvertPairsResponse>>}
|
|
705
|
-
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
706
|
-
* @see {@link https://developers.binance.com/docs/convert/market-data/ Binance API Documentation}
|
|
707
|
-
*/
|
|
708
|
-
listAllConvertPairs(requestParameters = {}) {
|
|
709
|
-
return this.marketDataApi.listAllConvertPairs(requestParameters);
|
|
614
|
+
});
|
|
615
|
+
Object.defineProperty(exports, 'ConnectorClientError', {
|
|
616
|
+
enumerable: true,
|
|
617
|
+
get: function () {
|
|
618
|
+
return __binance_common.ConnectorClientError;
|
|
710
619
|
}
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
* @param {QueryOrderQuantityPrecisionPerAssetRequest} requestParameters Request parameters.
|
|
718
|
-
*
|
|
719
|
-
* @returns {Promise<RestApiResponse<QueryOrderQuantityPrecisionPerAssetResponse>>}
|
|
720
|
-
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
721
|
-
* @see {@link https://developers.binance.com/docs/convert/market-data/Query-order-quantity-precision-per-asset Binance API Documentation}
|
|
722
|
-
*/
|
|
723
|
-
queryOrderQuantityPrecisionPerAsset(requestParameters = {}) {
|
|
724
|
-
return this.marketDataApi.queryOrderQuantityPrecisionPerAsset(requestParameters);
|
|
620
|
+
});
|
|
621
|
+
exports.Convert = Convert;
|
|
622
|
+
Object.defineProperty(exports, 'ConvertRestAPI', {
|
|
623
|
+
enumerable: true,
|
|
624
|
+
get: function () {
|
|
625
|
+
return rest_api_exports;
|
|
725
626
|
}
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
* @summary Accept Quote (TRADE)
|
|
732
|
-
* @param {AcceptQuoteRequest} requestParameters Request parameters.
|
|
733
|
-
*
|
|
734
|
-
* @returns {Promise<RestApiResponse<AcceptQuoteResponse>>}
|
|
735
|
-
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
736
|
-
* @see {@link https://developers.binance.com/docs/convert/trade/Accept-Quote Binance API Documentation}
|
|
737
|
-
*/
|
|
738
|
-
acceptQuote(requestParameters) {
|
|
739
|
-
return this.tradeApi.acceptQuote(requestParameters);
|
|
627
|
+
});
|
|
628
|
+
Object.defineProperty(exports, 'ForbiddenError', {
|
|
629
|
+
enumerable: true,
|
|
630
|
+
get: function () {
|
|
631
|
+
return __binance_common.ForbiddenError;
|
|
740
632
|
}
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
* @summary Cancel limit order (USER_DATA)
|
|
747
|
-
* @param {CancelLimitOrderRequest} requestParameters Request parameters.
|
|
748
|
-
*
|
|
749
|
-
* @returns {Promise<RestApiResponse<CancelLimitOrderResponse>>}
|
|
750
|
-
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
751
|
-
* @see {@link https://developers.binance.com/docs/convert/trade/Cancel-Order Binance API Documentation}
|
|
752
|
-
*/
|
|
753
|
-
cancelLimitOrder(requestParameters) {
|
|
754
|
-
return this.tradeApi.cancelLimitOrder(requestParameters);
|
|
633
|
+
});
|
|
634
|
+
Object.defineProperty(exports, 'NetworkError', {
|
|
635
|
+
enumerable: true,
|
|
636
|
+
get: function () {
|
|
637
|
+
return __binance_common.NetworkError;
|
|
755
638
|
}
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
* Weight: 3000
|
|
762
|
-
*
|
|
763
|
-
* @summary Get Convert Trade History(USER_DATA)
|
|
764
|
-
* @param {GetConvertTradeHistoryRequest} requestParameters Request parameters.
|
|
765
|
-
*
|
|
766
|
-
* @returns {Promise<RestApiResponse<GetConvertTradeHistoryResponse>>}
|
|
767
|
-
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
768
|
-
* @see {@link https://developers.binance.com/docs/convert/trade/Get-Convert-Trade-History Binance API Documentation}
|
|
769
|
-
*/
|
|
770
|
-
getConvertTradeHistory(requestParameters) {
|
|
771
|
-
return this.tradeApi.getConvertTradeHistory(requestParameters);
|
|
639
|
+
});
|
|
640
|
+
Object.defineProperty(exports, 'NotFoundError', {
|
|
641
|
+
enumerable: true,
|
|
642
|
+
get: function () {
|
|
643
|
+
return __binance_common.NotFoundError;
|
|
772
644
|
}
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
* @summary Order status(USER_DATA)
|
|
779
|
-
* @param {OrderStatusRequest} requestParameters Request parameters.
|
|
780
|
-
*
|
|
781
|
-
* @returns {Promise<RestApiResponse<OrderStatusResponse>>}
|
|
782
|
-
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
783
|
-
* @see {@link https://developers.binance.com/docs/convert/trade/Order-Status Binance API Documentation}
|
|
784
|
-
*/
|
|
785
|
-
orderStatus(requestParameters = {}) {
|
|
786
|
-
return this.tradeApi.orderStatus(requestParameters);
|
|
645
|
+
});
|
|
646
|
+
Object.defineProperty(exports, 'RateLimitBanError', {
|
|
647
|
+
enumerable: true,
|
|
648
|
+
get: function () {
|
|
649
|
+
return __binance_common.RateLimitBanError;
|
|
787
650
|
}
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
* Either `baseAmount` or `quoteAmount` is used.
|
|
794
|
-
*
|
|
795
|
-
* Weight: 500(UID)
|
|
796
|
-
*
|
|
797
|
-
* @summary Place limit order (USER_DATA)
|
|
798
|
-
* @param {PlaceLimitOrderRequest} requestParameters Request parameters.
|
|
799
|
-
*
|
|
800
|
-
* @returns {Promise<RestApiResponse<PlaceLimitOrderResponse>>}
|
|
801
|
-
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
802
|
-
* @see {@link https://developers.binance.com/docs/convert/trade/Place-Order Binance API Documentation}
|
|
803
|
-
*/
|
|
804
|
-
placeLimitOrder(requestParameters) {
|
|
805
|
-
return this.tradeApi.placeLimitOrder(requestParameters);
|
|
651
|
+
});
|
|
652
|
+
Object.defineProperty(exports, 'RequiredError', {
|
|
653
|
+
enumerable: true,
|
|
654
|
+
get: function () {
|
|
655
|
+
return __binance_common.RequiredError;
|
|
806
656
|
}
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
* @summary Query limit open orders (USER_DATA)
|
|
813
|
-
* @param {QueryLimitOpenOrdersRequest} requestParameters Request parameters.
|
|
814
|
-
*
|
|
815
|
-
* @returns {Promise<RestApiResponse<QueryLimitOpenOrdersResponse>>}
|
|
816
|
-
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
817
|
-
* @see {@link https://developers.binance.com/docs/convert/trade/Query-Order Binance API Documentation}
|
|
818
|
-
*/
|
|
819
|
-
queryLimitOpenOrders(requestParameters = {}) {
|
|
820
|
-
return this.tradeApi.queryLimitOpenOrders(requestParameters);
|
|
657
|
+
});
|
|
658
|
+
Object.defineProperty(exports, 'ServerError', {
|
|
659
|
+
enumerable: true,
|
|
660
|
+
get: function () {
|
|
661
|
+
return __binance_common.ServerError;
|
|
821
662
|
}
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
*
|
|
828
|
-
* Weight: 200(UID)
|
|
829
|
-
*
|
|
830
|
-
* @summary Send Quote Request(USER_DATA)
|
|
831
|
-
* @param {SendQuoteRequestRequest} requestParameters Request parameters.
|
|
832
|
-
*
|
|
833
|
-
* @returns {Promise<RestApiResponse<SendQuoteRequestResponse>>}
|
|
834
|
-
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
|
|
835
|
-
* @see {@link https://developers.binance.com/docs/convert/trade/Send-quote-request Binance API Documentation}
|
|
836
|
-
*/
|
|
837
|
-
sendQuoteRequest(requestParameters) {
|
|
838
|
-
return this.tradeApi.sendQuoteRequest(requestParameters);
|
|
663
|
+
});
|
|
664
|
+
Object.defineProperty(exports, 'TooManyRequestsError', {
|
|
665
|
+
enumerable: true,
|
|
666
|
+
get: function () {
|
|
667
|
+
return __binance_common.TooManyRequestsError;
|
|
839
668
|
}
|
|
840
|
-
};
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
const userAgent = (0, import_common4.buildUserAgent)(name, version);
|
|
846
|
-
if (config?.configurationRestAPI) {
|
|
847
|
-
const configRestAPI = new import_common4.ConfigurationRestAPI(
|
|
848
|
-
config.configurationRestAPI
|
|
849
|
-
);
|
|
850
|
-
configRestAPI.basePath = configRestAPI.basePath || import_common4.CONVERT_REST_API_PROD_URL;
|
|
851
|
-
configRestAPI.baseOptions = configRestAPI.baseOptions || {};
|
|
852
|
-
configRestAPI.baseOptions.headers = {
|
|
853
|
-
...configRestAPI.baseOptions.headers || {},
|
|
854
|
-
"User-Agent": userAgent
|
|
855
|
-
};
|
|
856
|
-
this.restAPI = new RestAPI(configRestAPI);
|
|
857
|
-
}
|
|
669
|
+
});
|
|
670
|
+
Object.defineProperty(exports, 'UnauthorizedError', {
|
|
671
|
+
enumerable: true,
|
|
672
|
+
get: function () {
|
|
673
|
+
return __binance_common.UnauthorizedError;
|
|
858
674
|
}
|
|
859
|
-
};
|
|
860
|
-
|
|
861
|
-
// src/index.ts
|
|
862
|
-
var import_common5 = require("@binance/common");
|
|
863
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
864
|
-
0 && (module.exports = {
|
|
865
|
-
BadRequestError,
|
|
866
|
-
CONVERT_REST_API_PROD_URL,
|
|
867
|
-
ConnectorClientError,
|
|
868
|
-
Convert,
|
|
869
|
-
ConvertRestAPI,
|
|
870
|
-
ForbiddenError,
|
|
871
|
-
NetworkError,
|
|
872
|
-
NotFoundError,
|
|
873
|
-
RateLimitBanError,
|
|
874
|
-
RequiredError,
|
|
875
|
-
ServerError,
|
|
876
|
-
TooManyRequestsError,
|
|
877
|
-
UnauthorizedError
|
|
878
675
|
});
|
|
879
676
|
//# sourceMappingURL=index.js.map
|