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