ccxt 4.1.58 → 4.1.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/build.sh +2 -2
- package/dist/ccxt.browser.js +757 -818
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -19
- package/dist/cjs/src/base/Exchange.js +38 -17
- package/dist/cjs/src/binance.js +70 -22
- package/dist/cjs/src/bitget.js +74 -52
- package/dist/cjs/src/bitmart.js +10 -18
- package/dist/cjs/src/bitrue.js +1 -1
- package/dist/cjs/src/bybit.js +36 -33
- package/dist/cjs/src/coinex.js +25 -30
- package/dist/cjs/src/htx.js +82 -39
- package/dist/cjs/src/kucoin.js +83 -35
- package/dist/cjs/src/mexc.js +3 -105
- package/dist/cjs/src/okx.js +8 -16
- package/dist/cjs/src/pro/bitget.js +7 -0
- package/dist/cjs/src/pro/bitmart.js +7 -0
- package/dist/cjs/src/pro/bitvavo.js +9 -0
- package/dist/cjs/src/pro/bybit.js +9 -0
- package/dist/cjs/src/pro/htx.js +16 -5
- package/dist/cjs/src/pro/kucoin.js +7 -0
- package/dist/cjs/src/pro/mexc.js +9 -0
- package/js/ccxt.d.ts +2 -23
- package/js/ccxt.js +2 -16
- package/js/src/abstract/mexc.d.ts +0 -4
- package/js/src/base/Exchange.d.ts +7 -0
- package/js/src/base/Exchange.js +38 -17
- package/js/src/binance.d.ts +20 -2
- package/js/src/binance.js +70 -22
- package/js/src/bitget.d.ts +20 -2
- package/js/src/bitget.js +74 -52
- package/js/src/bitmart.d.ts +2 -2
- package/js/src/bitmart.js +10 -18
- package/js/src/bitrue.js +1 -1
- package/js/src/bybit.d.ts +2 -2
- package/js/src/bybit.js +36 -33
- package/js/src/coinex.d.ts +2 -2
- package/js/src/coinex.js +25 -30
- package/js/src/htx.d.ts +5 -3
- package/js/src/htx.js +82 -39
- package/js/src/kucoin.d.ts +20 -2
- package/js/src/kucoin.js +83 -35
- package/js/src/mexc.d.ts +0 -11
- package/js/src/mexc.js +3 -105
- package/js/src/okx.d.ts +18 -2
- package/js/src/okx.js +8 -16
- package/js/src/pro/bitget.js +7 -0
- package/js/src/pro/bitmart.js +7 -0
- package/js/src/pro/bitvavo.js +9 -0
- package/js/src/pro/bybit.js +9 -0
- package/js/src/pro/htx.js +16 -5
- package/js/src/pro/kucoin.js +7 -0
- package/js/src/pro/mexc.js +9 -0
- package/package.json +1 -1
- package/skip-tests.json +5 -0
- package/js/src/abstract/huobipro.d.ts +0 -547
- package/js/src/abstract/huobipro.js +0 -11
- package/js/src/abstract/mexc3.d.ts +0 -180
- package/js/src/abstract/mexc3.js +0 -11
- package/js/src/abstract/okex.d.ts +0 -280
- package/js/src/abstract/okex.js +0 -11
- package/js/src/abstract/okex5.d.ts +0 -280
- package/js/src/abstract/okex5.js +0 -11
package/dist/cjs/ccxt.js
CHANGED
|
@@ -76,7 +76,6 @@ var hollaex = require('./src/hollaex.js');
|
|
|
76
76
|
var htx = require('./src/htx.js');
|
|
77
77
|
var huobi = require('./src/huobi.js');
|
|
78
78
|
var huobijp = require('./src/huobijp.js');
|
|
79
|
-
var huobipro = require('./src/huobipro.js');
|
|
80
79
|
var idex = require('./src/idex.js');
|
|
81
80
|
var independentreserve = require('./src/independentreserve.js');
|
|
82
81
|
var indodax = require('./src/indodax.js');
|
|
@@ -91,13 +90,10 @@ var luno = require('./src/luno.js');
|
|
|
91
90
|
var lykke = require('./src/lykke.js');
|
|
92
91
|
var mercado = require('./src/mercado.js');
|
|
93
92
|
var mexc = require('./src/mexc.js');
|
|
94
|
-
var mexc3 = require('./src/mexc3.js');
|
|
95
93
|
var ndax = require('./src/ndax.js');
|
|
96
94
|
var novadax = require('./src/novadax.js');
|
|
97
95
|
var oceanex = require('./src/oceanex.js');
|
|
98
96
|
var okcoin = require('./src/okcoin.js');
|
|
99
|
-
var okex = require('./src/okex.js');
|
|
100
|
-
var okex5 = require('./src/okex5.js');
|
|
101
97
|
var okx = require('./src/okx.js');
|
|
102
98
|
var p2b = require('./src/p2b.js');
|
|
103
99
|
var paymium = require('./src/paymium.js');
|
|
@@ -155,7 +151,6 @@ var hollaex$1 = require('./src/pro/hollaex.js');
|
|
|
155
151
|
var htx$1 = require('./src/pro/htx.js');
|
|
156
152
|
var huobi$1 = require('./src/pro/huobi.js');
|
|
157
153
|
var huobijp$1 = require('./src/pro/huobijp.js');
|
|
158
|
-
var huobipro$1 = require('./src/pro/huobipro.js');
|
|
159
154
|
var idex$1 = require('./src/pro/idex.js');
|
|
160
155
|
var independentreserve$1 = require('./src/pro/independentreserve.js');
|
|
161
156
|
var kraken$1 = require('./src/pro/kraken.js');
|
|
@@ -164,10 +159,8 @@ var kucoin$1 = require('./src/pro/kucoin.js');
|
|
|
164
159
|
var kucoinfutures$1 = require('./src/pro/kucoinfutures.js');
|
|
165
160
|
var luno$1 = require('./src/pro/luno.js');
|
|
166
161
|
var mexc$1 = require('./src/pro/mexc.js');
|
|
167
|
-
var mexc3$1 = require('./src/pro/mexc3.js');
|
|
168
162
|
var ndax$1 = require('./src/pro/ndax.js');
|
|
169
163
|
var okcoin$1 = require('./src/pro/okcoin.js');
|
|
170
|
-
var okex$1 = require('./src/pro/okex.js');
|
|
171
164
|
var okx$1 = require('./src/pro/okx.js');
|
|
172
165
|
var phemex$1 = require('./src/pro/phemex.js');
|
|
173
166
|
var poloniex$1 = require('./src/pro/poloniex.js');
|
|
@@ -180,7 +173,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
180
173
|
|
|
181
174
|
//-----------------------------------------------------------------------------
|
|
182
175
|
// this is updated by vss.js when building
|
|
183
|
-
const version = '4.1.
|
|
176
|
+
const version = '4.1.59';
|
|
184
177
|
Exchange["default"].ccxtVersion = version;
|
|
185
178
|
const exchanges = {
|
|
186
179
|
'ace': ace,
|
|
@@ -247,7 +240,6 @@ const exchanges = {
|
|
|
247
240
|
'htx': htx,
|
|
248
241
|
'huobi': huobi,
|
|
249
242
|
'huobijp': huobijp,
|
|
250
|
-
'huobipro': huobipro,
|
|
251
243
|
'idex': idex,
|
|
252
244
|
'independentreserve': independentreserve,
|
|
253
245
|
'indodax': indodax,
|
|
@@ -262,13 +254,10 @@ const exchanges = {
|
|
|
262
254
|
'lykke': lykke,
|
|
263
255
|
'mercado': mercado,
|
|
264
256
|
'mexc': mexc,
|
|
265
|
-
'mexc3': mexc3,
|
|
266
257
|
'ndax': ndax,
|
|
267
258
|
'novadax': novadax,
|
|
268
259
|
'oceanex': oceanex,
|
|
269
260
|
'okcoin': okcoin,
|
|
270
|
-
'okex': okex,
|
|
271
|
-
'okex5': okex5,
|
|
272
261
|
'okx': okx,
|
|
273
262
|
'p2b': p2b,
|
|
274
263
|
'paymium': paymium,
|
|
@@ -328,7 +317,6 @@ const pro = {
|
|
|
328
317
|
'htx': htx$1,
|
|
329
318
|
'huobi': huobi$1,
|
|
330
319
|
'huobijp': huobijp$1,
|
|
331
|
-
'huobipro': huobipro$1,
|
|
332
320
|
'idex': idex$1,
|
|
333
321
|
'independentreserve': independentreserve$1,
|
|
334
322
|
'kraken': kraken$1,
|
|
@@ -337,10 +325,8 @@ const pro = {
|
|
|
337
325
|
'kucoinfutures': kucoinfutures$1,
|
|
338
326
|
'luno': luno$1,
|
|
339
327
|
'mexc': mexc$1,
|
|
340
|
-
'mexc3': mexc3$1,
|
|
341
328
|
'ndax': ndax$1,
|
|
342
329
|
'okcoin': okcoin$1,
|
|
343
|
-
'okex': okex$1,
|
|
344
330
|
'okx': okx$1,
|
|
345
331
|
'phemex': phemex$1,
|
|
346
332
|
'poloniex': poloniex$1,
|
|
@@ -456,7 +442,6 @@ exports.hollaex = hollaex;
|
|
|
456
442
|
exports.htx = htx;
|
|
457
443
|
exports.huobi = huobi;
|
|
458
444
|
exports.huobijp = huobijp;
|
|
459
|
-
exports.huobipro = huobipro;
|
|
460
445
|
exports.idex = idex;
|
|
461
446
|
exports.independentreserve = independentreserve;
|
|
462
447
|
exports.indodax = indodax;
|
|
@@ -471,13 +456,10 @@ exports.luno = luno;
|
|
|
471
456
|
exports.lykke = lykke;
|
|
472
457
|
exports.mercado = mercado;
|
|
473
458
|
exports.mexc = mexc;
|
|
474
|
-
exports.mexc3 = mexc3;
|
|
475
459
|
exports.ndax = ndax;
|
|
476
460
|
exports.novadax = novadax;
|
|
477
461
|
exports.oceanex = oceanex;
|
|
478
462
|
exports.okcoin = okcoin;
|
|
479
|
-
exports.okex = okex;
|
|
480
|
-
exports.okex5 = okex5;
|
|
481
463
|
exports.okx = okx;
|
|
482
464
|
exports.p2b = p2b;
|
|
483
465
|
exports.paymium = paymium;
|
|
@@ -2309,17 +2309,17 @@ class Exchange {
|
|
|
2309
2309
|
return result;
|
|
2310
2310
|
}
|
|
2311
2311
|
safeTicker(ticker, market = undefined) {
|
|
2312
|
-
let open = this.
|
|
2313
|
-
let close = this.
|
|
2314
|
-
let last = this.
|
|
2315
|
-
let change = this.
|
|
2316
|
-
let percentage = this.
|
|
2317
|
-
let average = this.
|
|
2318
|
-
let vwap = this.
|
|
2312
|
+
let open = this.omitZero(this.safeString(ticker, 'open'));
|
|
2313
|
+
let close = this.omitZero(this.safeString(ticker, 'close'));
|
|
2314
|
+
let last = this.omitZero(this.safeString(ticker, 'last'));
|
|
2315
|
+
let change = this.omitZero(this.safeString(ticker, 'change'));
|
|
2316
|
+
let percentage = this.omitZero(this.safeString(ticker, 'percentage'));
|
|
2317
|
+
let average = this.omitZero(this.safeString(ticker, 'average'));
|
|
2318
|
+
let vwap = this.omitZero(this.safeString(ticker, 'vwap'));
|
|
2319
2319
|
const baseVolume = this.safeString(ticker, 'baseVolume');
|
|
2320
2320
|
const quoteVolume = this.safeString(ticker, 'quoteVolume');
|
|
2321
2321
|
if (vwap === undefined) {
|
|
2322
|
-
vwap = Precise["default"].stringDiv(quoteVolume, baseVolume);
|
|
2322
|
+
vwap = Precise["default"].stringDiv(this.omitZero(quoteVolume), baseVolume);
|
|
2323
2323
|
}
|
|
2324
2324
|
if ((last !== undefined) && (close === undefined)) {
|
|
2325
2325
|
close = last;
|
|
@@ -2347,24 +2347,45 @@ class Exchange {
|
|
|
2347
2347
|
// timestamp and symbol operations don't belong in safeTicker
|
|
2348
2348
|
// they should be done in the derived classes
|
|
2349
2349
|
return this.extend(ticker, {
|
|
2350
|
-
'bid': this.omitZero(this.safeNumber(ticker, 'bid')),
|
|
2350
|
+
'bid': this.parseNumber(this.omitZero(this.safeNumber(ticker, 'bid'))),
|
|
2351
2351
|
'bidVolume': this.safeNumber(ticker, 'bidVolume'),
|
|
2352
|
-
'ask': this.omitZero(this.safeNumber(ticker, 'ask')),
|
|
2352
|
+
'ask': this.parseNumber(this.omitZero(this.safeNumber(ticker, 'ask'))),
|
|
2353
2353
|
'askVolume': this.safeNumber(ticker, 'askVolume'),
|
|
2354
|
-
'high': this.omitZero(this.
|
|
2355
|
-
'low': this.omitZero(this.safeNumber(ticker, 'low')),
|
|
2356
|
-
'open': this.omitZero(this.parseNumber(open)),
|
|
2357
|
-
'close': this.omitZero(this.parseNumber(close)),
|
|
2358
|
-
'last': this.omitZero(this.parseNumber(last)),
|
|
2354
|
+
'high': this.parseNumber(this.omitZero(this.safeString(ticker, 'high"'))),
|
|
2355
|
+
'low': this.parseNumber(this.omitZero(this.safeNumber(ticker, 'low'))),
|
|
2356
|
+
'open': this.parseNumber(this.omitZero(this.parseNumber(open))),
|
|
2357
|
+
'close': this.parseNumber(this.omitZero(this.parseNumber(close))),
|
|
2358
|
+
'last': this.parseNumber(this.omitZero(this.parseNumber(last))),
|
|
2359
2359
|
'change': this.parseNumber(change),
|
|
2360
2360
|
'percentage': this.parseNumber(percentage),
|
|
2361
|
-
'average': this.
|
|
2362
|
-
'vwap': this.
|
|
2361
|
+
'average': this.parseNumber(average),
|
|
2362
|
+
'vwap': this.parseNumber(vwap),
|
|
2363
2363
|
'baseVolume': this.parseNumber(baseVolume),
|
|
2364
2364
|
'quoteVolume': this.parseNumber(quoteVolume),
|
|
2365
2365
|
'previousClose': this.safeNumber(ticker, 'previousClose'),
|
|
2366
2366
|
});
|
|
2367
2367
|
}
|
|
2368
|
+
async fetchBorrowRate(code, amount, params = {}) {
|
|
2369
|
+
throw new errors.NotSupported(this.id + ' fetchBorrowRate is deprecated, please use fetchCrossBorrowRate or fetchIsolatedBorrowRate instead');
|
|
2370
|
+
}
|
|
2371
|
+
async repayCrossMargin(code, amount, params = {}) {
|
|
2372
|
+
throw new errors.NotSupported(this.id + ' repayCrossMargin is not support yet');
|
|
2373
|
+
}
|
|
2374
|
+
async repayIsolatedMargin(symbol, code, amount, params = {}) {
|
|
2375
|
+
throw new errors.NotSupported(this.id + ' repayIsolatedMargin is not support yet');
|
|
2376
|
+
}
|
|
2377
|
+
async borrowCrossMargin(code, amount, params = {}) {
|
|
2378
|
+
throw new errors.NotSupported(this.id + ' borrowCrossMargin is not support yet');
|
|
2379
|
+
}
|
|
2380
|
+
async borrowIsolatedMargin(symbol, code, amount, params = {}) {
|
|
2381
|
+
throw new errors.NotSupported(this.id + ' borrowIsolatedMargin is not support yet');
|
|
2382
|
+
}
|
|
2383
|
+
async borrowMargin(code, amount, symbol = undefined, params = {}) {
|
|
2384
|
+
throw new errors.NotSupported(this.id + ' borrowMargin is deprecated, please use borrowCrossMargin or borrowIsolatedMargin instead');
|
|
2385
|
+
}
|
|
2386
|
+
async repayMargin(code, amount, symbol = undefined, params = {}) {
|
|
2387
|
+
throw new errors.NotSupported(this.id + ' repayMargin is deprecated, please use repayCrossMargin or repayIsolatedMargin instead');
|
|
2388
|
+
}
|
|
2368
2389
|
async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
2369
2390
|
let message = '';
|
|
2370
2391
|
if (this.has['fetchTrades']) {
|
package/dist/cjs/src/binance.js
CHANGED
|
@@ -33,7 +33,8 @@ class binance extends binance$1 {
|
|
|
33
33
|
'future': true,
|
|
34
34
|
'option': true,
|
|
35
35
|
'addMargin': true,
|
|
36
|
-
'
|
|
36
|
+
'borrowCrossMargin': true,
|
|
37
|
+
'borrowIsolatedMargin': true,
|
|
37
38
|
'cancelAllOrders': true,
|
|
38
39
|
'cancelOrder': true,
|
|
39
40
|
'cancelOrders': true,
|
|
@@ -120,7 +121,8 @@ class binance extends binance$1 {
|
|
|
120
121
|
'fetchWithdrawals': true,
|
|
121
122
|
'fetchWithdrawalWhitelist': false,
|
|
122
123
|
'reduceMargin': true,
|
|
123
|
-
'
|
|
124
|
+
'repayCrossMargin': true,
|
|
125
|
+
'repayIsolatedMargin': true,
|
|
124
126
|
'setLeverage': true,
|
|
125
127
|
'setMargin': false,
|
|
126
128
|
'setMarginMode': true,
|
|
@@ -9102,32 +9104,55 @@ class binance extends binance$1 {
|
|
|
9102
9104
|
'info': info,
|
|
9103
9105
|
};
|
|
9104
9106
|
}
|
|
9105
|
-
async
|
|
9107
|
+
async repayCrossMargin(code, amount, params = {}) {
|
|
9106
9108
|
/**
|
|
9107
9109
|
* @method
|
|
9108
|
-
* @name binance#
|
|
9110
|
+
* @name binance#repayCrossMargin
|
|
9109
9111
|
* @description repay borrowed margin and interest
|
|
9110
9112
|
* @see https://binance-docs.github.io/apidocs/spot/en/#margin-account-repay-margin
|
|
9111
9113
|
* @param {string} code unified currency code of the currency to repay
|
|
9112
9114
|
* @param {float} amount the amount to repay
|
|
9115
|
+
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
9116
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
9117
|
+
*/
|
|
9118
|
+
await this.loadMarkets();
|
|
9119
|
+
const currency = this.currency(code);
|
|
9120
|
+
const request = {
|
|
9121
|
+
'asset': currency['id'],
|
|
9122
|
+
'amount': this.currencyToPrecision(code, amount),
|
|
9123
|
+
'isIsolated': 'FALSE',
|
|
9124
|
+
};
|
|
9125
|
+
const response = await this.sapiPostMarginRepay(this.extend(request, params));
|
|
9126
|
+
//
|
|
9127
|
+
// {
|
|
9128
|
+
// "tranId": 108988250265,
|
|
9129
|
+
// "clientTag":""
|
|
9130
|
+
// }
|
|
9131
|
+
//
|
|
9132
|
+
return this.parseMarginLoan(response, currency);
|
|
9133
|
+
}
|
|
9134
|
+
async repayIsolatedMargin(symbol, code, amount, params = {}) {
|
|
9135
|
+
/**
|
|
9136
|
+
* @method
|
|
9137
|
+
* @name binance#repayIsolatedMargin
|
|
9138
|
+
* @description repay borrowed margin and interest
|
|
9139
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#margin-account-repay-margin
|
|
9113
9140
|
* @param {string} symbol unified market symbol, required for isolated margin
|
|
9141
|
+
* @param {string} code unified currency code of the currency to repay
|
|
9142
|
+
* @param {float} amount the amount to repay
|
|
9114
9143
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
9115
9144
|
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
9116
9145
|
*/
|
|
9117
|
-
const [marginMode, query] = this.handleMarginModeAndParams('repayMargin', params); // cross or isolated
|
|
9118
|
-
this.checkRequiredMarginArgument('repayMargin', symbol, marginMode);
|
|
9119
9146
|
await this.loadMarkets();
|
|
9120
9147
|
const currency = this.currency(code);
|
|
9148
|
+
const market = this.market(symbol);
|
|
9121
9149
|
const request = {
|
|
9122
9150
|
'asset': currency['id'],
|
|
9123
9151
|
'amount': this.currencyToPrecision(code, amount),
|
|
9152
|
+
'symbol': market['id'],
|
|
9153
|
+
'isIsolated': 'TRUE',
|
|
9124
9154
|
};
|
|
9125
|
-
|
|
9126
|
-
const market = this.market(symbol);
|
|
9127
|
-
request['symbol'] = market['id'];
|
|
9128
|
-
request['isIsolated'] = 'TRUE';
|
|
9129
|
-
}
|
|
9130
|
-
const response = await this.sapiPostMarginRepay(this.extend(request, query));
|
|
9155
|
+
const response = await this.sapiPostMarginRepay(this.extend(request, params));
|
|
9131
9156
|
//
|
|
9132
9157
|
// {
|
|
9133
9158
|
// "tranId": 108988250265,
|
|
@@ -9136,32 +9161,55 @@ class binance extends binance$1 {
|
|
|
9136
9161
|
//
|
|
9137
9162
|
return this.parseMarginLoan(response, currency);
|
|
9138
9163
|
}
|
|
9139
|
-
async
|
|
9164
|
+
async borrowCrossMargin(code, amount, params = {}) {
|
|
9140
9165
|
/**
|
|
9141
9166
|
* @method
|
|
9142
|
-
* @name binance#
|
|
9167
|
+
* @name binance#borrowCrossMargin
|
|
9143
9168
|
* @description create a loan to borrow margin
|
|
9144
9169
|
* @see https://binance-docs.github.io/apidocs/spot/en/#margin-account-borrow-margin
|
|
9145
9170
|
* @param {string} code unified currency code of the currency to borrow
|
|
9146
9171
|
* @param {float} amount the amount to borrow
|
|
9172
|
+
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
9173
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
9174
|
+
*/
|
|
9175
|
+
await this.loadMarkets();
|
|
9176
|
+
const currency = this.currency(code);
|
|
9177
|
+
const request = {
|
|
9178
|
+
'asset': currency['id'],
|
|
9179
|
+
'amount': this.currencyToPrecision(code, amount),
|
|
9180
|
+
'isIsolated': 'FALSE',
|
|
9181
|
+
};
|
|
9182
|
+
const response = await this.sapiPostMarginLoan(this.extend(request, params));
|
|
9183
|
+
//
|
|
9184
|
+
// {
|
|
9185
|
+
// "tranId": 108988250265,
|
|
9186
|
+
// "clientTag":""
|
|
9187
|
+
// }
|
|
9188
|
+
//
|
|
9189
|
+
return this.parseMarginLoan(response, currency);
|
|
9190
|
+
}
|
|
9191
|
+
async borrowIsolatedMargin(symbol, code, amount, params = {}) {
|
|
9192
|
+
/**
|
|
9193
|
+
* @method
|
|
9194
|
+
* @name binance#borrowIsolatedMargin
|
|
9195
|
+
* @description create a loan to borrow margin
|
|
9196
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#margin-account-borrow-margin
|
|
9147
9197
|
* @param {string} symbol unified market symbol, required for isolated margin
|
|
9198
|
+
* @param {string} code unified currency code of the currency to borrow
|
|
9199
|
+
* @param {float} amount the amount to borrow
|
|
9148
9200
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
9149
9201
|
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
9150
9202
|
*/
|
|
9151
|
-
const [marginMode, query] = this.handleMarginModeAndParams('borrowMargin', params); // cross or isolated
|
|
9152
|
-
this.checkRequiredMarginArgument('borrowMargin', symbol, marginMode);
|
|
9153
9203
|
await this.loadMarkets();
|
|
9154
9204
|
const currency = this.currency(code);
|
|
9205
|
+
const market = this.market(symbol);
|
|
9155
9206
|
const request = {
|
|
9156
9207
|
'asset': currency['id'],
|
|
9157
9208
|
'amount': this.currencyToPrecision(code, amount),
|
|
9209
|
+
'symbol': market['id'],
|
|
9210
|
+
'isIsolated': 'TRUE',
|
|
9158
9211
|
};
|
|
9159
|
-
|
|
9160
|
-
const market = this.market(symbol);
|
|
9161
|
-
request['symbol'] = market['id'];
|
|
9162
|
-
request['isIsolated'] = 'TRUE';
|
|
9163
|
-
}
|
|
9164
|
-
const response = await this.sapiPostMarginLoan(this.extend(request, query));
|
|
9212
|
+
const response = await this.sapiPostMarginLoan(this.extend(request, params));
|
|
9165
9213
|
//
|
|
9166
9214
|
// {
|
|
9167
9215
|
// "tranId": 108988250265,
|
package/dist/cjs/src/bitget.js
CHANGED
|
@@ -30,7 +30,8 @@ class bitget extends bitget$1 {
|
|
|
30
30
|
'future': true,
|
|
31
31
|
'option': false,
|
|
32
32
|
'addMargin': true,
|
|
33
|
-
'
|
|
33
|
+
'borrowCrossMargin': true,
|
|
34
|
+
'borrowIsolatedMargin': true,
|
|
34
35
|
'cancelAllOrders': true,
|
|
35
36
|
'cancelOrder': true,
|
|
36
37
|
'cancelOrders': true,
|
|
@@ -94,7 +95,8 @@ class bitget extends bitget$1 {
|
|
|
94
95
|
'fetchWithdrawal': false,
|
|
95
96
|
'fetchWithdrawals': true,
|
|
96
97
|
'reduceMargin': true,
|
|
97
|
-
'
|
|
98
|
+
'repayCrossMargin': true,
|
|
99
|
+
'repayIsolatedMargin': true,
|
|
98
100
|
'setLeverage': true,
|
|
99
101
|
'setMarginMode': true,
|
|
100
102
|
'setPositionMode': true,
|
|
@@ -6295,18 +6297,15 @@ class bitget extends bitget$1 {
|
|
|
6295
6297
|
'info': interest,
|
|
6296
6298
|
}, market);
|
|
6297
6299
|
}
|
|
6298
|
-
async
|
|
6300
|
+
async borrowCrossMargin(code, amount, params = {}) {
|
|
6299
6301
|
/**
|
|
6300
6302
|
* @method
|
|
6301
|
-
* @name bitget#
|
|
6303
|
+
* @name bitget#borrowCrossMargin
|
|
6302
6304
|
* @description create a loan to borrow margin
|
|
6303
6305
|
* @see https://bitgetlimited.github.io/apidoc/en/margin/#cross-borrow
|
|
6304
|
-
* @see https://bitgetlimited.github.io/apidoc/en/margin/#isolated-borrow
|
|
6305
6306
|
* @param {string} code unified currency code of the currency to borrow
|
|
6306
6307
|
* @param {string} amount the amount to borrow
|
|
6307
|
-
* @param {string} [symbol] unified market symbol
|
|
6308
6308
|
* @param {object} [params] extra parameters specific to the bitget api endpoint
|
|
6309
|
-
* @param {string} [params.marginMode] 'isolated' or 'cross', symbol is required for 'isolated'
|
|
6310
6309
|
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
6311
6310
|
*/
|
|
6312
6311
|
await this.loadMarkets();
|
|
@@ -6315,91 +6314,91 @@ class bitget extends bitget$1 {
|
|
|
6315
6314
|
'coin': currency['info']['coinName'],
|
|
6316
6315
|
'borrowAmount': this.currencyToPrecision(code, amount),
|
|
6317
6316
|
};
|
|
6318
|
-
|
|
6319
|
-
let marginMode = undefined;
|
|
6320
|
-
[marginMode, params] = this.handleMarginModeAndParams('borrowMargin', params);
|
|
6321
|
-
if ((symbol !== undefined) || (marginMode === 'isolated')) {
|
|
6322
|
-
if (symbol === undefined) {
|
|
6323
|
-
throw new errors.ArgumentsRequired(this.id + ' borrowMargin() requires a symbol argument');
|
|
6324
|
-
}
|
|
6325
|
-
const market = this.market(symbol);
|
|
6326
|
-
const marketId = market['id'];
|
|
6327
|
-
const parts = marketId.split('_');
|
|
6328
|
-
const marginMarketId = this.safeStringUpper(parts, 0);
|
|
6329
|
-
request['symbol'] = marginMarketId;
|
|
6330
|
-
response = await this.privateMarginPostMarginV1IsolatedAccountBorrow(this.extend(request, params));
|
|
6331
|
-
}
|
|
6332
|
-
else {
|
|
6333
|
-
response = await this.privateMarginPostMarginV1CrossAccountBorrow(this.extend(request, params));
|
|
6334
|
-
}
|
|
6317
|
+
const response = await this.privateMarginPostMarginV1CrossAccountBorrow(this.extend(request, params));
|
|
6335
6318
|
//
|
|
6336
|
-
//
|
|
6319
|
+
// cross
|
|
6337
6320
|
//
|
|
6338
6321
|
// {
|
|
6339
6322
|
// "code": "00000",
|
|
6340
6323
|
// "msg": "success",
|
|
6341
|
-
// "requestTime":
|
|
6324
|
+
// "requestTime": 1697251314271,
|
|
6342
6325
|
// "data": {
|
|
6343
6326
|
// "clientOid": null,
|
|
6344
|
-
// "symbol": "BTCUSDT",
|
|
6345
6327
|
// "coin": "BTC",
|
|
6346
|
-
// "borrowAmount": "0.
|
|
6328
|
+
// "borrowAmount": "0.0001"
|
|
6347
6329
|
// }
|
|
6348
6330
|
// }
|
|
6349
6331
|
//
|
|
6350
|
-
|
|
6332
|
+
const data = this.safeValue(response, 'data', {});
|
|
6333
|
+
return this.parseMarginLoan(data, currency);
|
|
6334
|
+
}
|
|
6335
|
+
async borrowIsolatedMargin(symbol, code, amount, params = {}) {
|
|
6336
|
+
/**
|
|
6337
|
+
* @method
|
|
6338
|
+
* @name bitget#borrowIsolatedMargin
|
|
6339
|
+
* @description create a loan to borrow margin
|
|
6340
|
+
* @see https://bitgetlimited.github.io/apidoc/en/margin/#isolated-borrow
|
|
6341
|
+
* @param {string} symbol unified market symbol
|
|
6342
|
+
* @param {string} code unified currency code of the currency to borrow
|
|
6343
|
+
* @param {string} amount the amount to borrow
|
|
6344
|
+
* @param {object} [params] extra parameters specific to the bitget api endpoint
|
|
6345
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
6346
|
+
*/
|
|
6347
|
+
await this.loadMarkets();
|
|
6348
|
+
const currency = this.currency(code);
|
|
6349
|
+
const market = this.market(symbol);
|
|
6350
|
+
const marketId = market['id'];
|
|
6351
|
+
const parts = marketId.split('_');
|
|
6352
|
+
const marginMarketId = this.safeStringUpper(parts, 0);
|
|
6353
|
+
const request = {
|
|
6354
|
+
'coin': currency['info']['coinName'],
|
|
6355
|
+
'borrowAmount': this.currencyToPrecision(code, amount),
|
|
6356
|
+
'symbol': marginMarketId,
|
|
6357
|
+
};
|
|
6358
|
+
const response = await this.privateMarginPostMarginV1IsolatedAccountBorrow(this.extend(request, params));
|
|
6359
|
+
//
|
|
6360
|
+
// isolated
|
|
6351
6361
|
//
|
|
6352
6362
|
// {
|
|
6353
6363
|
// "code": "00000",
|
|
6354
6364
|
// "msg": "success",
|
|
6355
|
-
// "requestTime":
|
|
6365
|
+
// "requestTime": 1697250952516,
|
|
6356
6366
|
// "data": {
|
|
6357
6367
|
// "clientOid": null,
|
|
6368
|
+
// "symbol": "BTCUSDT",
|
|
6358
6369
|
// "coin": "BTC",
|
|
6359
|
-
// "borrowAmount": "0.
|
|
6370
|
+
// "borrowAmount": "0.001"
|
|
6360
6371
|
// }
|
|
6361
6372
|
// }
|
|
6362
6373
|
//
|
|
6363
6374
|
const data = this.safeValue(response, 'data', {});
|
|
6364
6375
|
return this.parseMarginLoan(data, currency);
|
|
6365
6376
|
}
|
|
6366
|
-
async
|
|
6377
|
+
async repayIsolatedMargin(symbol, code, amount, params = {}) {
|
|
6367
6378
|
/**
|
|
6368
6379
|
* @method
|
|
6369
|
-
* @name bitget#
|
|
6380
|
+
* @name bitget#repayIsolatedMargin
|
|
6370
6381
|
* @description repay borrowed margin and interest
|
|
6371
6382
|
* @see https://bitgetlimited.github.io/apidoc/en/margin/#cross-repay
|
|
6372
6383
|
* @see https://bitgetlimited.github.io/apidoc/en/margin/#isolated-repay
|
|
6384
|
+
* @param {string} symbol unified market symbol
|
|
6373
6385
|
* @param {string} code unified currency code of the currency to repay
|
|
6374
6386
|
* @param {string} amount the amount to repay
|
|
6375
|
-
* @param {string} [symbol] unified market symbol
|
|
6376
6387
|
* @param {object} [params] extra parameters specific to the bitget api endpoint
|
|
6377
|
-
* @param {string} [params.marginMode] 'isolated' or 'cross', symbol is required for 'isolated'
|
|
6378
6388
|
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
6379
6389
|
*/
|
|
6380
6390
|
await this.loadMarkets();
|
|
6381
6391
|
const currency = this.currency(code);
|
|
6392
|
+
const market = this.market(symbol);
|
|
6393
|
+
const marketId = market['id'];
|
|
6394
|
+
const parts = marketId.split('_');
|
|
6395
|
+
const marginMarketId = this.safeStringUpper(parts, 0);
|
|
6382
6396
|
const request = {
|
|
6383
6397
|
'coin': currency['info']['coinName'],
|
|
6384
6398
|
'repayAmount': this.currencyToPrecision(code, amount),
|
|
6399
|
+
'symbol': marginMarketId,
|
|
6385
6400
|
};
|
|
6386
|
-
|
|
6387
|
-
let marginMode = undefined;
|
|
6388
|
-
[marginMode, params] = this.handleMarginModeAndParams('repayMargin', params);
|
|
6389
|
-
if ((symbol !== undefined) || (marginMode === 'isolated')) {
|
|
6390
|
-
if (symbol === undefined) {
|
|
6391
|
-
throw new errors.ArgumentsRequired(this.id + ' repayMargin() requires a symbol argument');
|
|
6392
|
-
}
|
|
6393
|
-
const market = this.market(symbol);
|
|
6394
|
-
const marketId = market['id'];
|
|
6395
|
-
const parts = marketId.split('_');
|
|
6396
|
-
const marginMarketId = this.safeStringUpper(parts, 0);
|
|
6397
|
-
request['symbol'] = marginMarketId;
|
|
6398
|
-
response = await this.privateMarginPostMarginV1IsolatedAccountRepay(this.extend(request, params));
|
|
6399
|
-
}
|
|
6400
|
-
else {
|
|
6401
|
-
response = await this.privateMarginPostMarginV1CrossAccountRepay(this.extend(request, params));
|
|
6402
|
-
}
|
|
6401
|
+
const response = await this.privateMarginPostMarginV1IsolatedAccountRepay(this.extend(request, params));
|
|
6403
6402
|
//
|
|
6404
6403
|
// isolated
|
|
6405
6404
|
//
|
|
@@ -6416,6 +6415,29 @@ class bitget extends bitget$1 {
|
|
|
6416
6415
|
// }
|
|
6417
6416
|
// }
|
|
6418
6417
|
//
|
|
6418
|
+
const data = this.safeValue(response, 'data', {});
|
|
6419
|
+
return this.parseMarginLoan(data, currency);
|
|
6420
|
+
}
|
|
6421
|
+
async repayCrossMargin(code, amount, params = {}) {
|
|
6422
|
+
/**
|
|
6423
|
+
* @method
|
|
6424
|
+
* @name bitget#repayCrossMargin
|
|
6425
|
+
* @description repay borrowed margin and interest
|
|
6426
|
+
* @see https://bitgetlimited.github.io/apidoc/en/margin/#cross-repay
|
|
6427
|
+
* @see https://bitgetlimited.github.io/apidoc/en/margin/#isolated-repay
|
|
6428
|
+
* @param {string} code unified currency code of the currency to repay
|
|
6429
|
+
* @param {string} amount the amount to repay
|
|
6430
|
+
* @param {object} [params] extra parameters specific to the bitget api endpoint
|
|
6431
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
6432
|
+
*/
|
|
6433
|
+
await this.loadMarkets();
|
|
6434
|
+
const currency = this.currency(code);
|
|
6435
|
+
const request = {
|
|
6436
|
+
'coin': currency['info']['coinName'],
|
|
6437
|
+
'repayAmount': this.currencyToPrecision(code, amount),
|
|
6438
|
+
};
|
|
6439
|
+
const response = await this.privateMarginPostMarginV1CrossAccountRepay(this.extend(request, params));
|
|
6440
|
+
//
|
|
6419
6441
|
// cross
|
|
6420
6442
|
//
|
|
6421
6443
|
// {
|
package/dist/cjs/src/bitmart.js
CHANGED
|
@@ -31,7 +31,8 @@ class bitmart extends bitmart$1 {
|
|
|
31
31
|
'swap': true,
|
|
32
32
|
'future': false,
|
|
33
33
|
'option': false,
|
|
34
|
-
'
|
|
34
|
+
'borrowCrossMargin': false,
|
|
35
|
+
'borrowIsolatedMargin': true,
|
|
35
36
|
'cancelAllOrders': true,
|
|
36
37
|
'cancelOrder': true,
|
|
37
38
|
'cancelOrders': false,
|
|
@@ -93,7 +94,8 @@ class bitmart extends bitmart$1 {
|
|
|
93
94
|
'fetchWithdrawal': true,
|
|
94
95
|
'fetchWithdrawals': true,
|
|
95
96
|
'reduceMargin': false,
|
|
96
|
-
'
|
|
97
|
+
'repayCrossMargin': false,
|
|
98
|
+
'repayIsolatedMargin': true,
|
|
97
99
|
'setLeverage': true,
|
|
98
100
|
'setMarginMode': false,
|
|
99
101
|
'transfer': true,
|
|
@@ -3197,22 +3199,18 @@ class bitmart extends bitmart$1 {
|
|
|
3197
3199
|
'fee': fee,
|
|
3198
3200
|
};
|
|
3199
3201
|
}
|
|
3200
|
-
async
|
|
3202
|
+
async repayIsolatedMargin(symbol, code, amount, params = {}) {
|
|
3201
3203
|
/**
|
|
3202
3204
|
* @method
|
|
3203
|
-
* @name bitmart#
|
|
3205
|
+
* @name bitmart#repayIsolatedMargin
|
|
3204
3206
|
* @description repay borrowed margin and interest
|
|
3205
3207
|
* @see https://developer-pro.bitmart.com/en/spot/#margin-repay-isolated
|
|
3208
|
+
* @param {string} symbol unified market symbol
|
|
3206
3209
|
* @param {string} code unified currency code of the currency to repay
|
|
3207
3210
|
* @param {string} amount the amount to repay
|
|
3208
|
-
* @param {string} symbol unified market symbol
|
|
3209
3211
|
* @param {object} [params] extra parameters specific to the bitmart api endpoint
|
|
3210
|
-
* @param {string} [params.marginMode] 'isolated' is the default and 'cross' is unavailable
|
|
3211
3212
|
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
3212
3213
|
*/
|
|
3213
|
-
if (symbol === undefined) {
|
|
3214
|
-
throw new errors.ArgumentsRequired(this.id + ' repayMargin() requires a symbol argument');
|
|
3215
|
-
}
|
|
3216
3214
|
await this.loadMarkets();
|
|
3217
3215
|
const market = this.market(symbol);
|
|
3218
3216
|
const currency = this.currency(code);
|
|
@@ -3221,7 +3219,6 @@ class bitmart extends bitmart$1 {
|
|
|
3221
3219
|
'currency': currency['id'],
|
|
3222
3220
|
'amount': this.currencyToPrecision(code, amount),
|
|
3223
3221
|
};
|
|
3224
|
-
params = this.omit(params, 'marginMode');
|
|
3225
3222
|
const response = await this.privatePostSpotV1MarginIsolatedRepay(this.extend(request, params));
|
|
3226
3223
|
//
|
|
3227
3224
|
// {
|
|
@@ -3240,22 +3237,18 @@ class bitmart extends bitmart$1 {
|
|
|
3240
3237
|
'symbol': symbol,
|
|
3241
3238
|
});
|
|
3242
3239
|
}
|
|
3243
|
-
async
|
|
3240
|
+
async borrowIsolatedMargin(symbol, code, amount, params = {}) {
|
|
3244
3241
|
/**
|
|
3245
3242
|
* @method
|
|
3246
|
-
* @name bitmart#
|
|
3243
|
+
* @name bitmart#borrowIsolatedMargin
|
|
3247
3244
|
* @description create a loan to borrow margin
|
|
3248
3245
|
* @see https://developer-pro.bitmart.com/en/spot/#margin-borrow-isolated
|
|
3246
|
+
* @param {string} symbol unified market symbol
|
|
3249
3247
|
* @param {string} code unified currency code of the currency to borrow
|
|
3250
3248
|
* @param {string} amount the amount to borrow
|
|
3251
|
-
* @param {string} symbol unified market symbol
|
|
3252
3249
|
* @param {object} [params] extra parameters specific to the bitmart api endpoint
|
|
3253
|
-
* @param {string} [params.marginMode] 'isolated' is the default and 'cross' is unavailable
|
|
3254
3250
|
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
3255
3251
|
*/
|
|
3256
|
-
if (symbol === undefined) {
|
|
3257
|
-
throw new errors.ArgumentsRequired(this.id + ' borrowMargin() requires a symbol argument');
|
|
3258
|
-
}
|
|
3259
3252
|
await this.loadMarkets();
|
|
3260
3253
|
const market = this.market(symbol);
|
|
3261
3254
|
const currency = this.currency(code);
|
|
@@ -3264,7 +3257,6 @@ class bitmart extends bitmart$1 {
|
|
|
3264
3257
|
'currency': currency['id'],
|
|
3265
3258
|
'amount': this.currencyToPrecision(code, amount),
|
|
3266
3259
|
};
|
|
3267
|
-
params = this.omit(params, 'marginMode');
|
|
3268
3260
|
const response = await this.privatePostSpotV1MarginIsolatedBorrow(this.extend(request, params));
|
|
3269
3261
|
//
|
|
3270
3262
|
// {
|
package/dist/cjs/src/bitrue.js
CHANGED
|
@@ -93,7 +93,7 @@ class bitrue extends bitrue$1 {
|
|
|
93
93
|
'kline': 'https://www.bitrue.com/kline-api',
|
|
94
94
|
},
|
|
95
95
|
'www': 'https://www.bitrue.com',
|
|
96
|
-
'referral': 'https://www.bitrue.com/
|
|
96
|
+
'referral': 'https://www.bitrue.com/affiliate/landing?cn=600000&inviteCode=EZWETQE',
|
|
97
97
|
'doc': [
|
|
98
98
|
'https://github.com/Bitrue-exchange/bitrue-official-api-docs',
|
|
99
99
|
],
|