@binance/crypto-loan 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/dist/index.js ADDED
@@ -0,0 +1,2278 @@
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
+ CRYPTO_LOAN_REST_API_PROD_URL: () => import_common5.CRYPTO_LOAN_REST_API_PROD_URL,
25
+ CRYPTO_LOAN_REST_API_TESTNET_URL: () => import_common5.CRYPTO_LOAN_REST_API_TESTNET_URL,
26
+ ConnectorClientError: () => import_common5.ConnectorClientError,
27
+ CryptoLoan: () => CryptoLoan,
28
+ CryptoLoanRestAPI: () => 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/crypto-loan.ts
41
+ var import_os = require("os");
42
+ var import_common4 = require("@binance/common");
43
+
44
+ // package.json
45
+ var name = "@binance/crypto-loan";
46
+ var version = "1.0.0";
47
+
48
+ // src/rest-api/index.ts
49
+ var rest_api_exports = {};
50
+ __export(rest_api_exports, {
51
+ FlexibleRateApi: () => FlexibleRateApi,
52
+ RestAPI: () => RestAPI,
53
+ StableRateApi: () => StableRateApi
54
+ });
55
+
56
+ // src/rest-api/modules/flexible-rate-api.ts
57
+ var import_common = require("@binance/common");
58
+ var FlexibleRateApiAxiosParamCreator = function(configuration) {
59
+ return {
60
+ /**
61
+ *
62
+ * Weight: 6000
63
+ *
64
+ * @summary Check Collateral Repay Rate (USER_DATA)
65
+ * @param {string} loanCoin
66
+ * @param {string} collateralCoin
67
+ * @param {number} [recvWindow]
68
+ *
69
+ * @throws {RequiredError}
70
+ */
71
+ checkCollateralRepayRate: async (loanCoin, collateralCoin, recvWindow) => {
72
+ (0, import_common.assertParamExists)("checkCollateralRepayRate", "loanCoin", loanCoin);
73
+ (0, import_common.assertParamExists)("checkCollateralRepayRate", "collateralCoin", collateralCoin);
74
+ const localVarQueryParameter = {};
75
+ if (loanCoin !== void 0 && loanCoin !== null) {
76
+ localVarQueryParameter["loanCoin"] = loanCoin;
77
+ }
78
+ if (collateralCoin !== void 0 && collateralCoin !== null) {
79
+ localVarQueryParameter["collateralCoin"] = collateralCoin;
80
+ }
81
+ if (recvWindow !== void 0 && recvWindow !== null) {
82
+ localVarQueryParameter["recvWindow"] = recvWindow;
83
+ }
84
+ let _timeUnit;
85
+ if ("timeUnit" in configuration)
86
+ _timeUnit = configuration.timeUnit;
87
+ return {
88
+ endpoint: "/sapi/v2/loan/flexible/repay/rate",
89
+ method: "GET",
90
+ params: localVarQueryParameter,
91
+ timeUnit: _timeUnit
92
+ };
93
+ },
94
+ /**
95
+ * Flexible Loan Adjust LTV
96
+ *
97
+ * API Key needs Spot & Margin Trading permission for this endpoint
98
+ *
99
+ * Weight: 6000
100
+ *
101
+ * @summary Flexible Loan Adjust LTV(TRADE)
102
+ * @param {string} loanCoin
103
+ * @param {string} collateralCoin
104
+ * @param {number} adjustmentAmount
105
+ * @param {string} direction "ADDITIONAL", "REDUCED"
106
+ * @param {number} [recvWindow]
107
+ *
108
+ * @throws {RequiredError}
109
+ */
110
+ flexibleLoanAdjustLtv: async (loanCoin, collateralCoin, adjustmentAmount, direction, recvWindow) => {
111
+ (0, import_common.assertParamExists)("flexibleLoanAdjustLtv", "loanCoin", loanCoin);
112
+ (0, import_common.assertParamExists)("flexibleLoanAdjustLtv", "collateralCoin", collateralCoin);
113
+ (0, import_common.assertParamExists)("flexibleLoanAdjustLtv", "adjustmentAmount", adjustmentAmount);
114
+ (0, import_common.assertParamExists)("flexibleLoanAdjustLtv", "direction", direction);
115
+ const localVarQueryParameter = {};
116
+ if (loanCoin !== void 0 && loanCoin !== null) {
117
+ localVarQueryParameter["loanCoin"] = loanCoin;
118
+ }
119
+ if (collateralCoin !== void 0 && collateralCoin !== null) {
120
+ localVarQueryParameter["collateralCoin"] = collateralCoin;
121
+ }
122
+ if (adjustmentAmount !== void 0 && adjustmentAmount !== null) {
123
+ localVarQueryParameter["adjustmentAmount"] = adjustmentAmount;
124
+ }
125
+ if (direction !== void 0 && direction !== null) {
126
+ localVarQueryParameter["direction"] = direction;
127
+ }
128
+ if (recvWindow !== void 0 && recvWindow !== null) {
129
+ localVarQueryParameter["recvWindow"] = recvWindow;
130
+ }
131
+ let _timeUnit;
132
+ if ("timeUnit" in configuration)
133
+ _timeUnit = configuration.timeUnit;
134
+ return {
135
+ endpoint: "/sapi/v2/loan/flexible/adjust/ltv",
136
+ method: "POST",
137
+ params: localVarQueryParameter,
138
+ timeUnit: _timeUnit
139
+ };
140
+ },
141
+ /**
142
+ * Borrow Flexible Loan
143
+ *
144
+ *
145
+ * Only available for master account
146
+ * You can customize LTV by entering loanAmount and collateralAmount.
147
+ *
148
+ * Weight: 6000
149
+ *
150
+ * @summary Flexible Loan Borrow(TRADE)
151
+ * @param {string} loanCoin
152
+ * @param {string} collateralCoin
153
+ * @param {number} [recvWindow]
154
+ *
155
+ * @throws {RequiredError}
156
+ */
157
+ flexibleLoanBorrow: async (loanCoin, collateralCoin, recvWindow) => {
158
+ (0, import_common.assertParamExists)("flexibleLoanBorrow", "loanCoin", loanCoin);
159
+ (0, import_common.assertParamExists)("flexibleLoanBorrow", "collateralCoin", collateralCoin);
160
+ const localVarQueryParameter = {};
161
+ if (loanCoin !== void 0 && loanCoin !== null) {
162
+ localVarQueryParameter["loanCoin"] = loanCoin;
163
+ }
164
+ if (collateralCoin !== void 0 && collateralCoin !== null) {
165
+ localVarQueryParameter["collateralCoin"] = collateralCoin;
166
+ }
167
+ if (recvWindow !== void 0 && recvWindow !== null) {
168
+ localVarQueryParameter["recvWindow"] = recvWindow;
169
+ }
170
+ let _timeUnit;
171
+ if ("timeUnit" in configuration)
172
+ _timeUnit = configuration.timeUnit;
173
+ return {
174
+ endpoint: "/sapi/v2/loan/flexible/borrow",
175
+ method: "POST",
176
+ params: localVarQueryParameter,
177
+ timeUnit: _timeUnit
178
+ };
179
+ },
180
+ /**
181
+ *
182
+ * Weight: 6000
183
+ *
184
+ * @summary Flexible Loan Collateral Repayment (TRADE)
185
+ * @param {string} loanCoin
186
+ * @param {string} collateralCoin
187
+ * @param {number} repayAmount repay amount of loanCoin
188
+ * @param {boolean} [fullRepayment] Default: FALSE. TRUE: Full repayment; FALSE: Partial repayment, based on loanAmount
189
+ * @param {number} [recvWindow]
190
+ *
191
+ * @throws {RequiredError}
192
+ */
193
+ flexibleLoanCollateralRepayment: async (loanCoin, collateralCoin, repayAmount, fullRepayment, recvWindow) => {
194
+ (0, import_common.assertParamExists)("flexibleLoanCollateralRepayment", "loanCoin", loanCoin);
195
+ (0, import_common.assertParamExists)("flexibleLoanCollateralRepayment", "collateralCoin", collateralCoin);
196
+ (0, import_common.assertParamExists)("flexibleLoanCollateralRepayment", "repayAmount", repayAmount);
197
+ const localVarQueryParameter = {};
198
+ if (loanCoin !== void 0 && loanCoin !== null) {
199
+ localVarQueryParameter["loanCoin"] = loanCoin;
200
+ }
201
+ if (collateralCoin !== void 0 && collateralCoin !== null) {
202
+ localVarQueryParameter["collateralCoin"] = collateralCoin;
203
+ }
204
+ if (repayAmount !== void 0 && repayAmount !== null) {
205
+ localVarQueryParameter["repayAmount"] = repayAmount;
206
+ }
207
+ if (fullRepayment !== void 0 && fullRepayment !== null) {
208
+ localVarQueryParameter["fullRepayment"] = fullRepayment;
209
+ }
210
+ if (recvWindow !== void 0 && recvWindow !== null) {
211
+ localVarQueryParameter["recvWindow"] = recvWindow;
212
+ }
213
+ let _timeUnit;
214
+ if ("timeUnit" in configuration)
215
+ _timeUnit = configuration.timeUnit;
216
+ return {
217
+ endpoint: "/sapi/v2/loan/flexible/repay/collateral",
218
+ method: "POST",
219
+ params: localVarQueryParameter,
220
+ timeUnit: _timeUnit
221
+ };
222
+ },
223
+ /**
224
+ * Flexible Loan Repay
225
+ *
226
+ *
227
+ * repayAmount is mandatory even fullRepayment = FALSE
228
+ *
229
+ * Weight: 6000
230
+ *
231
+ * @summary Flexible Loan Repay(TRADE)
232
+ * @param {string} loanCoin
233
+ * @param {string} collateralCoin
234
+ * @param {number} repayAmount repay amount of loanCoin
235
+ * @param {boolean} [collateralReturn] Default: TRUE. TRUE: Return extra collateral to spot account; FALSE: Keep extra collateral in the order, and lower LTV.
236
+ * @param {boolean} [fullRepayment] Default: FALSE. TRUE: Full repayment; FALSE: Partial repayment, based on loanAmount
237
+ * @param {number} [recvWindow]
238
+ *
239
+ * @throws {RequiredError}
240
+ */
241
+ flexibleLoanRepay: async (loanCoin, collateralCoin, repayAmount, collateralReturn, fullRepayment, recvWindow) => {
242
+ (0, import_common.assertParamExists)("flexibleLoanRepay", "loanCoin", loanCoin);
243
+ (0, import_common.assertParamExists)("flexibleLoanRepay", "collateralCoin", collateralCoin);
244
+ (0, import_common.assertParamExists)("flexibleLoanRepay", "repayAmount", repayAmount);
245
+ const localVarQueryParameter = {};
246
+ if (loanCoin !== void 0 && loanCoin !== null) {
247
+ localVarQueryParameter["loanCoin"] = loanCoin;
248
+ }
249
+ if (collateralCoin !== void 0 && collateralCoin !== null) {
250
+ localVarQueryParameter["collateralCoin"] = collateralCoin;
251
+ }
252
+ if (repayAmount !== void 0 && repayAmount !== null) {
253
+ localVarQueryParameter["repayAmount"] = repayAmount;
254
+ }
255
+ if (collateralReturn !== void 0 && collateralReturn !== null) {
256
+ localVarQueryParameter["collateralReturn"] = collateralReturn;
257
+ }
258
+ if (fullRepayment !== void 0 && fullRepayment !== null) {
259
+ localVarQueryParameter["fullRepayment"] = fullRepayment;
260
+ }
261
+ if (recvWindow !== void 0 && recvWindow !== null) {
262
+ localVarQueryParameter["recvWindow"] = recvWindow;
263
+ }
264
+ let _timeUnit;
265
+ if ("timeUnit" in configuration)
266
+ _timeUnit = configuration.timeUnit;
267
+ return {
268
+ endpoint: "/sapi/v2/loan/flexible/repay",
269
+ method: "POST",
270
+ params: localVarQueryParameter,
271
+ timeUnit: _timeUnit
272
+ };
273
+ },
274
+ /**
275
+ * Get interest rate and borrow limit of flexible loanable assets. The borrow limit is shown in USD value.
276
+ *
277
+ * Weight: 400
278
+ *
279
+ * @summary Get Flexible Loan Assets Data(USER_DATA)
280
+ * @param {string} [loanCoin]
281
+ * @param {number} [recvWindow]
282
+ *
283
+ * @throws {RequiredError}
284
+ */
285
+ getFlexibleLoanAssetsData: async (loanCoin, recvWindow) => {
286
+ const localVarQueryParameter = {};
287
+ if (loanCoin !== void 0 && loanCoin !== null) {
288
+ localVarQueryParameter["loanCoin"] = loanCoin;
289
+ }
290
+ if (recvWindow !== void 0 && recvWindow !== null) {
291
+ localVarQueryParameter["recvWindow"] = recvWindow;
292
+ }
293
+ let _timeUnit;
294
+ if ("timeUnit" in configuration)
295
+ _timeUnit = configuration.timeUnit;
296
+ return {
297
+ endpoint: "/sapi/v2/loan/flexible/loanable/data",
298
+ method: "GET",
299
+ params: localVarQueryParameter,
300
+ timeUnit: _timeUnit
301
+ };
302
+ },
303
+ /**
304
+ * Get Flexible Loan Borrow History
305
+ *
306
+ * If startTime and endTime are not sent, the recent 90-day data will be returned.
307
+ * The max interval between startTime and endTime is 180 days.
308
+ *
309
+ * Weight: 400
310
+ *
311
+ * @summary Get Flexible Loan Borrow History(USER_DATA)
312
+ * @param {string} [loanCoin]
313
+ * @param {string} [collateralCoin]
314
+ * @param {number} [startTime]
315
+ * @param {number} [endTime]
316
+ * @param {number} [current] Current querying page. Start from 1; default: 1; max: 1000
317
+ * @param {number} [limit] Default: 10; max: 100
318
+ * @param {number} [recvWindow]
319
+ *
320
+ * @throws {RequiredError}
321
+ */
322
+ getFlexibleLoanBorrowHistory: async (loanCoin, collateralCoin, startTime, endTime, current, limit, recvWindow) => {
323
+ const localVarQueryParameter = {};
324
+ if (loanCoin !== void 0 && loanCoin !== null) {
325
+ localVarQueryParameter["loanCoin"] = loanCoin;
326
+ }
327
+ if (collateralCoin !== void 0 && collateralCoin !== null) {
328
+ localVarQueryParameter["collateralCoin"] = collateralCoin;
329
+ }
330
+ if (startTime !== void 0 && startTime !== null) {
331
+ localVarQueryParameter["startTime"] = startTime;
332
+ }
333
+ if (endTime !== void 0 && endTime !== null) {
334
+ localVarQueryParameter["endTime"] = endTime;
335
+ }
336
+ if (current !== void 0 && current !== null) {
337
+ localVarQueryParameter["current"] = current;
338
+ }
339
+ if (limit !== void 0 && limit !== null) {
340
+ localVarQueryParameter["limit"] = limit;
341
+ }
342
+ if (recvWindow !== void 0 && recvWindow !== null) {
343
+ localVarQueryParameter["recvWindow"] = recvWindow;
344
+ }
345
+ let _timeUnit;
346
+ if ("timeUnit" in configuration)
347
+ _timeUnit = configuration.timeUnit;
348
+ return {
349
+ endpoint: "/sapi/v2/loan/flexible/borrow/history",
350
+ method: "GET",
351
+ params: localVarQueryParameter,
352
+ timeUnit: _timeUnit
353
+ };
354
+ },
355
+ /**
356
+ * Get LTV information and collateral limit of flexible loan's collateral assets. The collateral limit is shown in USD value.
357
+ *
358
+ * Weight: 400
359
+ *
360
+ * @summary Get Flexible Loan Collateral Assets Data(USER_DATA)
361
+ * @param {string} [collateralCoin]
362
+ * @param {number} [recvWindow]
363
+ *
364
+ * @throws {RequiredError}
365
+ */
366
+ getFlexibleLoanCollateralAssetsData: async (collateralCoin, recvWindow) => {
367
+ const localVarQueryParameter = {};
368
+ if (collateralCoin !== void 0 && collateralCoin !== null) {
369
+ localVarQueryParameter["collateralCoin"] = collateralCoin;
370
+ }
371
+ if (recvWindow !== void 0 && recvWindow !== null) {
372
+ localVarQueryParameter["recvWindow"] = recvWindow;
373
+ }
374
+ let _timeUnit;
375
+ if ("timeUnit" in configuration)
376
+ _timeUnit = configuration.timeUnit;
377
+ return {
378
+ endpoint: "/sapi/v2/loan/flexible/collateral/data",
379
+ method: "GET",
380
+ params: localVarQueryParameter,
381
+ timeUnit: _timeUnit
382
+ };
383
+ },
384
+ /**
385
+ *
386
+ * Weight: 400
387
+ *
388
+ * @summary Get Flexible Loan Liquidation History (USER_DATA)
389
+ * @param {string} [loanCoin]
390
+ * @param {string} [collateralCoin]
391
+ * @param {number} [startTime]
392
+ * @param {number} [endTime]
393
+ * @param {number} [current] Current querying page. Start from 1; default: 1; max: 1000
394
+ * @param {number} [limit] Default: 10; max: 100
395
+ * @param {number} [recvWindow]
396
+ *
397
+ * @throws {RequiredError}
398
+ */
399
+ getFlexibleLoanLiquidationHistory: async (loanCoin, collateralCoin, startTime, endTime, current, limit, recvWindow) => {
400
+ const localVarQueryParameter = {};
401
+ if (loanCoin !== void 0 && loanCoin !== null) {
402
+ localVarQueryParameter["loanCoin"] = loanCoin;
403
+ }
404
+ if (collateralCoin !== void 0 && collateralCoin !== null) {
405
+ localVarQueryParameter["collateralCoin"] = collateralCoin;
406
+ }
407
+ if (startTime !== void 0 && startTime !== null) {
408
+ localVarQueryParameter["startTime"] = startTime;
409
+ }
410
+ if (endTime !== void 0 && endTime !== null) {
411
+ localVarQueryParameter["endTime"] = endTime;
412
+ }
413
+ if (current !== void 0 && current !== null) {
414
+ localVarQueryParameter["current"] = current;
415
+ }
416
+ if (limit !== void 0 && limit !== null) {
417
+ localVarQueryParameter["limit"] = limit;
418
+ }
419
+ if (recvWindow !== void 0 && recvWindow !== null) {
420
+ localVarQueryParameter["recvWindow"] = recvWindow;
421
+ }
422
+ let _timeUnit;
423
+ if ("timeUnit" in configuration)
424
+ _timeUnit = configuration.timeUnit;
425
+ return {
426
+ endpoint: "/sapi/v2/loan/flexible/liquidation/history",
427
+ method: "GET",
428
+ params: localVarQueryParameter,
429
+ timeUnit: _timeUnit
430
+ };
431
+ },
432
+ /**
433
+ * Get Flexible Loan LTV Adjustment History
434
+ *
435
+ * If startTime and endTime are not sent, the recent 90-day data will be returned.
436
+ * The max interval between startTime and endTime is 180 days.
437
+ *
438
+ * Weight: 400
439
+ *
440
+ * @summary Get Flexible Loan LTV Adjustment History(USER_DATA)
441
+ * @param {string} [loanCoin]
442
+ * @param {string} [collateralCoin]
443
+ * @param {number} [startTime]
444
+ * @param {number} [endTime]
445
+ * @param {number} [current] Current querying page. Start from 1; default: 1; max: 1000
446
+ * @param {number} [limit] Default: 10; max: 100
447
+ * @param {number} [recvWindow]
448
+ *
449
+ * @throws {RequiredError}
450
+ */
451
+ getFlexibleLoanLtvAdjustmentHistory: async (loanCoin, collateralCoin, startTime, endTime, current, limit, recvWindow) => {
452
+ const localVarQueryParameter = {};
453
+ if (loanCoin !== void 0 && loanCoin !== null) {
454
+ localVarQueryParameter["loanCoin"] = loanCoin;
455
+ }
456
+ if (collateralCoin !== void 0 && collateralCoin !== null) {
457
+ localVarQueryParameter["collateralCoin"] = collateralCoin;
458
+ }
459
+ if (startTime !== void 0 && startTime !== null) {
460
+ localVarQueryParameter["startTime"] = startTime;
461
+ }
462
+ if (endTime !== void 0 && endTime !== null) {
463
+ localVarQueryParameter["endTime"] = endTime;
464
+ }
465
+ if (current !== void 0 && current !== null) {
466
+ localVarQueryParameter["current"] = current;
467
+ }
468
+ if (limit !== void 0 && limit !== null) {
469
+ localVarQueryParameter["limit"] = limit;
470
+ }
471
+ if (recvWindow !== void 0 && recvWindow !== null) {
472
+ localVarQueryParameter["recvWindow"] = recvWindow;
473
+ }
474
+ let _timeUnit;
475
+ if ("timeUnit" in configuration)
476
+ _timeUnit = configuration.timeUnit;
477
+ return {
478
+ endpoint: "/sapi/v2/loan/flexible/ltv/adjustment/history",
479
+ method: "GET",
480
+ params: localVarQueryParameter,
481
+ timeUnit: _timeUnit
482
+ };
483
+ },
484
+ /**
485
+ * Get Flexible Loan Ongoing Orders
486
+ *
487
+ * Weight: 300
488
+ *
489
+ * @summary Get Flexible Loan Ongoing Orders(USER_DATA)
490
+ * @param {string} [loanCoin]
491
+ * @param {string} [collateralCoin]
492
+ * @param {number} [current] Current querying page. Start from 1; default: 1; max: 1000
493
+ * @param {number} [limit] Default: 10; max: 100
494
+ * @param {number} [recvWindow]
495
+ *
496
+ * @throws {RequiredError}
497
+ */
498
+ getFlexibleLoanOngoingOrders: async (loanCoin, collateralCoin, current, limit, recvWindow) => {
499
+ const localVarQueryParameter = {};
500
+ if (loanCoin !== void 0 && loanCoin !== null) {
501
+ localVarQueryParameter["loanCoin"] = loanCoin;
502
+ }
503
+ if (collateralCoin !== void 0 && collateralCoin !== null) {
504
+ localVarQueryParameter["collateralCoin"] = collateralCoin;
505
+ }
506
+ if (current !== void 0 && current !== null) {
507
+ localVarQueryParameter["current"] = current;
508
+ }
509
+ if (limit !== void 0 && limit !== null) {
510
+ localVarQueryParameter["limit"] = limit;
511
+ }
512
+ if (recvWindow !== void 0 && recvWindow !== null) {
513
+ localVarQueryParameter["recvWindow"] = recvWindow;
514
+ }
515
+ let _timeUnit;
516
+ if ("timeUnit" in configuration)
517
+ _timeUnit = configuration.timeUnit;
518
+ return {
519
+ endpoint: "/sapi/v2/loan/flexible/ongoing/orders",
520
+ method: "GET",
521
+ params: localVarQueryParameter,
522
+ timeUnit: _timeUnit
523
+ };
524
+ },
525
+ /**
526
+ * Get Flexible Loan Repayment History
527
+ *
528
+ * If startTime and endTime are not sent, the recent 90-day data will be returned.
529
+ * The max interval between startTime and endTime is 180 days.
530
+ *
531
+ * Weight: 400
532
+ *
533
+ * @summary Get Flexible Loan Repayment History(USER_DATA)
534
+ * @param {string} [loanCoin]
535
+ * @param {string} [collateralCoin]
536
+ * @param {number} [startTime]
537
+ * @param {number} [endTime]
538
+ * @param {number} [current] Current querying page. Start from 1; default: 1; max: 1000
539
+ * @param {number} [limit] Default: 10; max: 100
540
+ * @param {number} [recvWindow]
541
+ *
542
+ * @throws {RequiredError}
543
+ */
544
+ getFlexibleLoanRepaymentHistory: async (loanCoin, collateralCoin, startTime, endTime, current, limit, recvWindow) => {
545
+ const localVarQueryParameter = {};
546
+ if (loanCoin !== void 0 && loanCoin !== null) {
547
+ localVarQueryParameter["loanCoin"] = loanCoin;
548
+ }
549
+ if (collateralCoin !== void 0 && collateralCoin !== null) {
550
+ localVarQueryParameter["collateralCoin"] = collateralCoin;
551
+ }
552
+ if (startTime !== void 0 && startTime !== null) {
553
+ localVarQueryParameter["startTime"] = startTime;
554
+ }
555
+ if (endTime !== void 0 && endTime !== null) {
556
+ localVarQueryParameter["endTime"] = endTime;
557
+ }
558
+ if (current !== void 0 && current !== null) {
559
+ localVarQueryParameter["current"] = current;
560
+ }
561
+ if (limit !== void 0 && limit !== null) {
562
+ localVarQueryParameter["limit"] = limit;
563
+ }
564
+ if (recvWindow !== void 0 && recvWindow !== null) {
565
+ localVarQueryParameter["recvWindow"] = recvWindow;
566
+ }
567
+ let _timeUnit;
568
+ if ("timeUnit" in configuration)
569
+ _timeUnit = configuration.timeUnit;
570
+ return {
571
+ endpoint: "/sapi/v2/loan/flexible/repay/history",
572
+ method: "GET",
573
+ params: localVarQueryParameter,
574
+ timeUnit: _timeUnit
575
+ };
576
+ }
577
+ };
578
+ };
579
+ var FlexibleRateApi = class {
580
+ constructor(configuration) {
581
+ this.configuration = configuration;
582
+ this.localVarAxiosParamCreator = FlexibleRateApiAxiosParamCreator(configuration);
583
+ }
584
+ /**
585
+ *
586
+ * Weight: 6000
587
+ *
588
+ * @summary Check Collateral Repay Rate (USER_DATA)
589
+ * @param {CheckCollateralRepayRateRequest} requestParameters Request parameters.
590
+ * @returns {Promise<RestApiResponse<CheckCollateralRepayRateResponse>>}
591
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
592
+ * @memberof FlexibleRateApi
593
+ * @see {@link https://developers.binance.com/docs/crypto_loan/flexible-rate/user-information/Check-Collateral-Repay-Rate Binance API Documentation}
594
+ */
595
+ async checkCollateralRepayRate(requestParameters) {
596
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.checkCollateralRepayRate(
597
+ requestParameters?.loanCoin,
598
+ requestParameters?.collateralCoin,
599
+ requestParameters?.recvWindow
600
+ );
601
+ return (0, import_common.sendRequest)(
602
+ this.configuration,
603
+ localVarAxiosArgs.endpoint,
604
+ localVarAxiosArgs.method,
605
+ localVarAxiosArgs.params,
606
+ localVarAxiosArgs?.timeUnit,
607
+ { isSigned: true }
608
+ );
609
+ }
610
+ /**
611
+ * Flexible Loan Adjust LTV
612
+ *
613
+ * API Key needs Spot & Margin Trading permission for this endpoint
614
+ *
615
+ * Weight: 6000
616
+ *
617
+ * @summary Flexible Loan Adjust LTV(TRADE)
618
+ * @param {FlexibleLoanAdjustLtvRequest} requestParameters Request parameters.
619
+ * @returns {Promise<RestApiResponse<FlexibleLoanAdjustLtvResponse>>}
620
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
621
+ * @memberof FlexibleRateApi
622
+ * @see {@link https://developers.binance.com/docs/crypto_loan/flexible-rate/trade/Flexible-Loan-Adjust-LTV Binance API Documentation}
623
+ */
624
+ async flexibleLoanAdjustLtv(requestParameters) {
625
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.flexibleLoanAdjustLtv(
626
+ requestParameters?.loanCoin,
627
+ requestParameters?.collateralCoin,
628
+ requestParameters?.adjustmentAmount,
629
+ requestParameters?.direction,
630
+ requestParameters?.recvWindow
631
+ );
632
+ return (0, import_common.sendRequest)(
633
+ this.configuration,
634
+ localVarAxiosArgs.endpoint,
635
+ localVarAxiosArgs.method,
636
+ localVarAxiosArgs.params,
637
+ localVarAxiosArgs?.timeUnit,
638
+ { isSigned: true }
639
+ );
640
+ }
641
+ /**
642
+ * Borrow Flexible Loan
643
+ *
644
+ *
645
+ * Only available for master account
646
+ * You can customize LTV by entering loanAmount and collateralAmount.
647
+ *
648
+ * Weight: 6000
649
+ *
650
+ * @summary Flexible Loan Borrow(TRADE)
651
+ * @param {FlexibleLoanBorrowRequest} requestParameters Request parameters.
652
+ * @returns {Promise<RestApiResponse<FlexibleLoanBorrowResponse>>}
653
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
654
+ * @memberof FlexibleRateApi
655
+ * @see {@link https://developers.binance.com/docs/crypto_loan/flexible-rate/trade/Flexible-Loan-Borrow Binance API Documentation}
656
+ */
657
+ async flexibleLoanBorrow(requestParameters) {
658
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.flexibleLoanBorrow(
659
+ requestParameters?.loanCoin,
660
+ requestParameters?.collateralCoin,
661
+ requestParameters?.recvWindow
662
+ );
663
+ return (0, import_common.sendRequest)(
664
+ this.configuration,
665
+ localVarAxiosArgs.endpoint,
666
+ localVarAxiosArgs.method,
667
+ localVarAxiosArgs.params,
668
+ localVarAxiosArgs?.timeUnit,
669
+ { isSigned: true }
670
+ );
671
+ }
672
+ /**
673
+ *
674
+ * Weight: 6000
675
+ *
676
+ * @summary Flexible Loan Collateral Repayment (TRADE)
677
+ * @param {FlexibleLoanCollateralRepaymentRequest} requestParameters Request parameters.
678
+ * @returns {Promise<RestApiResponse<FlexibleLoanCollateralRepaymentResponse>>}
679
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
680
+ * @memberof FlexibleRateApi
681
+ * @see {@link https://developers.binance.com/docs/crypto_loan/flexible-rate/trade/Flexible-Loan-Collateral-Repay Binance API Documentation}
682
+ */
683
+ async flexibleLoanCollateralRepayment(requestParameters) {
684
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.flexibleLoanCollateralRepayment(
685
+ requestParameters?.loanCoin,
686
+ requestParameters?.collateralCoin,
687
+ requestParameters?.repayAmount,
688
+ requestParameters?.fullRepayment,
689
+ requestParameters?.recvWindow
690
+ );
691
+ return (0, import_common.sendRequest)(
692
+ this.configuration,
693
+ localVarAxiosArgs.endpoint,
694
+ localVarAxiosArgs.method,
695
+ localVarAxiosArgs.params,
696
+ localVarAxiosArgs?.timeUnit,
697
+ { isSigned: true }
698
+ );
699
+ }
700
+ /**
701
+ * Flexible Loan Repay
702
+ *
703
+ *
704
+ * repayAmount is mandatory even fullRepayment = FALSE
705
+ *
706
+ * Weight: 6000
707
+ *
708
+ * @summary Flexible Loan Repay(TRADE)
709
+ * @param {FlexibleLoanRepayRequest} requestParameters Request parameters.
710
+ * @returns {Promise<RestApiResponse<FlexibleLoanRepayResponse>>}
711
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
712
+ * @memberof FlexibleRateApi
713
+ * @see {@link https://developers.binance.com/docs/crypto_loan/flexible-rate/trade/Flexible-Loan-Repay Binance API Documentation}
714
+ */
715
+ async flexibleLoanRepay(requestParameters) {
716
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.flexibleLoanRepay(
717
+ requestParameters?.loanCoin,
718
+ requestParameters?.collateralCoin,
719
+ requestParameters?.repayAmount,
720
+ requestParameters?.collateralReturn,
721
+ requestParameters?.fullRepayment,
722
+ requestParameters?.recvWindow
723
+ );
724
+ return (0, import_common.sendRequest)(
725
+ this.configuration,
726
+ localVarAxiosArgs.endpoint,
727
+ localVarAxiosArgs.method,
728
+ localVarAxiosArgs.params,
729
+ localVarAxiosArgs?.timeUnit,
730
+ { isSigned: true }
731
+ );
732
+ }
733
+ /**
734
+ * Get interest rate and borrow limit of flexible loanable assets. The borrow limit is shown in USD value.
735
+ *
736
+ * Weight: 400
737
+ *
738
+ * @summary Get Flexible Loan Assets Data(USER_DATA)
739
+ * @param {GetFlexibleLoanAssetsDataRequest} requestParameters Request parameters.
740
+ * @returns {Promise<RestApiResponse<GetFlexibleLoanAssetsDataResponse>>}
741
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
742
+ * @memberof FlexibleRateApi
743
+ * @see {@link https://developers.binance.com/docs/crypto_loan/flexible-rate/market-data/Get-Flexible-Loan-Assets-Data Binance API Documentation}
744
+ */
745
+ async getFlexibleLoanAssetsData(requestParameters = {}) {
746
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.getFlexibleLoanAssetsData(
747
+ requestParameters?.loanCoin,
748
+ requestParameters?.recvWindow
749
+ );
750
+ return (0, import_common.sendRequest)(
751
+ this.configuration,
752
+ localVarAxiosArgs.endpoint,
753
+ localVarAxiosArgs.method,
754
+ localVarAxiosArgs.params,
755
+ localVarAxiosArgs?.timeUnit,
756
+ { isSigned: true }
757
+ );
758
+ }
759
+ /**
760
+ * Get Flexible Loan Borrow History
761
+ *
762
+ * If startTime and endTime are not sent, the recent 90-day data will be returned.
763
+ * The max interval between startTime and endTime is 180 days.
764
+ *
765
+ * Weight: 400
766
+ *
767
+ * @summary Get Flexible Loan Borrow History(USER_DATA)
768
+ * @param {GetFlexibleLoanBorrowHistoryRequest} requestParameters Request parameters.
769
+ * @returns {Promise<RestApiResponse<GetFlexibleLoanBorrowHistoryResponse>>}
770
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
771
+ * @memberof FlexibleRateApi
772
+ * @see {@link https://developers.binance.com/docs/crypto_loan/flexible-rate/user-information/Get-Flexible-Loan-Borrow-History Binance API Documentation}
773
+ */
774
+ async getFlexibleLoanBorrowHistory(requestParameters = {}) {
775
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.getFlexibleLoanBorrowHistory(
776
+ requestParameters?.loanCoin,
777
+ requestParameters?.collateralCoin,
778
+ requestParameters?.startTime,
779
+ requestParameters?.endTime,
780
+ requestParameters?.current,
781
+ requestParameters?.limit,
782
+ requestParameters?.recvWindow
783
+ );
784
+ return (0, import_common.sendRequest)(
785
+ this.configuration,
786
+ localVarAxiosArgs.endpoint,
787
+ localVarAxiosArgs.method,
788
+ localVarAxiosArgs.params,
789
+ localVarAxiosArgs?.timeUnit,
790
+ { isSigned: true }
791
+ );
792
+ }
793
+ /**
794
+ * Get LTV information and collateral limit of flexible loan's collateral assets. The collateral limit is shown in USD value.
795
+ *
796
+ * Weight: 400
797
+ *
798
+ * @summary Get Flexible Loan Collateral Assets Data(USER_DATA)
799
+ * @param {GetFlexibleLoanCollateralAssetsDataRequest} requestParameters Request parameters.
800
+ * @returns {Promise<RestApiResponse<GetFlexibleLoanCollateralAssetsDataResponse>>}
801
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
802
+ * @memberof FlexibleRateApi
803
+ * @see {@link https://developers.binance.com/docs/crypto_loan/flexible-rate/market-data/Get-Flexible-Loan-Collateral-Assets-Data Binance API Documentation}
804
+ */
805
+ async getFlexibleLoanCollateralAssetsData(requestParameters = {}) {
806
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.getFlexibleLoanCollateralAssetsData(
807
+ requestParameters?.collateralCoin,
808
+ requestParameters?.recvWindow
809
+ );
810
+ return (0, import_common.sendRequest)(
811
+ this.configuration,
812
+ localVarAxiosArgs.endpoint,
813
+ localVarAxiosArgs.method,
814
+ localVarAxiosArgs.params,
815
+ localVarAxiosArgs?.timeUnit,
816
+ { isSigned: true }
817
+ );
818
+ }
819
+ /**
820
+ *
821
+ * Weight: 400
822
+ *
823
+ * @summary Get Flexible Loan Liquidation History (USER_DATA)
824
+ * @param {GetFlexibleLoanLiquidationHistoryRequest} requestParameters Request parameters.
825
+ * @returns {Promise<RestApiResponse<GetFlexibleLoanLiquidationHistoryResponse>>}
826
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
827
+ * @memberof FlexibleRateApi
828
+ * @see {@link https://developers.binance.com/docs/crypto_loan/flexible-rate/user-information/Get-Flexible-Loan-Liquidation-History Binance API Documentation}
829
+ */
830
+ async getFlexibleLoanLiquidationHistory(requestParameters = {}) {
831
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.getFlexibleLoanLiquidationHistory(
832
+ requestParameters?.loanCoin,
833
+ requestParameters?.collateralCoin,
834
+ requestParameters?.startTime,
835
+ requestParameters?.endTime,
836
+ requestParameters?.current,
837
+ requestParameters?.limit,
838
+ requestParameters?.recvWindow
839
+ );
840
+ return (0, import_common.sendRequest)(
841
+ this.configuration,
842
+ localVarAxiosArgs.endpoint,
843
+ localVarAxiosArgs.method,
844
+ localVarAxiosArgs.params,
845
+ localVarAxiosArgs?.timeUnit,
846
+ { isSigned: true }
847
+ );
848
+ }
849
+ /**
850
+ * Get Flexible Loan LTV Adjustment History
851
+ *
852
+ * If startTime and endTime are not sent, the recent 90-day data will be returned.
853
+ * The max interval between startTime and endTime is 180 days.
854
+ *
855
+ * Weight: 400
856
+ *
857
+ * @summary Get Flexible Loan LTV Adjustment History(USER_DATA)
858
+ * @param {GetFlexibleLoanLtvAdjustmentHistoryRequest} requestParameters Request parameters.
859
+ * @returns {Promise<RestApiResponse<GetFlexibleLoanLtvAdjustmentHistoryResponse>>}
860
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
861
+ * @memberof FlexibleRateApi
862
+ * @see {@link https://developers.binance.com/docs/crypto_loan/flexible-rate/user-information/Get-Flexible-Loan-LTV-Adjustment-History Binance API Documentation}
863
+ */
864
+ async getFlexibleLoanLtvAdjustmentHistory(requestParameters = {}) {
865
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.getFlexibleLoanLtvAdjustmentHistory(
866
+ requestParameters?.loanCoin,
867
+ requestParameters?.collateralCoin,
868
+ requestParameters?.startTime,
869
+ requestParameters?.endTime,
870
+ requestParameters?.current,
871
+ requestParameters?.limit,
872
+ requestParameters?.recvWindow
873
+ );
874
+ return (0, import_common.sendRequest)(
875
+ this.configuration,
876
+ localVarAxiosArgs.endpoint,
877
+ localVarAxiosArgs.method,
878
+ localVarAxiosArgs.params,
879
+ localVarAxiosArgs?.timeUnit,
880
+ { isSigned: true }
881
+ );
882
+ }
883
+ /**
884
+ * Get Flexible Loan Ongoing Orders
885
+ *
886
+ * Weight: 300
887
+ *
888
+ * @summary Get Flexible Loan Ongoing Orders(USER_DATA)
889
+ * @param {GetFlexibleLoanOngoingOrdersRequest} requestParameters Request parameters.
890
+ * @returns {Promise<RestApiResponse<GetFlexibleLoanOngoingOrdersResponse>>}
891
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
892
+ * @memberof FlexibleRateApi
893
+ * @see {@link https://developers.binance.com/docs/crypto_loan/flexible-rate/user-information/Get-Flexible-Loan-Ongoing-Orders Binance API Documentation}
894
+ */
895
+ async getFlexibleLoanOngoingOrders(requestParameters = {}) {
896
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.getFlexibleLoanOngoingOrders(
897
+ requestParameters?.loanCoin,
898
+ requestParameters?.collateralCoin,
899
+ requestParameters?.current,
900
+ requestParameters?.limit,
901
+ requestParameters?.recvWindow
902
+ );
903
+ return (0, import_common.sendRequest)(
904
+ this.configuration,
905
+ localVarAxiosArgs.endpoint,
906
+ localVarAxiosArgs.method,
907
+ localVarAxiosArgs.params,
908
+ localVarAxiosArgs?.timeUnit,
909
+ { isSigned: true }
910
+ );
911
+ }
912
+ /**
913
+ * Get Flexible Loan Repayment History
914
+ *
915
+ * If startTime and endTime are not sent, the recent 90-day data will be returned.
916
+ * The max interval between startTime and endTime is 180 days.
917
+ *
918
+ * Weight: 400
919
+ *
920
+ * @summary Get Flexible Loan Repayment History(USER_DATA)
921
+ * @param {GetFlexibleLoanRepaymentHistoryRequest} requestParameters Request parameters.
922
+ * @returns {Promise<RestApiResponse<GetFlexibleLoanRepaymentHistoryResponse>>}
923
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
924
+ * @memberof FlexibleRateApi
925
+ * @see {@link https://developers.binance.com/docs/crypto_loan/flexible-rate/user-information/Get-Flexible-Loan-Repayment-History Binance API Documentation}
926
+ */
927
+ async getFlexibleLoanRepaymentHistory(requestParameters = {}) {
928
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.getFlexibleLoanRepaymentHistory(
929
+ requestParameters?.loanCoin,
930
+ requestParameters?.collateralCoin,
931
+ requestParameters?.startTime,
932
+ requestParameters?.endTime,
933
+ requestParameters?.current,
934
+ requestParameters?.limit,
935
+ requestParameters?.recvWindow
936
+ );
937
+ return (0, import_common.sendRequest)(
938
+ this.configuration,
939
+ localVarAxiosArgs.endpoint,
940
+ localVarAxiosArgs.method,
941
+ localVarAxiosArgs.params,
942
+ localVarAxiosArgs?.timeUnit,
943
+ { isSigned: true }
944
+ );
945
+ }
946
+ };
947
+
948
+ // src/rest-api/modules/stable-rate-api.ts
949
+ var import_common2 = require("@binance/common");
950
+ var StableRateApiAxiosParamCreator = function(configuration) {
951
+ return {
952
+ /**
953
+ * Get the the rate of collateral coin / loan coin when using collateral repay, the rate will be valid within 8 second.
954
+ *
955
+ * Weight: 6000
956
+ *
957
+ * @summary Check Collateral Repay Rate(USER_DATA)
958
+ * @param {string} loanCoin
959
+ * @param {string} collateralCoin
960
+ * @param {number} repayAmount repay amount of loanCoin
961
+ * @param {number} [recvWindow]
962
+ *
963
+ * @throws {RequiredError}
964
+ */
965
+ checkCollateralRepayRateStableRate: async (loanCoin, collateralCoin, repayAmount, recvWindow) => {
966
+ (0, import_common2.assertParamExists)("checkCollateralRepayRateStableRate", "loanCoin", loanCoin);
967
+ (0, import_common2.assertParamExists)(
968
+ "checkCollateralRepayRateStableRate",
969
+ "collateralCoin",
970
+ collateralCoin
971
+ );
972
+ (0, import_common2.assertParamExists)("checkCollateralRepayRateStableRate", "repayAmount", repayAmount);
973
+ const localVarQueryParameter = {};
974
+ if (loanCoin !== void 0 && loanCoin !== null) {
975
+ localVarQueryParameter["loanCoin"] = loanCoin;
976
+ }
977
+ if (collateralCoin !== void 0 && collateralCoin !== null) {
978
+ localVarQueryParameter["collateralCoin"] = collateralCoin;
979
+ }
980
+ if (repayAmount !== void 0 && repayAmount !== null) {
981
+ localVarQueryParameter["repayAmount"] = repayAmount;
982
+ }
983
+ if (recvWindow !== void 0 && recvWindow !== null) {
984
+ localVarQueryParameter["recvWindow"] = recvWindow;
985
+ }
986
+ let _timeUnit;
987
+ if ("timeUnit" in configuration)
988
+ _timeUnit = configuration.timeUnit;
989
+ return {
990
+ endpoint: "/sapi/v1/loan/repay/collateral/rate",
991
+ method: "GET",
992
+ params: localVarQueryParameter,
993
+ timeUnit: _timeUnit
994
+ };
995
+ },
996
+ /**
997
+ * Crypto Loan Adjust LTV
998
+ *
999
+ * Weight: 6000
1000
+ *
1001
+ * @summary Crypto Loan Adjust LTV(TRADE)
1002
+ * @param {number} orderId
1003
+ * @param {number} amount
1004
+ * @param {string} direction "ADDITIONAL", "REDUCED"
1005
+ * @param {number} [recvWindow]
1006
+ *
1007
+ * @throws {RequiredError}
1008
+ */
1009
+ cryptoLoanAdjustLtv: async (orderId, amount, direction, recvWindow) => {
1010
+ (0, import_common2.assertParamExists)("cryptoLoanAdjustLtv", "orderId", orderId);
1011
+ (0, import_common2.assertParamExists)("cryptoLoanAdjustLtv", "amount", amount);
1012
+ (0, import_common2.assertParamExists)("cryptoLoanAdjustLtv", "direction", direction);
1013
+ const localVarQueryParameter = {};
1014
+ if (orderId !== void 0 && orderId !== null) {
1015
+ localVarQueryParameter["orderId"] = orderId;
1016
+ }
1017
+ if (amount !== void 0 && amount !== null) {
1018
+ localVarQueryParameter["amount"] = amount;
1019
+ }
1020
+ if (direction !== void 0 && direction !== null) {
1021
+ localVarQueryParameter["direction"] = direction;
1022
+ }
1023
+ if (recvWindow !== void 0 && recvWindow !== null) {
1024
+ localVarQueryParameter["recvWindow"] = recvWindow;
1025
+ }
1026
+ let _timeUnit;
1027
+ if ("timeUnit" in configuration)
1028
+ _timeUnit = configuration.timeUnit;
1029
+ return {
1030
+ endpoint: "/sapi/v1/loan/adjust/ltv",
1031
+ method: "POST",
1032
+ params: localVarQueryParameter,
1033
+ timeUnit: _timeUnit
1034
+ };
1035
+ },
1036
+ /**
1037
+ * Crypto Loan Borrow
1038
+ *
1039
+ * Weight: 6000
1040
+ *
1041
+ * @summary Crypto Loan Borrow(TRADE)
1042
+ * @param {string} loanCoin
1043
+ * @param {string} collateralCoin
1044
+ * @param {number} loanTerm 7/30 days
1045
+ * @param {number} [recvWindow]
1046
+ *
1047
+ * @throws {RequiredError}
1048
+ */
1049
+ cryptoLoanBorrow: async (loanCoin, collateralCoin, loanTerm, recvWindow) => {
1050
+ (0, import_common2.assertParamExists)("cryptoLoanBorrow", "loanCoin", loanCoin);
1051
+ (0, import_common2.assertParamExists)("cryptoLoanBorrow", "collateralCoin", collateralCoin);
1052
+ (0, import_common2.assertParamExists)("cryptoLoanBorrow", "loanTerm", loanTerm);
1053
+ const localVarQueryParameter = {};
1054
+ if (loanCoin !== void 0 && loanCoin !== null) {
1055
+ localVarQueryParameter["loanCoin"] = loanCoin;
1056
+ }
1057
+ if (collateralCoin !== void 0 && collateralCoin !== null) {
1058
+ localVarQueryParameter["collateralCoin"] = collateralCoin;
1059
+ }
1060
+ if (loanTerm !== void 0 && loanTerm !== null) {
1061
+ localVarQueryParameter["loanTerm"] = loanTerm;
1062
+ }
1063
+ if (recvWindow !== void 0 && recvWindow !== null) {
1064
+ localVarQueryParameter["recvWindow"] = recvWindow;
1065
+ }
1066
+ let _timeUnit;
1067
+ if ("timeUnit" in configuration)
1068
+ _timeUnit = configuration.timeUnit;
1069
+ return {
1070
+ endpoint: "/sapi/v1/loan/borrow",
1071
+ method: "POST",
1072
+ params: localVarQueryParameter,
1073
+ timeUnit: _timeUnit
1074
+ };
1075
+ },
1076
+ /**
1077
+ * Customize Margin Call
1078
+ *
1079
+ * Weight: 6000
1080
+ *
1081
+ * @summary Crypto Loan Customize Margin Call(TRADE)
1082
+ * @param {number} marginCall
1083
+ * @param {number} [recvWindow]
1084
+ *
1085
+ * @throws {RequiredError}
1086
+ */
1087
+ cryptoLoanCustomizeMarginCall: async (marginCall, recvWindow) => {
1088
+ (0, import_common2.assertParamExists)("cryptoLoanCustomizeMarginCall", "marginCall", marginCall);
1089
+ const localVarQueryParameter = {};
1090
+ if (marginCall !== void 0 && marginCall !== null) {
1091
+ localVarQueryParameter["marginCall"] = marginCall;
1092
+ }
1093
+ if (recvWindow !== void 0 && recvWindow !== null) {
1094
+ localVarQueryParameter["recvWindow"] = recvWindow;
1095
+ }
1096
+ let _timeUnit;
1097
+ if ("timeUnit" in configuration)
1098
+ _timeUnit = configuration.timeUnit;
1099
+ return {
1100
+ endpoint: "/sapi/v1/loan/customize/margin_call",
1101
+ method: "POST",
1102
+ params: localVarQueryParameter,
1103
+ timeUnit: _timeUnit
1104
+ };
1105
+ },
1106
+ /**
1107
+ * Crypto Loan Repay
1108
+ *
1109
+ * Weight: 6000
1110
+ *
1111
+ * @summary Crypto Loan Repay(TRADE)
1112
+ * @param {number} orderId
1113
+ * @param {number} amount
1114
+ * @param {number} [type] Default: 1. 1 for "repay with borrowed coin"; 2 for "repay with collateral".
1115
+ * @param {boolean} [collateralReturn] Default: TRUE. TRUE: Return extra collateral to spot account; FALSE: Keep extra collateral in the order, and lower LTV.
1116
+ * @param {number} [recvWindow]
1117
+ *
1118
+ * @throws {RequiredError}
1119
+ */
1120
+ cryptoLoanRepay: async (orderId, amount, type, collateralReturn, recvWindow) => {
1121
+ (0, import_common2.assertParamExists)("cryptoLoanRepay", "orderId", orderId);
1122
+ (0, import_common2.assertParamExists)("cryptoLoanRepay", "amount", amount);
1123
+ const localVarQueryParameter = {};
1124
+ if (orderId !== void 0 && orderId !== null) {
1125
+ localVarQueryParameter["orderId"] = orderId;
1126
+ }
1127
+ if (amount !== void 0 && amount !== null) {
1128
+ localVarQueryParameter["amount"] = amount;
1129
+ }
1130
+ if (type !== void 0 && type !== null) {
1131
+ localVarQueryParameter["type"] = type;
1132
+ }
1133
+ if (collateralReturn !== void 0 && collateralReturn !== null) {
1134
+ localVarQueryParameter["collateralReturn"] = collateralReturn;
1135
+ }
1136
+ if (recvWindow !== void 0 && recvWindow !== null) {
1137
+ localVarQueryParameter["recvWindow"] = recvWindow;
1138
+ }
1139
+ let _timeUnit;
1140
+ if ("timeUnit" in configuration)
1141
+ _timeUnit = configuration.timeUnit;
1142
+ return {
1143
+ endpoint: "/sapi/v1/loan/repay",
1144
+ method: "POST",
1145
+ params: localVarQueryParameter,
1146
+ timeUnit: _timeUnit
1147
+ };
1148
+ },
1149
+ /**
1150
+ * Get LTV information and collateral limit of collateral assets. The collateral limit is shown in USD value.
1151
+ *
1152
+ * Weight: 400
1153
+ *
1154
+ * @summary Get Collateral Assets Data(USER_DATA)
1155
+ * @param {string} [collateralCoin]
1156
+ * @param {number} [vipLevel] Default: user's vip level. Send "-1" to check specified configuration
1157
+ * @param {number} [recvWindow]
1158
+ *
1159
+ * @throws {RequiredError}
1160
+ */
1161
+ getCollateralAssetsData: async (collateralCoin, vipLevel, recvWindow) => {
1162
+ const localVarQueryParameter = {};
1163
+ if (collateralCoin !== void 0 && collateralCoin !== null) {
1164
+ localVarQueryParameter["collateralCoin"] = collateralCoin;
1165
+ }
1166
+ if (vipLevel !== void 0 && vipLevel !== null) {
1167
+ localVarQueryParameter["vipLevel"] = vipLevel;
1168
+ }
1169
+ if (recvWindow !== void 0 && recvWindow !== null) {
1170
+ localVarQueryParameter["recvWindow"] = recvWindow;
1171
+ }
1172
+ let _timeUnit;
1173
+ if ("timeUnit" in configuration)
1174
+ _timeUnit = configuration.timeUnit;
1175
+ return {
1176
+ endpoint: "/sapi/v1/loan/collateral/data",
1177
+ method: "GET",
1178
+ params: localVarQueryParameter,
1179
+ timeUnit: _timeUnit
1180
+ };
1181
+ },
1182
+ /**
1183
+ * Get Crypto Loans Income History
1184
+ *
1185
+ * If startTime and endTime are not sent, the recent 7-day data will be returned.
1186
+ * The max interval between startTime and endTime is 30 days.
1187
+ *
1188
+ * Weight: 6000
1189
+ *
1190
+ * @summary Get Crypto Loans Income History(USER_DATA)
1191
+ * @param {string} [asset]
1192
+ * @param {string} [type] All types will be returned by default. Enum:`borrowIn` ,`collateralSpent`, `repayAmount`, `collateralReturn`(Collateral return after repayment), `addCollateral`, `removeCollateral`, `collateralReturnAfterLiquidation`
1193
+ * @param {number} [startTime]
1194
+ * @param {number} [endTime]
1195
+ * @param {number} [limit] Default: 10; max: 100
1196
+ * @param {number} [recvWindow]
1197
+ *
1198
+ * @throws {RequiredError}
1199
+ */
1200
+ getCryptoLoansIncomeHistory: async (asset, type, startTime, endTime, limit, recvWindow) => {
1201
+ const localVarQueryParameter = {};
1202
+ if (asset !== void 0 && asset !== null) {
1203
+ localVarQueryParameter["asset"] = asset;
1204
+ }
1205
+ if (type !== void 0 && type !== null) {
1206
+ localVarQueryParameter["type"] = type;
1207
+ }
1208
+ if (startTime !== void 0 && startTime !== null) {
1209
+ localVarQueryParameter["startTime"] = startTime;
1210
+ }
1211
+ if (endTime !== void 0 && endTime !== null) {
1212
+ localVarQueryParameter["endTime"] = endTime;
1213
+ }
1214
+ if (limit !== void 0 && limit !== null) {
1215
+ localVarQueryParameter["limit"] = limit;
1216
+ }
1217
+ if (recvWindow !== void 0 && recvWindow !== null) {
1218
+ localVarQueryParameter["recvWindow"] = recvWindow;
1219
+ }
1220
+ let _timeUnit;
1221
+ if ("timeUnit" in configuration)
1222
+ _timeUnit = configuration.timeUnit;
1223
+ return {
1224
+ endpoint: "/sapi/v1/loan/income",
1225
+ method: "GET",
1226
+ params: localVarQueryParameter,
1227
+ timeUnit: _timeUnit
1228
+ };
1229
+ },
1230
+ /**
1231
+ * Get Loan Borrow History
1232
+ *
1233
+ * If startTime and endTime are not sent, the recent 90-day data will be returned.
1234
+ * The max interval between startTime and endTime is 180 days.
1235
+ *
1236
+ * Weight: 400
1237
+ *
1238
+ * @summary Get Loan Borrow History(USER_DATA)
1239
+ * @param {number} [orderId]
1240
+ * @param {string} [loanCoin]
1241
+ * @param {string} [collateralCoin]
1242
+ * @param {number} [startTime]
1243
+ * @param {number} [endTime]
1244
+ * @param {number} [current] Current querying page. Start from 1; default: 1; max: 1000
1245
+ * @param {number} [limit] Default: 10; max: 100
1246
+ * @param {number} [recvWindow]
1247
+ *
1248
+ * @throws {RequiredError}
1249
+ */
1250
+ getLoanBorrowHistory: async (orderId, loanCoin, collateralCoin, startTime, endTime, current, limit, recvWindow) => {
1251
+ const localVarQueryParameter = {};
1252
+ if (orderId !== void 0 && orderId !== null) {
1253
+ localVarQueryParameter["orderId"] = orderId;
1254
+ }
1255
+ if (loanCoin !== void 0 && loanCoin !== null) {
1256
+ localVarQueryParameter["loanCoin"] = loanCoin;
1257
+ }
1258
+ if (collateralCoin !== void 0 && collateralCoin !== null) {
1259
+ localVarQueryParameter["collateralCoin"] = collateralCoin;
1260
+ }
1261
+ if (startTime !== void 0 && startTime !== null) {
1262
+ localVarQueryParameter["startTime"] = startTime;
1263
+ }
1264
+ if (endTime !== void 0 && endTime !== null) {
1265
+ localVarQueryParameter["endTime"] = endTime;
1266
+ }
1267
+ if (current !== void 0 && current !== null) {
1268
+ localVarQueryParameter["current"] = current;
1269
+ }
1270
+ if (limit !== void 0 && limit !== null) {
1271
+ localVarQueryParameter["limit"] = limit;
1272
+ }
1273
+ if (recvWindow !== void 0 && recvWindow !== null) {
1274
+ localVarQueryParameter["recvWindow"] = recvWindow;
1275
+ }
1276
+ let _timeUnit;
1277
+ if ("timeUnit" in configuration)
1278
+ _timeUnit = configuration.timeUnit;
1279
+ return {
1280
+ endpoint: "/sapi/v1/loan/borrow/history",
1281
+ method: "GET",
1282
+ params: localVarQueryParameter,
1283
+ timeUnit: _timeUnit
1284
+ };
1285
+ },
1286
+ /**
1287
+ * Get Loan LTV Adjustment History
1288
+ *
1289
+ * If startTime and endTime are not sent, the recent 90-day data will be returned.
1290
+ * The max interval between startTime and endTime is 180 days.
1291
+ *
1292
+ * Weight: 400
1293
+ *
1294
+ * @summary Get Loan LTV Adjustment History(USER_DATA)
1295
+ * @param {number} [orderId]
1296
+ * @param {string} [loanCoin]
1297
+ * @param {string} [collateralCoin]
1298
+ * @param {number} [startTime]
1299
+ * @param {number} [endTime]
1300
+ * @param {number} [current] Current querying page. Start from 1; default: 1; max: 1000
1301
+ * @param {number} [limit] Default: 10; max: 100
1302
+ * @param {number} [recvWindow]
1303
+ *
1304
+ * @throws {RequiredError}
1305
+ */
1306
+ getLoanLtvAdjustmentHistory: async (orderId, loanCoin, collateralCoin, startTime, endTime, current, limit, recvWindow) => {
1307
+ const localVarQueryParameter = {};
1308
+ if (orderId !== void 0 && orderId !== null) {
1309
+ localVarQueryParameter["orderId"] = orderId;
1310
+ }
1311
+ if (loanCoin !== void 0 && loanCoin !== null) {
1312
+ localVarQueryParameter["loanCoin"] = loanCoin;
1313
+ }
1314
+ if (collateralCoin !== void 0 && collateralCoin !== null) {
1315
+ localVarQueryParameter["collateralCoin"] = collateralCoin;
1316
+ }
1317
+ if (startTime !== void 0 && startTime !== null) {
1318
+ localVarQueryParameter["startTime"] = startTime;
1319
+ }
1320
+ if (endTime !== void 0 && endTime !== null) {
1321
+ localVarQueryParameter["endTime"] = endTime;
1322
+ }
1323
+ if (current !== void 0 && current !== null) {
1324
+ localVarQueryParameter["current"] = current;
1325
+ }
1326
+ if (limit !== void 0 && limit !== null) {
1327
+ localVarQueryParameter["limit"] = limit;
1328
+ }
1329
+ if (recvWindow !== void 0 && recvWindow !== null) {
1330
+ localVarQueryParameter["recvWindow"] = recvWindow;
1331
+ }
1332
+ let _timeUnit;
1333
+ if ("timeUnit" in configuration)
1334
+ _timeUnit = configuration.timeUnit;
1335
+ return {
1336
+ endpoint: "/sapi/v1/loan/ltv/adjustment/history",
1337
+ method: "GET",
1338
+ params: localVarQueryParameter,
1339
+ timeUnit: _timeUnit
1340
+ };
1341
+ },
1342
+ /**
1343
+ * Get Loan Ongoing Orders
1344
+ *
1345
+ * Weight: 300
1346
+ *
1347
+ * @summary Get Loan Ongoing Orders(USER_DATA)
1348
+ * @param {number} [orderId]
1349
+ * @param {string} [loanCoin]
1350
+ * @param {string} [collateralCoin]
1351
+ * @param {number} [current] Current querying page. Start from 1; default: 1; max: 1000
1352
+ * @param {number} [limit] Default: 10; max: 100
1353
+ * @param {number} [recvWindow]
1354
+ *
1355
+ * @throws {RequiredError}
1356
+ */
1357
+ getLoanOngoingOrders: async (orderId, loanCoin, collateralCoin, current, limit, recvWindow) => {
1358
+ const localVarQueryParameter = {};
1359
+ if (orderId !== void 0 && orderId !== null) {
1360
+ localVarQueryParameter["orderId"] = orderId;
1361
+ }
1362
+ if (loanCoin !== void 0 && loanCoin !== null) {
1363
+ localVarQueryParameter["loanCoin"] = loanCoin;
1364
+ }
1365
+ if (collateralCoin !== void 0 && collateralCoin !== null) {
1366
+ localVarQueryParameter["collateralCoin"] = collateralCoin;
1367
+ }
1368
+ if (current !== void 0 && current !== null) {
1369
+ localVarQueryParameter["current"] = current;
1370
+ }
1371
+ if (limit !== void 0 && limit !== null) {
1372
+ localVarQueryParameter["limit"] = limit;
1373
+ }
1374
+ if (recvWindow !== void 0 && recvWindow !== null) {
1375
+ localVarQueryParameter["recvWindow"] = recvWindow;
1376
+ }
1377
+ let _timeUnit;
1378
+ if ("timeUnit" in configuration)
1379
+ _timeUnit = configuration.timeUnit;
1380
+ return {
1381
+ endpoint: "/sapi/v1/loan/ongoing/orders",
1382
+ method: "GET",
1383
+ params: localVarQueryParameter,
1384
+ timeUnit: _timeUnit
1385
+ };
1386
+ },
1387
+ /**
1388
+ * Get Loan Repayment History
1389
+ *
1390
+ * If startTime and endTime are not sent, the recent 90-day data will be returned.
1391
+ * The max interval between startTime and endTime is 180 days.
1392
+ *
1393
+ * Weight: 400
1394
+ *
1395
+ * @summary Get Loan Repayment History(USER_DATA)
1396
+ * @param {number} [orderId]
1397
+ * @param {string} [loanCoin]
1398
+ * @param {string} [collateralCoin]
1399
+ * @param {number} [startTime]
1400
+ * @param {number} [endTime]
1401
+ * @param {number} [current] Current querying page. Start from 1; default: 1; max: 1000
1402
+ * @param {number} [limit] Default: 10; max: 100
1403
+ * @param {number} [recvWindow]
1404
+ *
1405
+ * @throws {RequiredError}
1406
+ */
1407
+ getLoanRepaymentHistory: async (orderId, loanCoin, collateralCoin, startTime, endTime, current, limit, recvWindow) => {
1408
+ const localVarQueryParameter = {};
1409
+ if (orderId !== void 0 && orderId !== null) {
1410
+ localVarQueryParameter["orderId"] = orderId;
1411
+ }
1412
+ if (loanCoin !== void 0 && loanCoin !== null) {
1413
+ localVarQueryParameter["loanCoin"] = loanCoin;
1414
+ }
1415
+ if (collateralCoin !== void 0 && collateralCoin !== null) {
1416
+ localVarQueryParameter["collateralCoin"] = collateralCoin;
1417
+ }
1418
+ if (startTime !== void 0 && startTime !== null) {
1419
+ localVarQueryParameter["startTime"] = startTime;
1420
+ }
1421
+ if (endTime !== void 0 && endTime !== null) {
1422
+ localVarQueryParameter["endTime"] = endTime;
1423
+ }
1424
+ if (current !== void 0 && current !== null) {
1425
+ localVarQueryParameter["current"] = current;
1426
+ }
1427
+ if (limit !== void 0 && limit !== null) {
1428
+ localVarQueryParameter["limit"] = limit;
1429
+ }
1430
+ if (recvWindow !== void 0 && recvWindow !== null) {
1431
+ localVarQueryParameter["recvWindow"] = recvWindow;
1432
+ }
1433
+ let _timeUnit;
1434
+ if ("timeUnit" in configuration)
1435
+ _timeUnit = configuration.timeUnit;
1436
+ return {
1437
+ endpoint: "/sapi/v1/loan/repay/history",
1438
+ method: "GET",
1439
+ params: localVarQueryParameter,
1440
+ timeUnit: _timeUnit
1441
+ };
1442
+ },
1443
+ /**
1444
+ * Get interest rate and borrow limit of loanable assets. The borrow limit is shown in USD value.
1445
+ *
1446
+ * Weight: 400
1447
+ *
1448
+ * @summary Get Loanable Assets Data(USER_DATA)
1449
+ * @param {string} [loanCoin]
1450
+ * @param {number} [vipLevel] Default: user's vip level. Send "-1" to check specified configuration
1451
+ * @param {number} [recvWindow]
1452
+ *
1453
+ * @throws {RequiredError}
1454
+ */
1455
+ getLoanableAssetsData: async (loanCoin, vipLevel, recvWindow) => {
1456
+ const localVarQueryParameter = {};
1457
+ if (loanCoin !== void 0 && loanCoin !== null) {
1458
+ localVarQueryParameter["loanCoin"] = loanCoin;
1459
+ }
1460
+ if (vipLevel !== void 0 && vipLevel !== null) {
1461
+ localVarQueryParameter["vipLevel"] = vipLevel;
1462
+ }
1463
+ if (recvWindow !== void 0 && recvWindow !== null) {
1464
+ localVarQueryParameter["recvWindow"] = recvWindow;
1465
+ }
1466
+ let _timeUnit;
1467
+ if ("timeUnit" in configuration)
1468
+ _timeUnit = configuration.timeUnit;
1469
+ return {
1470
+ endpoint: "/sapi/v1/loan/loanable/data",
1471
+ method: "GET",
1472
+ params: localVarQueryParameter,
1473
+ timeUnit: _timeUnit
1474
+ };
1475
+ }
1476
+ };
1477
+ };
1478
+ var StableRateApi = class {
1479
+ constructor(configuration) {
1480
+ this.configuration = configuration;
1481
+ this.localVarAxiosParamCreator = StableRateApiAxiosParamCreator(configuration);
1482
+ }
1483
+ /**
1484
+ * Get the the rate of collateral coin / loan coin when using collateral repay, the rate will be valid within 8 second.
1485
+ *
1486
+ * Weight: 6000
1487
+ *
1488
+ * @summary Check Collateral Repay Rate(USER_DATA)
1489
+ * @param {CheckCollateralRepayRateStableRateRequest} requestParameters Request parameters.
1490
+ * @returns {Promise<RestApiResponse<CheckCollateralRepayRateStableRateResponse>>}
1491
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1492
+ * @memberof StableRateApi
1493
+ * @see {@link https://developers.binance.com/docs/crypto_loan/stable-rate/market-data/Check-Collateral-Repay-Rate Binance API Documentation}
1494
+ */
1495
+ async checkCollateralRepayRateStableRate(requestParameters) {
1496
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.checkCollateralRepayRateStableRate(
1497
+ requestParameters?.loanCoin,
1498
+ requestParameters?.collateralCoin,
1499
+ requestParameters?.repayAmount,
1500
+ requestParameters?.recvWindow
1501
+ );
1502
+ return (0, import_common2.sendRequest)(
1503
+ this.configuration,
1504
+ localVarAxiosArgs.endpoint,
1505
+ localVarAxiosArgs.method,
1506
+ localVarAxiosArgs.params,
1507
+ localVarAxiosArgs?.timeUnit,
1508
+ { isSigned: true }
1509
+ );
1510
+ }
1511
+ /**
1512
+ * Crypto Loan Adjust LTV
1513
+ *
1514
+ * Weight: 6000
1515
+ *
1516
+ * @summary Crypto Loan Adjust LTV(TRADE)
1517
+ * @param {CryptoLoanAdjustLtvRequest} requestParameters Request parameters.
1518
+ * @returns {Promise<RestApiResponse<CryptoLoanAdjustLtvResponse>>}
1519
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1520
+ * @memberof StableRateApi
1521
+ * @see {@link https://developers.binance.com/docs/crypto_loan/stable-rate/trade/Crypto-Loan-Adjust-LTV Binance API Documentation}
1522
+ */
1523
+ async cryptoLoanAdjustLtv(requestParameters) {
1524
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.cryptoLoanAdjustLtv(
1525
+ requestParameters?.orderId,
1526
+ requestParameters?.amount,
1527
+ requestParameters?.direction,
1528
+ requestParameters?.recvWindow
1529
+ );
1530
+ return (0, import_common2.sendRequest)(
1531
+ this.configuration,
1532
+ localVarAxiosArgs.endpoint,
1533
+ localVarAxiosArgs.method,
1534
+ localVarAxiosArgs.params,
1535
+ localVarAxiosArgs?.timeUnit,
1536
+ { isSigned: true }
1537
+ );
1538
+ }
1539
+ /**
1540
+ * Crypto Loan Borrow
1541
+ *
1542
+ * Weight: 6000
1543
+ *
1544
+ * @summary Crypto Loan Borrow(TRADE)
1545
+ * @param {CryptoLoanBorrowRequest} requestParameters Request parameters.
1546
+ * @returns {Promise<RestApiResponse<CryptoLoanBorrowResponse>>}
1547
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1548
+ * @memberof StableRateApi
1549
+ * @see {@link https://developers.binance.com/docs/crypto_loan/stable-rate/trade/Crypto-Loan-Borrow Binance API Documentation}
1550
+ */
1551
+ async cryptoLoanBorrow(requestParameters) {
1552
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.cryptoLoanBorrow(
1553
+ requestParameters?.loanCoin,
1554
+ requestParameters?.collateralCoin,
1555
+ requestParameters?.loanTerm,
1556
+ requestParameters?.recvWindow
1557
+ );
1558
+ return (0, import_common2.sendRequest)(
1559
+ this.configuration,
1560
+ localVarAxiosArgs.endpoint,
1561
+ localVarAxiosArgs.method,
1562
+ localVarAxiosArgs.params,
1563
+ localVarAxiosArgs?.timeUnit,
1564
+ { isSigned: true }
1565
+ );
1566
+ }
1567
+ /**
1568
+ * Customize Margin Call
1569
+ *
1570
+ * Weight: 6000
1571
+ *
1572
+ * @summary Crypto Loan Customize Margin Call(TRADE)
1573
+ * @param {CryptoLoanCustomizeMarginCallRequest} requestParameters Request parameters.
1574
+ * @returns {Promise<RestApiResponse<CryptoLoanCustomizeMarginCallResponse>>}
1575
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1576
+ * @memberof StableRateApi
1577
+ * @see {@link https://developers.binance.com/docs/crypto_loan/stable-rate/trade/Crypto-Loan-Customize-Margin-Call Binance API Documentation}
1578
+ */
1579
+ async cryptoLoanCustomizeMarginCall(requestParameters) {
1580
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.cryptoLoanCustomizeMarginCall(
1581
+ requestParameters?.marginCall,
1582
+ requestParameters?.recvWindow
1583
+ );
1584
+ return (0, import_common2.sendRequest)(
1585
+ this.configuration,
1586
+ localVarAxiosArgs.endpoint,
1587
+ localVarAxiosArgs.method,
1588
+ localVarAxiosArgs.params,
1589
+ localVarAxiosArgs?.timeUnit,
1590
+ { isSigned: true }
1591
+ );
1592
+ }
1593
+ /**
1594
+ * Crypto Loan Repay
1595
+ *
1596
+ * Weight: 6000
1597
+ *
1598
+ * @summary Crypto Loan Repay(TRADE)
1599
+ * @param {CryptoLoanRepayRequest} requestParameters Request parameters.
1600
+ * @returns {Promise<RestApiResponse<CryptoLoanRepayResponse>>}
1601
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1602
+ * @memberof StableRateApi
1603
+ * @see {@link https://developers.binance.com/docs/crypto_loan/stable-rate/trade/Crypto-Loan-Repay Binance API Documentation}
1604
+ */
1605
+ async cryptoLoanRepay(requestParameters) {
1606
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.cryptoLoanRepay(
1607
+ requestParameters?.orderId,
1608
+ requestParameters?.amount,
1609
+ requestParameters?.type,
1610
+ requestParameters?.collateralReturn,
1611
+ requestParameters?.recvWindow
1612
+ );
1613
+ return (0, import_common2.sendRequest)(
1614
+ this.configuration,
1615
+ localVarAxiosArgs.endpoint,
1616
+ localVarAxiosArgs.method,
1617
+ localVarAxiosArgs.params,
1618
+ localVarAxiosArgs?.timeUnit,
1619
+ { isSigned: true }
1620
+ );
1621
+ }
1622
+ /**
1623
+ * Get LTV information and collateral limit of collateral assets. The collateral limit is shown in USD value.
1624
+ *
1625
+ * Weight: 400
1626
+ *
1627
+ * @summary Get Collateral Assets Data(USER_DATA)
1628
+ * @param {GetCollateralAssetsDataRequest} requestParameters Request parameters.
1629
+ * @returns {Promise<RestApiResponse<GetCollateralAssetsDataResponse>>}
1630
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1631
+ * @memberof StableRateApi
1632
+ * @see {@link https://developers.binance.com/docs/crypto_loan/stable-rate/market-data/Get-Collateral-Assets-Data Binance API Documentation}
1633
+ */
1634
+ async getCollateralAssetsData(requestParameters = {}) {
1635
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.getCollateralAssetsData(
1636
+ requestParameters?.collateralCoin,
1637
+ requestParameters?.vipLevel,
1638
+ requestParameters?.recvWindow
1639
+ );
1640
+ return (0, import_common2.sendRequest)(
1641
+ this.configuration,
1642
+ localVarAxiosArgs.endpoint,
1643
+ localVarAxiosArgs.method,
1644
+ localVarAxiosArgs.params,
1645
+ localVarAxiosArgs?.timeUnit,
1646
+ { isSigned: true }
1647
+ );
1648
+ }
1649
+ /**
1650
+ * Get Crypto Loans Income History
1651
+ *
1652
+ * If startTime and endTime are not sent, the recent 7-day data will be returned.
1653
+ * The max interval between startTime and endTime is 30 days.
1654
+ *
1655
+ * Weight: 6000
1656
+ *
1657
+ * @summary Get Crypto Loans Income History(USER_DATA)
1658
+ * @param {GetCryptoLoansIncomeHistoryRequest} requestParameters Request parameters.
1659
+ * @returns {Promise<RestApiResponse<GetCryptoLoansIncomeHistoryResponse>>}
1660
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1661
+ * @memberof StableRateApi
1662
+ * @see {@link https://developers.binance.com/docs/crypto_loan/stable-rate/market-data/Get-Crypto-Loans-Income-History Binance API Documentation}
1663
+ */
1664
+ async getCryptoLoansIncomeHistory(requestParameters = {}) {
1665
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.getCryptoLoansIncomeHistory(
1666
+ requestParameters?.asset,
1667
+ requestParameters?.type,
1668
+ requestParameters?.startTime,
1669
+ requestParameters?.endTime,
1670
+ requestParameters?.limit,
1671
+ requestParameters?.recvWindow
1672
+ );
1673
+ return (0, import_common2.sendRequest)(
1674
+ this.configuration,
1675
+ localVarAxiosArgs.endpoint,
1676
+ localVarAxiosArgs.method,
1677
+ localVarAxiosArgs.params,
1678
+ localVarAxiosArgs?.timeUnit,
1679
+ { isSigned: true }
1680
+ );
1681
+ }
1682
+ /**
1683
+ * Get Loan Borrow History
1684
+ *
1685
+ * If startTime and endTime are not sent, the recent 90-day data will be returned.
1686
+ * The max interval between startTime and endTime is 180 days.
1687
+ *
1688
+ * Weight: 400
1689
+ *
1690
+ * @summary Get Loan Borrow History(USER_DATA)
1691
+ * @param {GetLoanBorrowHistoryRequest} requestParameters Request parameters.
1692
+ * @returns {Promise<RestApiResponse<GetLoanBorrowHistoryResponse>>}
1693
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1694
+ * @memberof StableRateApi
1695
+ * @see {@link https://developers.binance.com/docs/crypto_loan/stable-rate/user-information/Get-Loan-Borrow-History Binance API Documentation}
1696
+ */
1697
+ async getLoanBorrowHistory(requestParameters = {}) {
1698
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.getLoanBorrowHistory(
1699
+ requestParameters?.orderId,
1700
+ requestParameters?.loanCoin,
1701
+ requestParameters?.collateralCoin,
1702
+ requestParameters?.startTime,
1703
+ requestParameters?.endTime,
1704
+ requestParameters?.current,
1705
+ requestParameters?.limit,
1706
+ requestParameters?.recvWindow
1707
+ );
1708
+ return (0, import_common2.sendRequest)(
1709
+ this.configuration,
1710
+ localVarAxiosArgs.endpoint,
1711
+ localVarAxiosArgs.method,
1712
+ localVarAxiosArgs.params,
1713
+ localVarAxiosArgs?.timeUnit,
1714
+ { isSigned: true }
1715
+ );
1716
+ }
1717
+ /**
1718
+ * Get Loan LTV Adjustment History
1719
+ *
1720
+ * If startTime and endTime are not sent, the recent 90-day data will be returned.
1721
+ * The max interval between startTime and endTime is 180 days.
1722
+ *
1723
+ * Weight: 400
1724
+ *
1725
+ * @summary Get Loan LTV Adjustment History(USER_DATA)
1726
+ * @param {GetLoanLtvAdjustmentHistoryRequest} requestParameters Request parameters.
1727
+ * @returns {Promise<RestApiResponse<GetLoanLtvAdjustmentHistoryResponse>>}
1728
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1729
+ * @memberof StableRateApi
1730
+ * @see {@link https://developers.binance.com/docs/crypto_loan/stable-rate/user-information/Get-Loan-LTV-Adjustment-History Binance API Documentation}
1731
+ */
1732
+ async getLoanLtvAdjustmentHistory(requestParameters = {}) {
1733
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.getLoanLtvAdjustmentHistory(
1734
+ requestParameters?.orderId,
1735
+ requestParameters?.loanCoin,
1736
+ requestParameters?.collateralCoin,
1737
+ requestParameters?.startTime,
1738
+ requestParameters?.endTime,
1739
+ requestParameters?.current,
1740
+ requestParameters?.limit,
1741
+ requestParameters?.recvWindow
1742
+ );
1743
+ return (0, import_common2.sendRequest)(
1744
+ this.configuration,
1745
+ localVarAxiosArgs.endpoint,
1746
+ localVarAxiosArgs.method,
1747
+ localVarAxiosArgs.params,
1748
+ localVarAxiosArgs?.timeUnit,
1749
+ { isSigned: true }
1750
+ );
1751
+ }
1752
+ /**
1753
+ * Get Loan Ongoing Orders
1754
+ *
1755
+ * Weight: 300
1756
+ *
1757
+ * @summary Get Loan Ongoing Orders(USER_DATA)
1758
+ * @param {GetLoanOngoingOrdersRequest} requestParameters Request parameters.
1759
+ * @returns {Promise<RestApiResponse<GetLoanOngoingOrdersResponse>>}
1760
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1761
+ * @memberof StableRateApi
1762
+ * @see {@link https://developers.binance.com/docs/crypto_loan/stable-rate/user-information/Get-Loan-Ongoing-Orders Binance API Documentation}
1763
+ */
1764
+ async getLoanOngoingOrders(requestParameters = {}) {
1765
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.getLoanOngoingOrders(
1766
+ requestParameters?.orderId,
1767
+ requestParameters?.loanCoin,
1768
+ requestParameters?.collateralCoin,
1769
+ requestParameters?.current,
1770
+ requestParameters?.limit,
1771
+ requestParameters?.recvWindow
1772
+ );
1773
+ return (0, import_common2.sendRequest)(
1774
+ this.configuration,
1775
+ localVarAxiosArgs.endpoint,
1776
+ localVarAxiosArgs.method,
1777
+ localVarAxiosArgs.params,
1778
+ localVarAxiosArgs?.timeUnit,
1779
+ { isSigned: true }
1780
+ );
1781
+ }
1782
+ /**
1783
+ * Get Loan Repayment History
1784
+ *
1785
+ * If startTime and endTime are not sent, the recent 90-day data will be returned.
1786
+ * The max interval between startTime and endTime is 180 days.
1787
+ *
1788
+ * Weight: 400
1789
+ *
1790
+ * @summary Get Loan Repayment History(USER_DATA)
1791
+ * @param {GetLoanRepaymentHistoryRequest} requestParameters Request parameters.
1792
+ * @returns {Promise<RestApiResponse<GetLoanRepaymentHistoryResponse>>}
1793
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1794
+ * @memberof StableRateApi
1795
+ * @see {@link https://developers.binance.com/docs/crypto_loan/stable-rate/user-information/Get-Loan-Repayment-History Binance API Documentation}
1796
+ */
1797
+ async getLoanRepaymentHistory(requestParameters = {}) {
1798
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.getLoanRepaymentHistory(
1799
+ requestParameters?.orderId,
1800
+ requestParameters?.loanCoin,
1801
+ requestParameters?.collateralCoin,
1802
+ requestParameters?.startTime,
1803
+ requestParameters?.endTime,
1804
+ requestParameters?.current,
1805
+ requestParameters?.limit,
1806
+ requestParameters?.recvWindow
1807
+ );
1808
+ return (0, import_common2.sendRequest)(
1809
+ this.configuration,
1810
+ localVarAxiosArgs.endpoint,
1811
+ localVarAxiosArgs.method,
1812
+ localVarAxiosArgs.params,
1813
+ localVarAxiosArgs?.timeUnit,
1814
+ { isSigned: true }
1815
+ );
1816
+ }
1817
+ /**
1818
+ * Get interest rate and borrow limit of loanable assets. The borrow limit is shown in USD value.
1819
+ *
1820
+ * Weight: 400
1821
+ *
1822
+ * @summary Get Loanable Assets Data(USER_DATA)
1823
+ * @param {GetLoanableAssetsDataRequest} requestParameters Request parameters.
1824
+ * @returns {Promise<RestApiResponse<GetLoanableAssetsDataResponse>>}
1825
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1826
+ * @memberof StableRateApi
1827
+ * @see {@link https://developers.binance.com/docs/crypto_loan/stable-rate/market-data/Get-Loanable-Assets-Data Binance API Documentation}
1828
+ */
1829
+ async getLoanableAssetsData(requestParameters = {}) {
1830
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.getLoanableAssetsData(
1831
+ requestParameters?.loanCoin,
1832
+ requestParameters?.vipLevel,
1833
+ requestParameters?.recvWindow
1834
+ );
1835
+ return (0, import_common2.sendRequest)(
1836
+ this.configuration,
1837
+ localVarAxiosArgs.endpoint,
1838
+ localVarAxiosArgs.method,
1839
+ localVarAxiosArgs.params,
1840
+ localVarAxiosArgs?.timeUnit,
1841
+ { isSigned: true }
1842
+ );
1843
+ }
1844
+ };
1845
+
1846
+ // src/rest-api/rest-api.ts
1847
+ var import_common3 = require("@binance/common");
1848
+ var RestAPI = class {
1849
+ constructor(configuration) {
1850
+ this.configuration = configuration;
1851
+ this.flexibleRateApi = new FlexibleRateApi(configuration);
1852
+ this.stableRateApi = new StableRateApi(configuration);
1853
+ }
1854
+ /**
1855
+ * Generic function to send a request.
1856
+ * @param endpoint - The API endpoint to call.
1857
+ * @param method - HTTP method to use (GET, POST, DELETE, etc.).
1858
+ * @param params - Query parameters for the request.
1859
+ *
1860
+ * @returns A promise resolving to the response data object.
1861
+ */
1862
+ sendRequest(endpoint, method, params = {}) {
1863
+ return (0, import_common3.sendRequest)(this.configuration, endpoint, method, params, void 0);
1864
+ }
1865
+ /**
1866
+ * Generic function to send a signed request.
1867
+ * @param endpoint - The API endpoint to call.
1868
+ * @param method - HTTP method to use (GET, POST, DELETE, etc.).
1869
+ * @param params - Query parameters for the request.
1870
+ *
1871
+ * @returns A promise resolving to the response data object.
1872
+ */
1873
+ sendSignedRequest(endpoint, method, params = {}) {
1874
+ return (0, import_common3.sendRequest)(this.configuration, endpoint, method, params, void 0, {
1875
+ isSigned: true
1876
+ });
1877
+ }
1878
+ /**
1879
+ *
1880
+ * Weight: 6000
1881
+ *
1882
+ * @summary Check Collateral Repay Rate (USER_DATA)
1883
+ * @param {CheckCollateralRepayRateRequest} requestParameters Request parameters.
1884
+ * @returns {Promise<RestApiResponse<CheckCollateralRepayRateResponse>>}
1885
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1886
+ * @see {@link https://developers.binance.com/docs/crypto_loan/flexible-rate/user-information/Check-Collateral-Repay-Rate Binance API Documentation}
1887
+ */
1888
+ checkCollateralRepayRate(requestParameters) {
1889
+ return this.flexibleRateApi.checkCollateralRepayRate(requestParameters);
1890
+ }
1891
+ /**
1892
+ * Flexible Loan Adjust LTV
1893
+ *
1894
+ * API Key needs Spot & Margin Trading permission for this endpoint
1895
+ *
1896
+ * Weight: 6000
1897
+ *
1898
+ * @summary Flexible Loan Adjust LTV(TRADE)
1899
+ * @param {FlexibleLoanAdjustLtvRequest} requestParameters Request parameters.
1900
+ * @returns {Promise<RestApiResponse<FlexibleLoanAdjustLtvResponse>>}
1901
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1902
+ * @see {@link https://developers.binance.com/docs/crypto_loan/flexible-rate/trade/Flexible-Loan-Adjust-LTV Binance API Documentation}
1903
+ */
1904
+ flexibleLoanAdjustLtv(requestParameters) {
1905
+ return this.flexibleRateApi.flexibleLoanAdjustLtv(requestParameters);
1906
+ }
1907
+ /**
1908
+ * Borrow Flexible Loan
1909
+ *
1910
+ *
1911
+ * Only available for master account
1912
+ * You can customize LTV by entering loanAmount and collateralAmount.
1913
+ *
1914
+ * Weight: 6000
1915
+ *
1916
+ * @summary Flexible Loan Borrow(TRADE)
1917
+ * @param {FlexibleLoanBorrowRequest} requestParameters Request parameters.
1918
+ * @returns {Promise<RestApiResponse<FlexibleLoanBorrowResponse>>}
1919
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1920
+ * @see {@link https://developers.binance.com/docs/crypto_loan/flexible-rate/trade/Flexible-Loan-Borrow Binance API Documentation}
1921
+ */
1922
+ flexibleLoanBorrow(requestParameters) {
1923
+ return this.flexibleRateApi.flexibleLoanBorrow(requestParameters);
1924
+ }
1925
+ /**
1926
+ *
1927
+ * Weight: 6000
1928
+ *
1929
+ * @summary Flexible Loan Collateral Repayment (TRADE)
1930
+ * @param {FlexibleLoanCollateralRepaymentRequest} requestParameters Request parameters.
1931
+ * @returns {Promise<RestApiResponse<FlexibleLoanCollateralRepaymentResponse>>}
1932
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1933
+ * @see {@link https://developers.binance.com/docs/crypto_loan/flexible-rate/trade/Flexible-Loan-Collateral-Repay Binance API Documentation}
1934
+ */
1935
+ flexibleLoanCollateralRepayment(requestParameters) {
1936
+ return this.flexibleRateApi.flexibleLoanCollateralRepayment(requestParameters);
1937
+ }
1938
+ /**
1939
+ * Flexible Loan Repay
1940
+ *
1941
+ *
1942
+ * repayAmount is mandatory even fullRepayment = FALSE
1943
+ *
1944
+ * Weight: 6000
1945
+ *
1946
+ * @summary Flexible Loan Repay(TRADE)
1947
+ * @param {FlexibleLoanRepayRequest} requestParameters Request parameters.
1948
+ * @returns {Promise<RestApiResponse<FlexibleLoanRepayResponse>>}
1949
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1950
+ * @see {@link https://developers.binance.com/docs/crypto_loan/flexible-rate/trade/Flexible-Loan-Repay Binance API Documentation}
1951
+ */
1952
+ flexibleLoanRepay(requestParameters) {
1953
+ return this.flexibleRateApi.flexibleLoanRepay(requestParameters);
1954
+ }
1955
+ /**
1956
+ * Get interest rate and borrow limit of flexible loanable assets. The borrow limit is shown in USD value.
1957
+ *
1958
+ * Weight: 400
1959
+ *
1960
+ * @summary Get Flexible Loan Assets Data(USER_DATA)
1961
+ * @param {GetFlexibleLoanAssetsDataRequest} requestParameters Request parameters.
1962
+ * @returns {Promise<RestApiResponse<GetFlexibleLoanAssetsDataResponse>>}
1963
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1964
+ * @see {@link https://developers.binance.com/docs/crypto_loan/flexible-rate/market-data/Get-Flexible-Loan-Assets-Data Binance API Documentation}
1965
+ */
1966
+ getFlexibleLoanAssetsData(requestParameters = {}) {
1967
+ return this.flexibleRateApi.getFlexibleLoanAssetsData(requestParameters);
1968
+ }
1969
+ /**
1970
+ * Get Flexible Loan Borrow History
1971
+ *
1972
+ * If startTime and endTime are not sent, the recent 90-day data will be returned.
1973
+ * The max interval between startTime and endTime is 180 days.
1974
+ *
1975
+ * Weight: 400
1976
+ *
1977
+ * @summary Get Flexible Loan Borrow History(USER_DATA)
1978
+ * @param {GetFlexibleLoanBorrowHistoryRequest} requestParameters Request parameters.
1979
+ * @returns {Promise<RestApiResponse<GetFlexibleLoanBorrowHistoryResponse>>}
1980
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1981
+ * @see {@link https://developers.binance.com/docs/crypto_loan/flexible-rate/user-information/Get-Flexible-Loan-Borrow-History Binance API Documentation}
1982
+ */
1983
+ getFlexibleLoanBorrowHistory(requestParameters = {}) {
1984
+ return this.flexibleRateApi.getFlexibleLoanBorrowHistory(requestParameters);
1985
+ }
1986
+ /**
1987
+ * Get LTV information and collateral limit of flexible loan's collateral assets. The collateral limit is shown in USD value.
1988
+ *
1989
+ * Weight: 400
1990
+ *
1991
+ * @summary Get Flexible Loan Collateral Assets Data(USER_DATA)
1992
+ * @param {GetFlexibleLoanCollateralAssetsDataRequest} requestParameters Request parameters.
1993
+ * @returns {Promise<RestApiResponse<GetFlexibleLoanCollateralAssetsDataResponse>>}
1994
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1995
+ * @see {@link https://developers.binance.com/docs/crypto_loan/flexible-rate/market-data/Get-Flexible-Loan-Collateral-Assets-Data Binance API Documentation}
1996
+ */
1997
+ getFlexibleLoanCollateralAssetsData(requestParameters = {}) {
1998
+ return this.flexibleRateApi.getFlexibleLoanCollateralAssetsData(requestParameters);
1999
+ }
2000
+ /**
2001
+ *
2002
+ * Weight: 400
2003
+ *
2004
+ * @summary Get Flexible Loan Liquidation History (USER_DATA)
2005
+ * @param {GetFlexibleLoanLiquidationHistoryRequest} requestParameters Request parameters.
2006
+ * @returns {Promise<RestApiResponse<GetFlexibleLoanLiquidationHistoryResponse>>}
2007
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
2008
+ * @see {@link https://developers.binance.com/docs/crypto_loan/flexible-rate/user-information/Get-Flexible-Loan-Liquidation-History Binance API Documentation}
2009
+ */
2010
+ getFlexibleLoanLiquidationHistory(requestParameters = {}) {
2011
+ return this.flexibleRateApi.getFlexibleLoanLiquidationHistory(requestParameters);
2012
+ }
2013
+ /**
2014
+ * Get Flexible Loan LTV Adjustment History
2015
+ *
2016
+ * If startTime and endTime are not sent, the recent 90-day data will be returned.
2017
+ * The max interval between startTime and endTime is 180 days.
2018
+ *
2019
+ * Weight: 400
2020
+ *
2021
+ * @summary Get Flexible Loan LTV Adjustment History(USER_DATA)
2022
+ * @param {GetFlexibleLoanLtvAdjustmentHistoryRequest} requestParameters Request parameters.
2023
+ * @returns {Promise<RestApiResponse<GetFlexibleLoanLtvAdjustmentHistoryResponse>>}
2024
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
2025
+ * @see {@link https://developers.binance.com/docs/crypto_loan/flexible-rate/user-information/Get-Flexible-Loan-LTV-Adjustment-History Binance API Documentation}
2026
+ */
2027
+ getFlexibleLoanLtvAdjustmentHistory(requestParameters = {}) {
2028
+ return this.flexibleRateApi.getFlexibleLoanLtvAdjustmentHistory(requestParameters);
2029
+ }
2030
+ /**
2031
+ * Get Flexible Loan Ongoing Orders
2032
+ *
2033
+ * Weight: 300
2034
+ *
2035
+ * @summary Get Flexible Loan Ongoing Orders(USER_DATA)
2036
+ * @param {GetFlexibleLoanOngoingOrdersRequest} requestParameters Request parameters.
2037
+ * @returns {Promise<RestApiResponse<GetFlexibleLoanOngoingOrdersResponse>>}
2038
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
2039
+ * @see {@link https://developers.binance.com/docs/crypto_loan/flexible-rate/user-information/Get-Flexible-Loan-Ongoing-Orders Binance API Documentation}
2040
+ */
2041
+ getFlexibleLoanOngoingOrders(requestParameters = {}) {
2042
+ return this.flexibleRateApi.getFlexibleLoanOngoingOrders(requestParameters);
2043
+ }
2044
+ /**
2045
+ * Get Flexible Loan Repayment History
2046
+ *
2047
+ * If startTime and endTime are not sent, the recent 90-day data will be returned.
2048
+ * The max interval between startTime and endTime is 180 days.
2049
+ *
2050
+ * Weight: 400
2051
+ *
2052
+ * @summary Get Flexible Loan Repayment History(USER_DATA)
2053
+ * @param {GetFlexibleLoanRepaymentHistoryRequest} requestParameters Request parameters.
2054
+ * @returns {Promise<RestApiResponse<GetFlexibleLoanRepaymentHistoryResponse>>}
2055
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
2056
+ * @see {@link https://developers.binance.com/docs/crypto_loan/flexible-rate/user-information/Get-Flexible-Loan-Repayment-History Binance API Documentation}
2057
+ */
2058
+ getFlexibleLoanRepaymentHistory(requestParameters = {}) {
2059
+ return this.flexibleRateApi.getFlexibleLoanRepaymentHistory(requestParameters);
2060
+ }
2061
+ /**
2062
+ * Get the the rate of collateral coin / loan coin when using collateral repay, the rate will be valid within 8 second.
2063
+ *
2064
+ * Weight: 6000
2065
+ *
2066
+ * @summary Check Collateral Repay Rate(USER_DATA)
2067
+ * @param {CheckCollateralRepayRateStableRateRequest} requestParameters Request parameters.
2068
+ * @returns {Promise<RestApiResponse<CheckCollateralRepayRateStableRateResponse>>}
2069
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
2070
+ * @see {@link https://developers.binance.com/docs/crypto_loan/stable-rate/market-data/Check-Collateral-Repay-Rate Binance API Documentation}
2071
+ */
2072
+ checkCollateralRepayRateStableRate(requestParameters) {
2073
+ return this.stableRateApi.checkCollateralRepayRateStableRate(requestParameters);
2074
+ }
2075
+ /**
2076
+ * Crypto Loan Adjust LTV
2077
+ *
2078
+ * Weight: 6000
2079
+ *
2080
+ * @summary Crypto Loan Adjust LTV(TRADE)
2081
+ * @param {CryptoLoanAdjustLtvRequest} requestParameters Request parameters.
2082
+ * @returns {Promise<RestApiResponse<CryptoLoanAdjustLtvResponse>>}
2083
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
2084
+ * @see {@link https://developers.binance.com/docs/crypto_loan/stable-rate/trade/Crypto-Loan-Adjust-LTV Binance API Documentation}
2085
+ */
2086
+ cryptoLoanAdjustLtv(requestParameters) {
2087
+ return this.stableRateApi.cryptoLoanAdjustLtv(requestParameters);
2088
+ }
2089
+ /**
2090
+ * Crypto Loan Borrow
2091
+ *
2092
+ * Weight: 6000
2093
+ *
2094
+ * @summary Crypto Loan Borrow(TRADE)
2095
+ * @param {CryptoLoanBorrowRequest} requestParameters Request parameters.
2096
+ * @returns {Promise<RestApiResponse<CryptoLoanBorrowResponse>>}
2097
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
2098
+ * @see {@link https://developers.binance.com/docs/crypto_loan/stable-rate/trade/Crypto-Loan-Borrow Binance API Documentation}
2099
+ */
2100
+ cryptoLoanBorrow(requestParameters) {
2101
+ return this.stableRateApi.cryptoLoanBorrow(requestParameters);
2102
+ }
2103
+ /**
2104
+ * Customize Margin Call
2105
+ *
2106
+ * Weight: 6000
2107
+ *
2108
+ * @summary Crypto Loan Customize Margin Call(TRADE)
2109
+ * @param {CryptoLoanCustomizeMarginCallRequest} requestParameters Request parameters.
2110
+ * @returns {Promise<RestApiResponse<CryptoLoanCustomizeMarginCallResponse>>}
2111
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
2112
+ * @see {@link https://developers.binance.com/docs/crypto_loan/stable-rate/trade/Crypto-Loan-Customize-Margin-Call Binance API Documentation}
2113
+ */
2114
+ cryptoLoanCustomizeMarginCall(requestParameters) {
2115
+ return this.stableRateApi.cryptoLoanCustomizeMarginCall(requestParameters);
2116
+ }
2117
+ /**
2118
+ * Crypto Loan Repay
2119
+ *
2120
+ * Weight: 6000
2121
+ *
2122
+ * @summary Crypto Loan Repay(TRADE)
2123
+ * @param {CryptoLoanRepayRequest} requestParameters Request parameters.
2124
+ * @returns {Promise<RestApiResponse<CryptoLoanRepayResponse>>}
2125
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
2126
+ * @see {@link https://developers.binance.com/docs/crypto_loan/stable-rate/trade/Crypto-Loan-Repay Binance API Documentation}
2127
+ */
2128
+ cryptoLoanRepay(requestParameters) {
2129
+ return this.stableRateApi.cryptoLoanRepay(requestParameters);
2130
+ }
2131
+ /**
2132
+ * Get LTV information and collateral limit of collateral assets. The collateral limit is shown in USD value.
2133
+ *
2134
+ * Weight: 400
2135
+ *
2136
+ * @summary Get Collateral Assets Data(USER_DATA)
2137
+ * @param {GetCollateralAssetsDataRequest} requestParameters Request parameters.
2138
+ * @returns {Promise<RestApiResponse<GetCollateralAssetsDataResponse>>}
2139
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
2140
+ * @see {@link https://developers.binance.com/docs/crypto_loan/stable-rate/market-data/Get-Collateral-Assets-Data Binance API Documentation}
2141
+ */
2142
+ getCollateralAssetsData(requestParameters = {}) {
2143
+ return this.stableRateApi.getCollateralAssetsData(requestParameters);
2144
+ }
2145
+ /**
2146
+ * Get Crypto Loans Income History
2147
+ *
2148
+ * If startTime and endTime are not sent, the recent 7-day data will be returned.
2149
+ * The max interval between startTime and endTime is 30 days.
2150
+ *
2151
+ * Weight: 6000
2152
+ *
2153
+ * @summary Get Crypto Loans Income History(USER_DATA)
2154
+ * @param {GetCryptoLoansIncomeHistoryRequest} requestParameters Request parameters.
2155
+ * @returns {Promise<RestApiResponse<GetCryptoLoansIncomeHistoryResponse>>}
2156
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
2157
+ * @see {@link https://developers.binance.com/docs/crypto_loan/stable-rate/market-data/Get-Crypto-Loans-Income-History Binance API Documentation}
2158
+ */
2159
+ getCryptoLoansIncomeHistory(requestParameters = {}) {
2160
+ return this.stableRateApi.getCryptoLoansIncomeHistory(requestParameters);
2161
+ }
2162
+ /**
2163
+ * Get Loan Borrow History
2164
+ *
2165
+ * If startTime and endTime are not sent, the recent 90-day data will be returned.
2166
+ * The max interval between startTime and endTime is 180 days.
2167
+ *
2168
+ * Weight: 400
2169
+ *
2170
+ * @summary Get Loan Borrow History(USER_DATA)
2171
+ * @param {GetLoanBorrowHistoryRequest} requestParameters Request parameters.
2172
+ * @returns {Promise<RestApiResponse<GetLoanBorrowHistoryResponse>>}
2173
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
2174
+ * @see {@link https://developers.binance.com/docs/crypto_loan/stable-rate/user-information/Get-Loan-Borrow-History Binance API Documentation}
2175
+ */
2176
+ getLoanBorrowHistory(requestParameters = {}) {
2177
+ return this.stableRateApi.getLoanBorrowHistory(requestParameters);
2178
+ }
2179
+ /**
2180
+ * Get Loan LTV Adjustment History
2181
+ *
2182
+ * If startTime and endTime are not sent, the recent 90-day data will be returned.
2183
+ * The max interval between startTime and endTime is 180 days.
2184
+ *
2185
+ * Weight: 400
2186
+ *
2187
+ * @summary Get Loan LTV Adjustment History(USER_DATA)
2188
+ * @param {GetLoanLtvAdjustmentHistoryRequest} requestParameters Request parameters.
2189
+ * @returns {Promise<RestApiResponse<GetLoanLtvAdjustmentHistoryResponse>>}
2190
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
2191
+ * @see {@link https://developers.binance.com/docs/crypto_loan/stable-rate/user-information/Get-Loan-LTV-Adjustment-History Binance API Documentation}
2192
+ */
2193
+ getLoanLtvAdjustmentHistory(requestParameters = {}) {
2194
+ return this.stableRateApi.getLoanLtvAdjustmentHistory(requestParameters);
2195
+ }
2196
+ /**
2197
+ * Get Loan Ongoing Orders
2198
+ *
2199
+ * Weight: 300
2200
+ *
2201
+ * @summary Get Loan Ongoing Orders(USER_DATA)
2202
+ * @param {GetLoanOngoingOrdersRequest} requestParameters Request parameters.
2203
+ * @returns {Promise<RestApiResponse<GetLoanOngoingOrdersResponse>>}
2204
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
2205
+ * @see {@link https://developers.binance.com/docs/crypto_loan/stable-rate/user-information/Get-Loan-Ongoing-Orders Binance API Documentation}
2206
+ */
2207
+ getLoanOngoingOrders(requestParameters = {}) {
2208
+ return this.stableRateApi.getLoanOngoingOrders(requestParameters);
2209
+ }
2210
+ /**
2211
+ * Get Loan Repayment History
2212
+ *
2213
+ * If startTime and endTime are not sent, the recent 90-day data will be returned.
2214
+ * The max interval between startTime and endTime is 180 days.
2215
+ *
2216
+ * Weight: 400
2217
+ *
2218
+ * @summary Get Loan Repayment History(USER_DATA)
2219
+ * @param {GetLoanRepaymentHistoryRequest} requestParameters Request parameters.
2220
+ * @returns {Promise<RestApiResponse<GetLoanRepaymentHistoryResponse>>}
2221
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
2222
+ * @see {@link https://developers.binance.com/docs/crypto_loan/stable-rate/user-information/Get-Loan-Repayment-History Binance API Documentation}
2223
+ */
2224
+ getLoanRepaymentHistory(requestParameters = {}) {
2225
+ return this.stableRateApi.getLoanRepaymentHistory(requestParameters);
2226
+ }
2227
+ /**
2228
+ * Get interest rate and borrow limit of loanable assets. The borrow limit is shown in USD value.
2229
+ *
2230
+ * Weight: 400
2231
+ *
2232
+ * @summary Get Loanable Assets Data(USER_DATA)
2233
+ * @param {GetLoanableAssetsDataRequest} requestParameters Request parameters.
2234
+ * @returns {Promise<RestApiResponse<GetLoanableAssetsDataResponse>>}
2235
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
2236
+ * @see {@link https://developers.binance.com/docs/crypto_loan/stable-rate/market-data/Get-Loanable-Assets-Data Binance API Documentation}
2237
+ */
2238
+ getLoanableAssetsData(requestParameters = {}) {
2239
+ return this.stableRateApi.getLoanableAssetsData(requestParameters);
2240
+ }
2241
+ };
2242
+
2243
+ // src/crypto-loan.ts
2244
+ var CryptoLoan = class {
2245
+ constructor(config) {
2246
+ if (config?.configurationRestAPI) {
2247
+ const configRestAPI = new import_common4.ConfigurationRestAPI(config.configurationRestAPI);
2248
+ configRestAPI.basePath = configRestAPI.basePath || import_common4.CRYPTO_LOAN_REST_API_PROD_URL;
2249
+ configRestAPI.baseOptions = configRestAPI.baseOptions || {};
2250
+ configRestAPI.baseOptions.headers = {
2251
+ ...configRestAPI.baseOptions.headers || {},
2252
+ "User-Agent": `${name}/${version} (Node.js/${process.version}; ${(0, import_os.platform)()}; ${(0, import_os.arch)()})`
2253
+ };
2254
+ this.restAPI = new RestAPI(configRestAPI);
2255
+ }
2256
+ }
2257
+ };
2258
+
2259
+ // src/index.ts
2260
+ var import_common5 = require("@binance/common");
2261
+ // Annotate the CommonJS export names for ESM import in node:
2262
+ 0 && (module.exports = {
2263
+ BadRequestError,
2264
+ CRYPTO_LOAN_REST_API_PROD_URL,
2265
+ CRYPTO_LOAN_REST_API_TESTNET_URL,
2266
+ ConnectorClientError,
2267
+ CryptoLoan,
2268
+ CryptoLoanRestAPI,
2269
+ ForbiddenError,
2270
+ NetworkError,
2271
+ NotFoundError,
2272
+ RateLimitBanError,
2273
+ RequiredError,
2274
+ ServerError,
2275
+ TooManyRequestsError,
2276
+ UnauthorizedError
2277
+ });
2278
+ //# sourceMappingURL=index.js.map