ccxt 4.2.87 → 4.2.88
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/CHANGELOG.md +87 -0
- package/README.md +4 -5
- package/build.sh +1 -1
- package/dist/ccxt.browser.js +78 -40
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +6 -1
- package/dist/cjs/src/base/Exchange.js +26 -2
- package/dist/cjs/src/binance.js +10 -6
- package/dist/cjs/src/bitget.js +17 -16
- package/dist/cjs/src/cryptocom.js +1 -1
- package/dist/cjs/src/gate.js +8 -8
- package/dist/cjs/src/krakenfutures.js +2 -1
- package/dist/cjs/src/kucoin.js +7 -4
- package/dist/cjs/src/mexc.js +1 -1
- package/examples/js/cli.js +0 -2
- package/examples/ts/cli.ts +0 -2
- package/js/ccxt.d.ts +3 -3
- package/js/ccxt.js +3 -3
- package/js/src/base/Exchange.d.ts +1 -0
- package/js/src/base/Exchange.js +26 -2
- package/js/src/base/types.d.ts +1 -1
- package/js/src/binance.d.ts +1 -1
- package/js/src/binance.js +10 -6
- package/js/src/bitget.js +17 -16
- package/js/src/cryptocom.js +1 -1
- package/js/src/gate.js +8 -8
- package/js/src/krakenfutures.js +2 -1
- package/js/src/kucoin.js +7 -4
- package/js/src/mexc.js +1 -1
- package/package.json +1 -1
package/js/src/bitget.js
CHANGED
|
@@ -1298,6 +1298,7 @@ export default class bitget extends Exchange {
|
|
|
1298
1298
|
'commonCurrencies': {
|
|
1299
1299
|
'JADE': 'Jade Protocol',
|
|
1300
1300
|
'DEGEN': 'DegenReborn',
|
|
1301
|
+
'TONCOIN': 'TON',
|
|
1301
1302
|
},
|
|
1302
1303
|
'options': {
|
|
1303
1304
|
'timeframes': {
|
|
@@ -1877,8 +1878,8 @@ export default class bitget extends Exchange {
|
|
|
1877
1878
|
const data = this.safeValue(response, 'data', []);
|
|
1878
1879
|
for (let i = 0; i < data.length; i++) {
|
|
1879
1880
|
const entry = data[i];
|
|
1880
|
-
const id = this.safeString(entry, 'coinId')
|
|
1881
|
-
const code = this.safeCurrencyCode(
|
|
1881
|
+
const id = this.safeString(entry, 'coin'); // we don't use 'coinId' as it has no use. it is 'coin' field that needs to be used in currency related endpoints (deposit, withdraw, etc..)
|
|
1882
|
+
const code = this.safeCurrencyCode(id);
|
|
1882
1883
|
const chains = this.safeValue(entry, 'chains', []);
|
|
1883
1884
|
const networks = {};
|
|
1884
1885
|
let deposit = false;
|
|
@@ -2007,7 +2008,7 @@ export default class bitget extends Exchange {
|
|
|
2007
2008
|
}
|
|
2008
2009
|
params = this.omit(params, 'code');
|
|
2009
2010
|
const currency = this.currency(code);
|
|
2010
|
-
request['coin'] = currency['
|
|
2011
|
+
request['coin'] = currency['id'];
|
|
2011
2012
|
response = await this.privateMarginGetV2MarginCrossedTierData(this.extend(request, params));
|
|
2012
2013
|
}
|
|
2013
2014
|
else {
|
|
@@ -2163,7 +2164,7 @@ export default class bitget extends Exchange {
|
|
|
2163
2164
|
since = this.milliseconds() - 7776000000; // 90 days
|
|
2164
2165
|
}
|
|
2165
2166
|
let request = {
|
|
2166
|
-
'coin': currency['
|
|
2167
|
+
'coin': currency['id'],
|
|
2167
2168
|
'startTime': since,
|
|
2168
2169
|
'endTime': this.milliseconds(),
|
|
2169
2170
|
};
|
|
@@ -2222,7 +2223,7 @@ export default class bitget extends Exchange {
|
|
|
2222
2223
|
const currency = this.currency(code);
|
|
2223
2224
|
const networkId = this.networkCodeToId(chain);
|
|
2224
2225
|
const request = {
|
|
2225
|
-
'coin': currency['
|
|
2226
|
+
'coin': currency['id'],
|
|
2226
2227
|
'address': address,
|
|
2227
2228
|
'chain': networkId,
|
|
2228
2229
|
'size': amount,
|
|
@@ -2308,7 +2309,7 @@ export default class bitget extends Exchange {
|
|
|
2308
2309
|
since = this.milliseconds() - 7776000000; // 90 days
|
|
2309
2310
|
}
|
|
2310
2311
|
let request = {
|
|
2311
|
-
'coin': currency['
|
|
2312
|
+
'coin': currency['id'],
|
|
2312
2313
|
'startTime': since,
|
|
2313
2314
|
'endTime': this.milliseconds(),
|
|
2314
2315
|
};
|
|
@@ -2451,7 +2452,7 @@ export default class bitget extends Exchange {
|
|
|
2451
2452
|
}
|
|
2452
2453
|
const currency = this.currency(code);
|
|
2453
2454
|
const request = {
|
|
2454
|
-
'coin': currency['
|
|
2455
|
+
'coin': currency['id'],
|
|
2455
2456
|
};
|
|
2456
2457
|
if (networkId !== undefined) {
|
|
2457
2458
|
request['chain'] = networkId;
|
|
@@ -5904,7 +5905,7 @@ export default class bitget extends Exchange {
|
|
|
5904
5905
|
let request = {};
|
|
5905
5906
|
if (code !== undefined) {
|
|
5906
5907
|
currency = this.currency(code);
|
|
5907
|
-
request['coin'] = currency['
|
|
5908
|
+
request['coin'] = currency['id'];
|
|
5908
5909
|
}
|
|
5909
5910
|
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
5910
5911
|
if (since !== undefined) {
|
|
@@ -7343,7 +7344,7 @@ export default class bitget extends Exchange {
|
|
|
7343
7344
|
type = this.safeString(accountsByType, fromAccount);
|
|
7344
7345
|
const currency = this.currency(code);
|
|
7345
7346
|
let request = {
|
|
7346
|
-
'coin': currency['
|
|
7347
|
+
'coin': currency['id'],
|
|
7347
7348
|
'fromType': type,
|
|
7348
7349
|
};
|
|
7349
7350
|
if (since !== undefined) {
|
|
@@ -7402,7 +7403,7 @@ export default class bitget extends Exchange {
|
|
|
7402
7403
|
'fromType': fromType,
|
|
7403
7404
|
'toType': toType,
|
|
7404
7405
|
'amount': amount,
|
|
7405
|
-
'coin': currency['
|
|
7406
|
+
'coin': currency['id'],
|
|
7406
7407
|
};
|
|
7407
7408
|
const symbol = this.safeString(params, 'symbol');
|
|
7408
7409
|
params = this.omit(params, 'symbol');
|
|
@@ -7589,7 +7590,7 @@ export default class bitget extends Exchange {
|
|
|
7589
7590
|
await this.loadMarkets();
|
|
7590
7591
|
const currency = this.currency(code);
|
|
7591
7592
|
const request = {
|
|
7592
|
-
'coin': currency['
|
|
7593
|
+
'coin': currency['id'],
|
|
7593
7594
|
'borrowAmount': this.currencyToPrecision(code, amount),
|
|
7594
7595
|
};
|
|
7595
7596
|
const response = await this.privateMarginPostV2MarginCrossedAccountBorrow(this.extend(request, params));
|
|
@@ -7624,7 +7625,7 @@ export default class bitget extends Exchange {
|
|
|
7624
7625
|
const currency = this.currency(code);
|
|
7625
7626
|
const market = this.market(symbol);
|
|
7626
7627
|
const request = {
|
|
7627
|
-
'coin': currency['
|
|
7628
|
+
'coin': currency['id'],
|
|
7628
7629
|
'borrowAmount': this.currencyToPrecision(code, amount),
|
|
7629
7630
|
'symbol': market['id'],
|
|
7630
7631
|
};
|
|
@@ -7661,7 +7662,7 @@ export default class bitget extends Exchange {
|
|
|
7661
7662
|
const currency = this.currency(code);
|
|
7662
7663
|
const market = this.market(symbol);
|
|
7663
7664
|
const request = {
|
|
7664
|
-
'coin': currency['
|
|
7665
|
+
'coin': currency['id'],
|
|
7665
7666
|
'repayAmount': this.currencyToPrecision(code, amount),
|
|
7666
7667
|
'symbol': market['id'],
|
|
7667
7668
|
};
|
|
@@ -7697,7 +7698,7 @@ export default class bitget extends Exchange {
|
|
|
7697
7698
|
await this.loadMarkets();
|
|
7698
7699
|
const currency = this.currency(code);
|
|
7699
7700
|
const request = {
|
|
7700
|
-
'coin': currency['
|
|
7701
|
+
'coin': currency['id'],
|
|
7701
7702
|
'repayAmount': this.currencyToPrecision(code, amount),
|
|
7702
7703
|
};
|
|
7703
7704
|
const response = await this.privateMarginPostV2MarginCrossedAccountRepay(this.extend(request, params));
|
|
@@ -8059,7 +8060,7 @@ export default class bitget extends Exchange {
|
|
|
8059
8060
|
await this.loadMarkets();
|
|
8060
8061
|
const currency = this.currency(code);
|
|
8061
8062
|
const request = {
|
|
8062
|
-
'coin': currency['
|
|
8063
|
+
'coin': currency['id'],
|
|
8063
8064
|
};
|
|
8064
8065
|
const response = await this.privateMarginGetV2MarginCrossedInterestRateAndLimit(this.extend(request, params));
|
|
8065
8066
|
//
|
|
@@ -8154,7 +8155,7 @@ export default class bitget extends Exchange {
|
|
|
8154
8155
|
let currency = undefined;
|
|
8155
8156
|
if (code !== undefined) {
|
|
8156
8157
|
currency = this.currency(code);
|
|
8157
|
-
request['coin'] = currency['
|
|
8158
|
+
request['coin'] = currency['id'];
|
|
8158
8159
|
}
|
|
8159
8160
|
if (since !== undefined) {
|
|
8160
8161
|
request['startTime'] = since;
|
package/js/src/cryptocom.js
CHANGED
|
@@ -2758,7 +2758,7 @@ export default class cryptocom extends Exchange {
|
|
|
2758
2758
|
//
|
|
2759
2759
|
const result = this.safeDict(response, 'result', {});
|
|
2760
2760
|
const data = this.safeList(result, 'data', []);
|
|
2761
|
-
return this.parsePosition(data
|
|
2761
|
+
return this.parsePosition(this.safeDict(data, 0), market);
|
|
2762
2762
|
}
|
|
2763
2763
|
async fetchPositions(symbols = undefined, params = {}) {
|
|
2764
2764
|
/**
|
package/js/src/gate.js
CHANGED
|
@@ -1862,7 +1862,7 @@ export default class gate extends Exchange {
|
|
|
1862
1862
|
await this.loadMarkets();
|
|
1863
1863
|
const currency = this.currency(code);
|
|
1864
1864
|
const request = {
|
|
1865
|
-
'currency': currency['id'],
|
|
1865
|
+
'currency': currency['id'], // todo: currencies have network-junctions
|
|
1866
1866
|
};
|
|
1867
1867
|
const response = await this.privateWalletGetDepositAddress(this.extend(request, params));
|
|
1868
1868
|
const addresses = this.safeValue(response, 'multichain_addresses');
|
|
@@ -1913,7 +1913,7 @@ export default class gate extends Exchange {
|
|
|
1913
1913
|
const rawNetwork = this.safeStringUpper(params, 'network');
|
|
1914
1914
|
params = this.omit(params, 'network');
|
|
1915
1915
|
const request = {
|
|
1916
|
-
'currency': currency['id'],
|
|
1916
|
+
'currency': currency['id'], // todo: currencies have network-junctions
|
|
1917
1917
|
};
|
|
1918
1918
|
const response = await this.privateWalletGetDepositAddress(this.extend(request, params));
|
|
1919
1919
|
//
|
|
@@ -3529,7 +3529,7 @@ export default class gate extends Exchange {
|
|
|
3529
3529
|
let currency = undefined;
|
|
3530
3530
|
if (code !== undefined) {
|
|
3531
3531
|
currency = this.currency(code);
|
|
3532
|
-
request['currency'] = currency['id'];
|
|
3532
|
+
request['currency'] = currency['id']; // todo: currencies have network-junctions
|
|
3533
3533
|
}
|
|
3534
3534
|
if (limit !== undefined) {
|
|
3535
3535
|
request['limit'] = limit;
|
|
@@ -3567,7 +3567,7 @@ export default class gate extends Exchange {
|
|
|
3567
3567
|
let currency = undefined;
|
|
3568
3568
|
if (code !== undefined) {
|
|
3569
3569
|
currency = this.currency(code);
|
|
3570
|
-
request['currency'] = currency['id'];
|
|
3570
|
+
request['currency'] = currency['id']; // todo: currencies have network-junctions
|
|
3571
3571
|
}
|
|
3572
3572
|
if (limit !== undefined) {
|
|
3573
3573
|
request['limit'] = limit;
|
|
@@ -3614,7 +3614,7 @@ export default class gate extends Exchange {
|
|
|
3614
3614
|
params = this.omit(params, 'network');
|
|
3615
3615
|
}
|
|
3616
3616
|
else {
|
|
3617
|
-
request['chain'] = currency['id'];
|
|
3617
|
+
request['chain'] = currency['id']; // todo: currencies have network-junctions
|
|
3618
3618
|
}
|
|
3619
3619
|
const response = await this.privateWithdrawalsPostWithdrawals(this.extend(request, params));
|
|
3620
3620
|
//
|
|
@@ -5148,7 +5148,7 @@ export default class gate extends Exchange {
|
|
|
5148
5148
|
params = this.omit(params, 'symbol');
|
|
5149
5149
|
}
|
|
5150
5150
|
if ((toId === 'futures') || (toId === 'delivery') || (fromId === 'futures') || (fromId === 'delivery')) {
|
|
5151
|
-
request['settle'] = currency['id'];
|
|
5151
|
+
request['settle'] = currency['id']; // todo: currencies have network-junctions
|
|
5152
5152
|
}
|
|
5153
5153
|
const response = await this.privateWalletPostTransfers(this.extend(request, params));
|
|
5154
5154
|
//
|
|
@@ -6456,7 +6456,7 @@ export default class gate extends Exchange {
|
|
|
6456
6456
|
if ((type === 'spot') || (type === 'margin')) {
|
|
6457
6457
|
if (code !== undefined) {
|
|
6458
6458
|
currency = this.currency(code);
|
|
6459
|
-
request['currency'] = currency['id'];
|
|
6459
|
+
request['currency'] = currency['id']; // todo: currencies have network-junctions
|
|
6460
6460
|
}
|
|
6461
6461
|
}
|
|
6462
6462
|
if ((type === 'swap') || (type === 'future')) {
|
|
@@ -7275,7 +7275,7 @@ export default class gate extends Exchange {
|
|
|
7275
7275
|
await this.loadMarkets();
|
|
7276
7276
|
const currency = this.currency(code);
|
|
7277
7277
|
const request = {
|
|
7278
|
-
'underlying': currency['code'] + '_USDT',
|
|
7278
|
+
'underlying': currency['code'] + '_USDT', // todo: currency['id'].toUpperCase () & network junctions
|
|
7279
7279
|
};
|
|
7280
7280
|
const response = await this.publicOptionsGetContracts(this.extend(request, params));
|
|
7281
7281
|
//
|
package/js/src/krakenfutures.js
CHANGED
|
@@ -355,7 +355,8 @@ export default class krakenfutures extends Exchange {
|
|
|
355
355
|
// swap == perpetual
|
|
356
356
|
let settle = undefined;
|
|
357
357
|
let settleId = undefined;
|
|
358
|
-
const
|
|
358
|
+
const cvtp = this.safeString(market, 'contractValueTradePrecision');
|
|
359
|
+
const amountPrecision = this.parseNumber(this.integerPrecisionToAmount(cvtp));
|
|
359
360
|
const pricePrecision = this.safeNumber(market, 'tickSize');
|
|
360
361
|
const contract = (swap || future || index);
|
|
361
362
|
const swapOrFutures = (swap || future);
|
package/js/src/kucoin.js
CHANGED
|
@@ -3540,9 +3540,9 @@ export default class kucoin extends Exchange {
|
|
|
3540
3540
|
* @method
|
|
3541
3541
|
* @name kucoin#fetchBalance
|
|
3542
3542
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
3543
|
-
* @see https://docs.kucoin.com/#list-accounts
|
|
3544
3543
|
* @see https://www.kucoin.com/docs/rest/account/basic-info/get-account-list-spot-margin-trade_hf
|
|
3545
|
-
* @see https://
|
|
3544
|
+
* @see https://www.kucoin.com/docs/rest/funding/funding-overview/get-account-detail-margin
|
|
3545
|
+
* @see https://www.kucoin.com/docs/rest/funding/funding-overview/get-account-detail-isolated-margin
|
|
3546
3546
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3547
3547
|
* @param {object} [params.marginMode] 'cross' or 'isolated', margin type for fetching margin balance
|
|
3548
3548
|
* @param {object} [params.type] extra parameters specific to the exchange API endpoint
|
|
@@ -3569,7 +3569,7 @@ export default class kucoin extends Exchange {
|
|
|
3569
3569
|
let response = undefined;
|
|
3570
3570
|
const request = {};
|
|
3571
3571
|
const isolated = (marginMode === 'isolated') || (type === 'isolated');
|
|
3572
|
-
const cross = (marginMode === 'cross') || (type === '
|
|
3572
|
+
const cross = (marginMode === 'cross') || (type === 'margin');
|
|
3573
3573
|
if (isolated) {
|
|
3574
3574
|
if (currency !== undefined) {
|
|
3575
3575
|
request['balanceCurrency'] = currency['id'];
|
|
@@ -3639,13 +3639,14 @@ export default class kucoin extends Exchange {
|
|
|
3639
3639
|
// }
|
|
3640
3640
|
// }
|
|
3641
3641
|
//
|
|
3642
|
-
|
|
3642
|
+
let data = undefined;
|
|
3643
3643
|
const result = {
|
|
3644
3644
|
'info': response,
|
|
3645
3645
|
'timestamp': undefined,
|
|
3646
3646
|
'datetime': undefined,
|
|
3647
3647
|
};
|
|
3648
3648
|
if (isolated) {
|
|
3649
|
+
data = this.safeDict(response, 'data', {});
|
|
3649
3650
|
const assets = this.safeValue(data, 'assets', data);
|
|
3650
3651
|
for (let i = 0; i < assets.length; i++) {
|
|
3651
3652
|
const entry = assets[i];
|
|
@@ -3662,6 +3663,7 @@ export default class kucoin extends Exchange {
|
|
|
3662
3663
|
}
|
|
3663
3664
|
}
|
|
3664
3665
|
else if (cross) {
|
|
3666
|
+
data = this.safeDict(response, 'data', {});
|
|
3665
3667
|
const accounts = this.safeList(data, 'accounts', []);
|
|
3666
3668
|
for (let i = 0; i < accounts.length; i++) {
|
|
3667
3669
|
const balance = accounts[i];
|
|
@@ -3671,6 +3673,7 @@ export default class kucoin extends Exchange {
|
|
|
3671
3673
|
}
|
|
3672
3674
|
}
|
|
3673
3675
|
else {
|
|
3676
|
+
data = this.safeList(response, 'data', []);
|
|
3674
3677
|
for (let i = 0; i < data.length; i++) {
|
|
3675
3678
|
const balance = data[i];
|
|
3676
3679
|
const balanceType = this.safeString(balance, 'type');
|
package/js/src/mexc.js
CHANGED
|
@@ -4515,7 +4515,7 @@ export default class mexc extends Exchange {
|
|
|
4515
4515
|
}
|
|
4516
4516
|
}
|
|
4517
4517
|
if (result === undefined) {
|
|
4518
|
-
throw new InvalidAddress(this.id + ' fetchDepositAddress() cannot find a deposit address for ' + code + ', and network' + network + 'consider creating one using
|
|
4518
|
+
throw new InvalidAddress(this.id + ' fetchDepositAddress() cannot find a deposit address for ' + code + ', and network' + network + 'consider creating one using .createDepositAddress() method or in MEXC website');
|
|
4519
4519
|
}
|
|
4520
4520
|
return result;
|
|
4521
4521
|
}
|
package/package.json
CHANGED