ccxt 4.4.82 → 4.4.86
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 +6 -9
- package/dist/ccxt.browser.min.js +7 -7
- package/dist/cjs/ccxt.js +6 -17
- package/dist/cjs/src/abstract/bittrade.js +9 -0
- package/dist/cjs/src/apex.js +2 -1
- package/dist/cjs/src/ascendex.js +189 -155
- package/dist/cjs/src/base/Exchange.js +15 -2
- package/dist/cjs/src/bequant.js +1 -1
- package/dist/cjs/src/bitget.js +6 -7
- package/dist/cjs/src/bitmart.js +1 -1
- package/dist/cjs/src/bitrue.js +14 -35
- package/dist/cjs/src/bitso.js +33 -0
- package/dist/cjs/src/bitstamp.js +33 -0
- package/dist/cjs/src/bittrade.js +2049 -0
- package/dist/cjs/src/blofin.js +154 -13
- package/dist/cjs/src/btcbox.js +25 -5
- package/dist/cjs/src/bybit.js +16 -40
- package/dist/cjs/src/cex.js +2 -4
- package/dist/cjs/src/coinbase.js +58 -46
- package/dist/cjs/src/coinbaseexchange.js +142 -32
- package/dist/cjs/src/coincatch.js +14 -67
- package/dist/cjs/src/coinex.js +29 -32
- package/dist/cjs/src/coinlist.js +16 -15
- package/dist/cjs/src/coinmetro.js +22 -11
- package/dist/cjs/src/coinone.js +8 -10
- package/dist/cjs/src/coinsph.js +126 -1
- package/dist/cjs/src/cryptocom.js +111 -1
- package/dist/cjs/src/cryptomus.js +43 -89
- package/dist/cjs/src/delta.js +76 -36
- package/dist/cjs/src/deribit.js +4 -5
- package/dist/cjs/src/derive.js +46 -10
- package/dist/cjs/src/ellipx.js +175 -79
- package/dist/cjs/src/gate.js +1 -1
- package/dist/cjs/src/gemini.js +3 -5
- package/dist/cjs/src/hitbtc.js +56 -69
- package/dist/cjs/src/hollaex.js +107 -49
- package/dist/cjs/src/htx.js +20 -44
- package/dist/cjs/src/hyperliquid.js +6 -6
- package/dist/cjs/src/kraken.js +29 -24
- package/dist/cjs/src/kucoinfutures.js +6 -0
- package/dist/cjs/src/lbank.js +1 -1
- package/dist/cjs/src/mexc.js +2 -2
- package/dist/cjs/src/ndax.js +25 -24
- package/dist/cjs/src/okcoin.js +12 -31
- package/dist/cjs/src/okx.js +9 -0
- package/dist/cjs/src/onetrading.js +9 -6
- package/dist/cjs/src/oxfun.js +42 -114
- package/dist/cjs/src/paradex.js +124 -4
- package/dist/cjs/src/pro/binance.js +32 -33
- package/dist/cjs/src/pro/bithumb.js +5 -3
- package/dist/cjs/src/pro/bittrade.js +605 -0
- package/dist/cjs/src/pro/kraken.js +289 -79
- package/dist/cjs/src/pro/luno.js +6 -5
- package/dist/cjs/src/pro/mexc.js +304 -7
- package/dist/cjs/src/pro/poloniex.js +6 -2
- package/examples/js/cli.js +127 -13
- package/js/ccxt.d.ts +8 -20
- package/js/ccxt.js +6 -14
- package/js/src/abstract/blofin.d.ts +8 -0
- package/js/src/abstract/btcbox.d.ts +1 -0
- package/js/src/abstract/myokx.d.ts +2 -0
- package/js/src/abstract/okx.d.ts +2 -0
- package/js/src/apex.js +2 -1
- package/js/src/ascendex.d.ts +2 -0
- package/js/src/ascendex.js +189 -155
- package/js/src/base/Exchange.d.ts +15 -1
- package/js/src/base/Exchange.js +15 -2
- package/js/src/base/types.d.ts +3 -0
- package/js/src/bequant.js +1 -1
- package/js/src/bitget.js +6 -7
- package/js/src/bitmart.js +1 -1
- package/js/src/bitrue.js +14 -35
- package/js/src/bitso.js +33 -0
- package/js/src/bitstamp.js +33 -0
- package/js/src/{huobijp.d.ts → bittrade.d.ts} +29 -29
- package/js/src/{huobijp.js → bittrade.js} +35 -35
- package/js/src/blofin.d.ts +42 -2
- package/js/src/blofin.js +154 -13
- package/js/src/btcbox.js +25 -5
- package/js/src/bybit.js +16 -40
- package/js/src/cex.js +2 -4
- package/js/src/coinbase.js +58 -46
- package/js/src/coinbaseexchange.js +142 -32
- package/js/src/coincatch.js +14 -67
- package/js/src/coinex.js +28 -29
- package/js/src/coinlist.js +16 -15
- package/js/src/coinmetro.js +22 -11
- package/js/src/coinone.js +8 -10
- package/js/src/coinsph.d.ts +10 -1
- package/js/src/coinsph.js +126 -1
- package/js/src/cryptocom.d.ts +10 -1
- package/js/src/cryptocom.js +111 -1
- package/js/src/cryptomus.js +43 -89
- package/js/src/delta.js +76 -36
- package/js/src/deribit.js +4 -5
- package/js/src/derive.js +46 -10
- package/js/src/ellipx.d.ts +2 -3
- package/js/src/ellipx.js +175 -80
- package/js/src/gate.js +1 -1
- package/js/src/gemini.js +3 -5
- package/js/src/hitbtc.js +56 -69
- package/js/src/hollaex.js +107 -49
- package/js/src/htx.js +20 -44
- package/js/src/hyperliquid.js +6 -6
- package/js/src/kraken.js +29 -24
- package/js/src/kucoinfutures.d.ts +1 -0
- package/js/src/kucoinfutures.js +6 -0
- package/js/src/lbank.js +1 -1
- package/js/src/mexc.js +2 -2
- package/js/src/ndax.js +25 -24
- package/js/src/okcoin.js +12 -31
- package/js/src/okx.js +9 -0
- package/js/src/onetrading.js +9 -6
- package/js/src/oxfun.js +42 -114
- package/js/src/paradex.d.ts +12 -1
- package/js/src/paradex.js +124 -4
- package/js/src/pro/binance.d.ts +26 -26
- package/js/src/pro/binance.js +32 -33
- package/js/src/pro/bithumb.js +5 -3
- package/js/src/pro/{huobijp.d.ts → bittrade.d.ts} +6 -6
- package/js/src/pro/{huobijp.js → bittrade.js} +7 -7
- package/js/src/pro/kraken.d.ts +7 -6
- package/js/src/pro/kraken.js +290 -80
- package/js/src/pro/luno.js +6 -5
- package/js/src/pro/mexc.d.ts +58 -0
- package/js/src/pro/mexc.js +304 -7
- package/js/src/pro/poloniex.d.ts +1 -1
- package/js/src/pro/poloniex.js +6 -2
- package/package.json +1 -1
- package/js/src/abstract/bl3p.d.ts +0 -22
- package/js/src/abstract/huobijp.js +0 -11
- package/js/src/abstract/idex.d.ts +0 -29
- package/js/src/abstract/idex.js +0 -11
- package/js/src/abstract/kuna.d.ts +0 -185
- package/js/src/abstract/kuna.js +0 -11
- package/js/src/bl3p.d.ts +0 -116
- package/js/src/bl3p.js +0 -552
- package/js/src/idex.d.ts +0 -312
- package/js/src/idex.js +0 -1961
- package/js/src/kuna.d.ts +0 -335
- package/js/src/kuna.js +0 -2006
- package/js/src/pro/idex.d.ts +0 -81
- package/js/src/pro/idex.js +0 -720
- /package/js/src/abstract/{huobijp.d.ts → bittrade.d.ts} +0 -0
- /package/js/src/abstract/{bl3p.js → bittrade.js} +0 -0
package/js/src/coinmetro.js
CHANGED
|
@@ -380,24 +380,35 @@ export default class coinmetro extends Exchange {
|
|
|
380
380
|
const currency = response[i];
|
|
381
381
|
const id = this.safeString(currency, 'symbol');
|
|
382
382
|
const code = this.safeCurrencyCode(id);
|
|
383
|
-
const
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
383
|
+
const typeRaw = this.safeString(currency, 'type');
|
|
384
|
+
let type = undefined;
|
|
385
|
+
if (typeRaw === 'coin' || typeRaw === 'token' || typeRaw === 'erc20') {
|
|
386
|
+
type = 'crypto';
|
|
387
|
+
}
|
|
388
|
+
else if (typeRaw === 'fiat') {
|
|
389
|
+
type = 'fiat';
|
|
390
|
+
}
|
|
391
|
+
const precisionDigits = this.safeString2(currency, 'digits', 'notabeneDecimals');
|
|
388
392
|
result[code] = this.safeCurrencyStructure({
|
|
389
393
|
'id': id,
|
|
390
394
|
'code': code,
|
|
391
395
|
'name': code,
|
|
396
|
+
'type': type,
|
|
392
397
|
'info': currency,
|
|
393
|
-
'active':
|
|
394
|
-
'deposit':
|
|
395
|
-
'withdraw':
|
|
398
|
+
'active': this.safeBool(currency, 'canTrade'),
|
|
399
|
+
'deposit': this.safeBool(currency, 'canDeposit'),
|
|
400
|
+
'withdraw': this.safeBool(currency, 'canWithdraw'),
|
|
396
401
|
'fee': undefined,
|
|
397
|
-
'precision': this.parseNumber(this.parsePrecision(
|
|
402
|
+
'precision': this.parseNumber(this.parsePrecision(precisionDigits)),
|
|
398
403
|
'limits': {
|
|
399
|
-
'amount': {
|
|
400
|
-
|
|
404
|
+
'amount': {
|
|
405
|
+
'min': this.safeNumber(currency, 'minQty'),
|
|
406
|
+
'max': undefined,
|
|
407
|
+
},
|
|
408
|
+
'withdraw': {
|
|
409
|
+
'min': undefined,
|
|
410
|
+
'max': undefined,
|
|
411
|
+
},
|
|
401
412
|
},
|
|
402
413
|
'networks': {},
|
|
403
414
|
});
|
package/js/src/coinone.js
CHANGED
|
@@ -299,18 +299,16 @@ export default class coinone extends Exchange {
|
|
|
299
299
|
for (let i = 0; i < currencies.length; i++) {
|
|
300
300
|
const entry = currencies[i];
|
|
301
301
|
const id = this.safeString(entry, 'symbol');
|
|
302
|
-
const name = this.safeString(entry, 'name');
|
|
303
302
|
const code = this.safeCurrencyCode(id);
|
|
304
|
-
const
|
|
305
|
-
const
|
|
306
|
-
const
|
|
307
|
-
|
|
308
|
-
result[code] = {
|
|
303
|
+
const isWithdrawEnabled = this.safeString(entry, 'withdraw_status', '') === 'normal';
|
|
304
|
+
const isDepositEnabled = this.safeString(entry, 'deposit_status', '') === 'normal';
|
|
305
|
+
const type = (code !== 'KRW') ? 'crypto' : 'fiat';
|
|
306
|
+
result[code] = this.safeCurrencyStructure({
|
|
309
307
|
'id': id,
|
|
310
308
|
'code': code,
|
|
311
309
|
'info': entry,
|
|
312
|
-
'name': name,
|
|
313
|
-
'active':
|
|
310
|
+
'name': this.safeString(entry, 'name'),
|
|
311
|
+
'active': undefined,
|
|
314
312
|
'deposit': isDepositEnabled,
|
|
315
313
|
'withdraw': isWithdrawEnabled,
|
|
316
314
|
'fee': this.safeNumber(entry, 'withdrawal_fee'),
|
|
@@ -326,8 +324,8 @@ export default class coinone extends Exchange {
|
|
|
326
324
|
},
|
|
327
325
|
},
|
|
328
326
|
'networks': {},
|
|
329
|
-
'type':
|
|
330
|
-
};
|
|
327
|
+
'type': type,
|
|
328
|
+
});
|
|
331
329
|
}
|
|
332
330
|
return result;
|
|
333
331
|
}
|
package/js/src/coinsph.d.ts
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import Exchange from './abstract/coinsph.js';
|
|
2
|
-
import type { Balances, Currency, Dict, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, int, DepositAddress } from './base/types.js';
|
|
2
|
+
import type { Balances, Currency, Currencies, Dict, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, int, DepositAddress } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class coinsph
|
|
5
5
|
* @augments Exchange
|
|
6
6
|
*/
|
|
7
7
|
export default class coinsph extends Exchange {
|
|
8
8
|
describe(): any;
|
|
9
|
+
/**
|
|
10
|
+
* @method
|
|
11
|
+
* @name coinsph#fetchCurrencies
|
|
12
|
+
* @description fetches all available currencies on an exchange
|
|
13
|
+
* @see https://docs.coins.ph/rest-api/#all-coins-information-user_data
|
|
14
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
15
|
+
* @returns {object} an associative dictionary of currencies
|
|
16
|
+
*/
|
|
17
|
+
fetchCurrencies(params?: {}): Promise<Currencies>;
|
|
9
18
|
calculateRateLimiterCost(api: any, method: any, path: any, params: any, config?: {}): any;
|
|
10
19
|
/**
|
|
11
20
|
* @method
|
package/js/src/coinsph.js
CHANGED
|
@@ -59,7 +59,7 @@ export default class coinsph extends Exchange {
|
|
|
59
59
|
'fetchClosedOrders': true,
|
|
60
60
|
'fetchCrossBorrowRate': false,
|
|
61
61
|
'fetchCrossBorrowRates': false,
|
|
62
|
-
'fetchCurrencies':
|
|
62
|
+
'fetchCurrencies': true,
|
|
63
63
|
'fetchDeposit': undefined,
|
|
64
64
|
'fetchDepositAddress': true,
|
|
65
65
|
'fetchDepositAddresses': false,
|
|
@@ -485,6 +485,131 @@ export default class coinsph extends Exchange {
|
|
|
485
485
|
},
|
|
486
486
|
});
|
|
487
487
|
}
|
|
488
|
+
/**
|
|
489
|
+
* @method
|
|
490
|
+
* @name coinsph#fetchCurrencies
|
|
491
|
+
* @description fetches all available currencies on an exchange
|
|
492
|
+
* @see https://docs.coins.ph/rest-api/#all-coins-information-user_data
|
|
493
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
494
|
+
* @returns {object} an associative dictionary of currencies
|
|
495
|
+
*/
|
|
496
|
+
async fetchCurrencies(params = {}) {
|
|
497
|
+
if (!this.checkRequiredCredentials(false)) {
|
|
498
|
+
return undefined;
|
|
499
|
+
}
|
|
500
|
+
const response = await this.privateGetOpenapiWalletV1ConfigGetall(params);
|
|
501
|
+
//
|
|
502
|
+
// [
|
|
503
|
+
// {
|
|
504
|
+
// "coin": "PHP",
|
|
505
|
+
// "name": "PHP",
|
|
506
|
+
// "depositAllEnable": false,
|
|
507
|
+
// "withdrawAllEnable": false,
|
|
508
|
+
// "free": "0",
|
|
509
|
+
// "locked": "0",
|
|
510
|
+
// "transferPrecision": "2",
|
|
511
|
+
// "transferMinQuantity": "0",
|
|
512
|
+
// "networkList": [],
|
|
513
|
+
// "legalMoney": true
|
|
514
|
+
// },
|
|
515
|
+
// {
|
|
516
|
+
// "coin": "USDT",
|
|
517
|
+
// "name": "USDT",
|
|
518
|
+
// "depositAllEnable": true,
|
|
519
|
+
// "withdrawAllEnable": true,
|
|
520
|
+
// "free": "0",
|
|
521
|
+
// "locked": "0",
|
|
522
|
+
// "transferPrecision": "8",
|
|
523
|
+
// "transferMinQuantity": "0",
|
|
524
|
+
// "networkList": [
|
|
525
|
+
// {
|
|
526
|
+
// "addressRegex": "^0x[0-9a-fA-F]{40}$",
|
|
527
|
+
// "memoRegex": " ",
|
|
528
|
+
// "network": "ETH",
|
|
529
|
+
// "name": "Ethereum (ERC20)",
|
|
530
|
+
// "depositEnable": true,
|
|
531
|
+
// "minConfirm": "12",
|
|
532
|
+
// "unLockConfirm": "-1",
|
|
533
|
+
// "withdrawDesc": "",
|
|
534
|
+
// "withdrawEnable": true,
|
|
535
|
+
// "withdrawFee": "6",
|
|
536
|
+
// "withdrawIntegerMultiple": "0.000001",
|
|
537
|
+
// "withdrawMax": "500000",
|
|
538
|
+
// "withdrawMin": "10",
|
|
539
|
+
// "sameAddress": false
|
|
540
|
+
// },
|
|
541
|
+
// {
|
|
542
|
+
// "addressRegex": "^T[0-9a-zA-Z]{33}$",
|
|
543
|
+
// "memoRegex": "",
|
|
544
|
+
// "network": "TRX",
|
|
545
|
+
// "name": "TRON",
|
|
546
|
+
// "depositEnable": true,
|
|
547
|
+
// "minConfirm": "19",
|
|
548
|
+
// "unLockConfirm": "-1",
|
|
549
|
+
// "withdrawDesc": "",
|
|
550
|
+
// "withdrawEnable": true,
|
|
551
|
+
// "withdrawFee": "3",
|
|
552
|
+
// "withdrawIntegerMultiple": "0.000001",
|
|
553
|
+
// "withdrawMax": "1000000",
|
|
554
|
+
// "withdrawMin": "20",
|
|
555
|
+
// "sameAddress": false
|
|
556
|
+
// }
|
|
557
|
+
// ],
|
|
558
|
+
// "legalMoney": false
|
|
559
|
+
// }
|
|
560
|
+
// ]
|
|
561
|
+
//
|
|
562
|
+
const result = {};
|
|
563
|
+
for (let i = 0; i < response.length; i++) {
|
|
564
|
+
const entry = response[i];
|
|
565
|
+
const id = this.safeString(entry, 'coin');
|
|
566
|
+
const code = this.safeCurrencyCode(id);
|
|
567
|
+
const isFiat = this.safeBool(entry, 'isLegalMoney');
|
|
568
|
+
const networkList = this.safeList(entry, 'networkList', []);
|
|
569
|
+
const networks = {};
|
|
570
|
+
for (let j = 0; j < networkList.length; j++) {
|
|
571
|
+
const networkItem = networkList[j];
|
|
572
|
+
const network = this.safeString(networkItem, 'network');
|
|
573
|
+
const networkCode = this.networkIdToCode(network);
|
|
574
|
+
networks[networkCode] = {
|
|
575
|
+
'info': networkItem,
|
|
576
|
+
'id': network,
|
|
577
|
+
'network': networkCode,
|
|
578
|
+
'active': undefined,
|
|
579
|
+
'deposit': this.safeBool(networkItem, 'depositEnable'),
|
|
580
|
+
'withdraw': this.safeBool(networkItem, 'withdrawEnable'),
|
|
581
|
+
'fee': this.safeNumber(networkItem, 'withdrawFee'),
|
|
582
|
+
'precision': this.safeNumber(networkItem, 'withdrawIntegerMultiple'),
|
|
583
|
+
'limits': {
|
|
584
|
+
'withdraw': {
|
|
585
|
+
'min': this.safeNumber(networkItem, 'withdrawMin'),
|
|
586
|
+
'max': this.safeNumber(networkItem, 'withdrawMax'),
|
|
587
|
+
},
|
|
588
|
+
'deposit': {
|
|
589
|
+
'min': undefined,
|
|
590
|
+
'max': undefined,
|
|
591
|
+
},
|
|
592
|
+
},
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
result[code] = this.safeCurrencyStructure({
|
|
596
|
+
'id': id,
|
|
597
|
+
'name': this.safeString(entry, 'name'),
|
|
598
|
+
'code': code,
|
|
599
|
+
'type': isFiat ? 'fiat' : 'crypto',
|
|
600
|
+
'precision': this.parseNumber(this.parsePrecision(this.safeString(entry, 'transferPrecision'))),
|
|
601
|
+
'info': entry,
|
|
602
|
+
'active': undefined,
|
|
603
|
+
'deposit': this.safeBool(entry, 'depositAllEnable'),
|
|
604
|
+
'withdraw': this.safeBool(entry, 'withdrawAllEnable'),
|
|
605
|
+
'networks': networks,
|
|
606
|
+
'fee': undefined,
|
|
607
|
+
'fees': undefined,
|
|
608
|
+
'limits': {},
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
return result;
|
|
612
|
+
}
|
|
488
613
|
calculateRateLimiterCost(api, method, path, params, config = {}) {
|
|
489
614
|
if (('noSymbol' in config) && !('symbol' in params)) {
|
|
490
615
|
return config['noSymbol'];
|
package/js/src/cryptocom.d.ts
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import Exchange from './abstract/cryptocom.js';
|
|
2
|
-
import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, Str, Ticker, OrderRequest, Balances, Transaction, OrderBook, Tickers, Strings, Currency, Market, Num, Account, CancellationRequest, Dict, int, TradingFeeInterface, TradingFees, LedgerEntry, DepositAddress, Position } from './base/types.js';
|
|
2
|
+
import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, Str, Ticker, OrderRequest, Balances, Transaction, OrderBook, Tickers, Strings, Currency, Currencies, Market, Num, Account, CancellationRequest, Dict, int, TradingFeeInterface, TradingFees, LedgerEntry, DepositAddress, Position } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class cryptocom
|
|
5
5
|
* @augments Exchange
|
|
6
6
|
*/
|
|
7
7
|
export default class cryptocom extends Exchange {
|
|
8
8
|
describe(): any;
|
|
9
|
+
/**
|
|
10
|
+
* @method
|
|
11
|
+
* @name cryptocom#fetchCurrencies
|
|
12
|
+
* @description fetches all available currencies on an exchange
|
|
13
|
+
* @see https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-currency-networks
|
|
14
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
15
|
+
* @returns {object} an associative dictionary of currencies
|
|
16
|
+
*/
|
|
17
|
+
fetchCurrencies(params?: {}): Promise<Currencies>;
|
|
9
18
|
/**
|
|
10
19
|
* @method
|
|
11
20
|
* @name cryptocom#fetchMarkets
|
package/js/src/cryptocom.js
CHANGED
|
@@ -54,7 +54,7 @@ export default class cryptocom extends Exchange {
|
|
|
54
54
|
'fetchClosedOrders': 'emulated',
|
|
55
55
|
'fetchCrossBorrowRate': false,
|
|
56
56
|
'fetchCrossBorrowRates': false,
|
|
57
|
-
'fetchCurrencies':
|
|
57
|
+
'fetchCurrencies': true,
|
|
58
58
|
'fetchDepositAddress': true,
|
|
59
59
|
'fetchDepositAddresses': false,
|
|
60
60
|
'fetchDepositAddressesByNetwork': true,
|
|
@@ -511,6 +511,116 @@ export default class cryptocom extends Exchange {
|
|
|
511
511
|
},
|
|
512
512
|
});
|
|
513
513
|
}
|
|
514
|
+
/**
|
|
515
|
+
* @method
|
|
516
|
+
* @name cryptocom#fetchCurrencies
|
|
517
|
+
* @description fetches all available currencies on an exchange
|
|
518
|
+
* @see https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-currency-networks
|
|
519
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
520
|
+
* @returns {object} an associative dictionary of currencies
|
|
521
|
+
*/
|
|
522
|
+
async fetchCurrencies(params = {}) {
|
|
523
|
+
// this endpoint requires authentication
|
|
524
|
+
if (!this.checkRequiredCredentials(false)) {
|
|
525
|
+
return undefined;
|
|
526
|
+
}
|
|
527
|
+
const response = await this.v1PrivatePostPrivateGetCurrencyNetworks(params);
|
|
528
|
+
//
|
|
529
|
+
// {
|
|
530
|
+
// "id": "1747502328559",
|
|
531
|
+
// "method": "private/get-currency-networks",
|
|
532
|
+
// "code": "0",
|
|
533
|
+
// "result": {
|
|
534
|
+
// "update_time": "1747502281000",
|
|
535
|
+
// "currency_map": {
|
|
536
|
+
// "USDT": {
|
|
537
|
+
// "full_name": "Tether USD",
|
|
538
|
+
// "default_network": "ETH",
|
|
539
|
+
// "network_list": [
|
|
540
|
+
// {
|
|
541
|
+
// "network_id": "ETH",
|
|
542
|
+
// "withdrawal_fee": "10.00000000",
|
|
543
|
+
// "withdraw_enabled": true,
|
|
544
|
+
// "min_withdrawal_amount": "20.0",
|
|
545
|
+
// "deposit_enabled": true,
|
|
546
|
+
// "confirmation_required": "32"
|
|
547
|
+
// },
|
|
548
|
+
// {
|
|
549
|
+
// "network_id": "CRONOS",
|
|
550
|
+
// "withdrawal_fee": "0.18000000",
|
|
551
|
+
// "withdraw_enabled": true,
|
|
552
|
+
// "min_withdrawal_amount": "0.36",
|
|
553
|
+
// "deposit_enabled": true,
|
|
554
|
+
// "confirmation_required": "15"
|
|
555
|
+
// },
|
|
556
|
+
// {
|
|
557
|
+
// "network_id": "SOL",
|
|
558
|
+
// "withdrawal_fee": "5.31000000",
|
|
559
|
+
// "withdraw_enabled": true,
|
|
560
|
+
// "min_withdrawal_amount": "10.62",
|
|
561
|
+
// "deposit_enabled": true,
|
|
562
|
+
// "confirmation_required": "1"
|
|
563
|
+
// }
|
|
564
|
+
// ]
|
|
565
|
+
// }
|
|
566
|
+
// }
|
|
567
|
+
// }
|
|
568
|
+
// }
|
|
569
|
+
//
|
|
570
|
+
const resultData = this.safeDict(response, 'result', {});
|
|
571
|
+
const currencyMap = this.safeDict(resultData, 'currency_map', {});
|
|
572
|
+
const keys = Object.keys(currencyMap);
|
|
573
|
+
const result = {};
|
|
574
|
+
for (let i = 0; i < keys.length; i++) {
|
|
575
|
+
const key = keys[i];
|
|
576
|
+
const currency = currencyMap[key];
|
|
577
|
+
const id = key;
|
|
578
|
+
const code = this.safeCurrencyCode(id);
|
|
579
|
+
const networks = {};
|
|
580
|
+
const chains = this.safeList(currency, 'network_list', []);
|
|
581
|
+
for (let j = 0; j < chains.length; j++) {
|
|
582
|
+
const chain = chains[j];
|
|
583
|
+
const networkId = this.safeString(chain, 'network_id');
|
|
584
|
+
const network = this.networkIdToCode(networkId);
|
|
585
|
+
networks[network] = {
|
|
586
|
+
'info': chain,
|
|
587
|
+
'id': networkId,
|
|
588
|
+
'network': network,
|
|
589
|
+
'active': undefined,
|
|
590
|
+
'deposit': this.safeBool(chain, 'deposit_enabled', false),
|
|
591
|
+
'withdraw': this.safeBool(chain, 'withdraw_enabled', false),
|
|
592
|
+
'fee': this.safeNumber(chain, 'withdrawal_fee'),
|
|
593
|
+
'precision': undefined,
|
|
594
|
+
'limits': {
|
|
595
|
+
'withdraw': {
|
|
596
|
+
'min': this.safeNumber(chain, 'min_withdrawal_amount'),
|
|
597
|
+
'max': undefined,
|
|
598
|
+
},
|
|
599
|
+
},
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
result[code] = this.safeCurrencyStructure({
|
|
603
|
+
'info': currency,
|
|
604
|
+
'id': id,
|
|
605
|
+
'code': code,
|
|
606
|
+
'name': this.safeString(currency, 'full_name'),
|
|
607
|
+
'active': undefined,
|
|
608
|
+
'deposit': undefined,
|
|
609
|
+
'withdraw': undefined,
|
|
610
|
+
'fee': undefined,
|
|
611
|
+
'precision': undefined,
|
|
612
|
+
'limits': {
|
|
613
|
+
'amount': {
|
|
614
|
+
'min': undefined,
|
|
615
|
+
'max': undefined,
|
|
616
|
+
},
|
|
617
|
+
},
|
|
618
|
+
'type': 'crypto',
|
|
619
|
+
'networks': networks,
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
return result;
|
|
623
|
+
}
|
|
514
624
|
/**
|
|
515
625
|
* @method
|
|
516
626
|
* @name cryptocom#fetchMarkets
|
package/js/src/cryptomus.js
CHANGED
|
@@ -368,41 +368,9 @@ export default class cryptomus extends Exchange {
|
|
|
368
368
|
const coins = this.safeList(response, 'result');
|
|
369
369
|
const result = {};
|
|
370
370
|
for (let i = 0; i < coins.length; i++) {
|
|
371
|
-
const
|
|
372
|
-
const currencyId = this.safeString(
|
|
371
|
+
const networkEntry = coins[i];
|
|
372
|
+
const currencyId = this.safeString(networkEntry, 'currency_code');
|
|
373
373
|
const code = this.safeCurrencyCode(currencyId);
|
|
374
|
-
const allowWithdraw = this.safeBool(currency, 'can_withdraw');
|
|
375
|
-
const allowDeposit = this.safeBool(currency, 'can_deposit');
|
|
376
|
-
const isActive = allowWithdraw && allowDeposit;
|
|
377
|
-
const networkId = this.safeString(currency, 'network_code');
|
|
378
|
-
const networksById = this.safeDict(this.options, 'networksById');
|
|
379
|
-
const networkName = this.safeString(networksById, networkId, networkId);
|
|
380
|
-
const minWithdraw = this.safeNumber(currency, 'min_withdraw');
|
|
381
|
-
const maxWithdraw = this.safeNumber(currency, 'max_withdraw');
|
|
382
|
-
const minDeposit = this.safeNumber(currency, 'min_deposit');
|
|
383
|
-
const maxDeposit = this.safeNumber(currency, 'max_deposit');
|
|
384
|
-
const network = {
|
|
385
|
-
'id': networkId,
|
|
386
|
-
'network': networkName,
|
|
387
|
-
'limits': {
|
|
388
|
-
'withdraw': {
|
|
389
|
-
'min': minWithdraw,
|
|
390
|
-
'max': maxWithdraw,
|
|
391
|
-
},
|
|
392
|
-
'deposit': {
|
|
393
|
-
'min': minDeposit,
|
|
394
|
-
'max': maxDeposit,
|
|
395
|
-
},
|
|
396
|
-
},
|
|
397
|
-
'active': isActive,
|
|
398
|
-
'deposit': allowDeposit,
|
|
399
|
-
'withdraw': allowWithdraw,
|
|
400
|
-
'fee': undefined,
|
|
401
|
-
'precision': undefined,
|
|
402
|
-
'info': currency,
|
|
403
|
-
};
|
|
404
|
-
const networks = {};
|
|
405
|
-
networks[networkName] = network;
|
|
406
374
|
if (!(code in result)) {
|
|
407
375
|
result[code] = {
|
|
408
376
|
'id': currencyId,
|
|
@@ -410,70 +378,56 @@ export default class cryptomus extends Exchange {
|
|
|
410
378
|
'precision': undefined,
|
|
411
379
|
'type': undefined,
|
|
412
380
|
'name': undefined,
|
|
413
|
-
'active':
|
|
414
|
-
'deposit':
|
|
415
|
-
'withdraw':
|
|
381
|
+
'active': undefined,
|
|
382
|
+
'deposit': undefined,
|
|
383
|
+
'withdraw': undefined,
|
|
416
384
|
'fee': undefined,
|
|
417
385
|
'limits': {
|
|
418
386
|
'withdraw': {
|
|
419
|
-
'min':
|
|
420
|
-
'max':
|
|
387
|
+
'min': undefined,
|
|
388
|
+
'max': undefined,
|
|
421
389
|
},
|
|
422
390
|
'deposit': {
|
|
423
|
-
'min':
|
|
424
|
-
'max':
|
|
391
|
+
'min': undefined,
|
|
392
|
+
'max': undefined,
|
|
425
393
|
},
|
|
426
394
|
},
|
|
427
|
-
'networks':
|
|
428
|
-
'info':
|
|
395
|
+
'networks': {},
|
|
396
|
+
'info': {},
|
|
429
397
|
};
|
|
430
398
|
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
withdrawLimits['max'] = parsedWithdrawLimits['max'] ? Math.max(parsedWithdrawLimits['max'], maxWithdraw) : maxWithdraw;
|
|
464
|
-
}
|
|
465
|
-
if (minDeposit) {
|
|
466
|
-
depositLimits['min'] = parsedDepositLimits['min'] ? Math.min(parsedDepositLimits['min'], minDeposit) : minDeposit;
|
|
467
|
-
}
|
|
468
|
-
if (maxDeposit) {
|
|
469
|
-
depositLimits['max'] = parsedDepositLimits['max'] ? Math.max(parsedDepositLimits['max'], maxDeposit) : maxDeposit;
|
|
470
|
-
}
|
|
471
|
-
const limits = {
|
|
472
|
-
'withdraw': withdrawLimits,
|
|
473
|
-
'deposit': depositLimits,
|
|
474
|
-
};
|
|
475
|
-
parsed['limits'] = limits;
|
|
476
|
-
}
|
|
399
|
+
const networkId = this.safeString(networkEntry, 'network_code');
|
|
400
|
+
const networkCode = this.networkIdToCode(networkId);
|
|
401
|
+
result[code]['networks'][networkCode] = {
|
|
402
|
+
'id': networkId,
|
|
403
|
+
'network': networkCode,
|
|
404
|
+
'limits': {
|
|
405
|
+
'withdraw': {
|
|
406
|
+
'min': this.safeNumber(networkEntry, 'min_withdraw'),
|
|
407
|
+
'max': this.safeNumber(networkEntry, 'max_withdraw'),
|
|
408
|
+
},
|
|
409
|
+
'deposit': {
|
|
410
|
+
'min': this.safeNumber(networkEntry, 'min_deposit'),
|
|
411
|
+
'max': this.safeNumber(networkEntry, 'max_deposit'),
|
|
412
|
+
},
|
|
413
|
+
},
|
|
414
|
+
'active': undefined,
|
|
415
|
+
'deposit': this.safeBool(networkEntry, 'can_withdraw'),
|
|
416
|
+
'withdraw': this.safeBool(networkEntry, 'can_deposit'),
|
|
417
|
+
'fee': undefined,
|
|
418
|
+
'precision': undefined,
|
|
419
|
+
'info': networkEntry,
|
|
420
|
+
};
|
|
421
|
+
// add entry in info
|
|
422
|
+
const info = this.safeList(result[code], 'info', []);
|
|
423
|
+
info.push(networkEntry);
|
|
424
|
+
result[code]['info'] = info;
|
|
425
|
+
}
|
|
426
|
+
// only after all entries are formed in currencies, restructure each entry
|
|
427
|
+
const allKeys = Object.keys(result);
|
|
428
|
+
for (let i = 0; i < allKeys.length; i++) {
|
|
429
|
+
const code = allKeys[i];
|
|
430
|
+
result[code] = this.safeCurrencyStructure(result[code]); // this is needed after adding network entry
|
|
477
431
|
}
|
|
478
432
|
return result;
|
|
479
433
|
}
|