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/ascendex.js
CHANGED
|
@@ -469,6 +469,7 @@ export default class ascendex extends Exchange {
|
|
|
469
469
|
'broad': {},
|
|
470
470
|
},
|
|
471
471
|
'commonCurrencies': {
|
|
472
|
+
'XBT': 'XBT',
|
|
472
473
|
'BOND': 'BONDED',
|
|
473
474
|
'BTCBEAR': 'BEAR',
|
|
474
475
|
'BTCBULL': 'BULL',
|
|
@@ -491,116 +492,83 @@ export default class ascendex extends Exchange {
|
|
|
491
492
|
* @returns {object} an associative dictionary of currencies
|
|
492
493
|
*/
|
|
493
494
|
async fetchCurrencies(params = {}) {
|
|
494
|
-
const
|
|
495
|
-
//
|
|
496
|
-
// {
|
|
497
|
-
// "code":0,
|
|
498
|
-
// "data":[
|
|
499
|
-
// {
|
|
500
|
-
// "assetCode" : "LTCBULL",
|
|
501
|
-
// "assetName" : "3X Long LTC Token",
|
|
502
|
-
// "precisionScale" : 9,
|
|
503
|
-
// "nativeScale" : 4,
|
|
504
|
-
// "withdrawalFee" : "0.2",
|
|
505
|
-
// "minWithdrawalAmt" : "1.0",
|
|
506
|
-
// "status" : "Normal"
|
|
507
|
-
// },
|
|
508
|
-
// ]
|
|
509
|
-
// }
|
|
510
|
-
//
|
|
511
|
-
const marginPromise = this.v1PublicGetMarginAssets(params);
|
|
512
|
-
//
|
|
513
|
-
// {
|
|
514
|
-
// "code":0,
|
|
515
|
-
// "data":[
|
|
516
|
-
// {
|
|
517
|
-
// "assetCode":"BTT",
|
|
518
|
-
// "displayName": "BTT",
|
|
519
|
-
// "borrowAssetCode":"BTT-B",
|
|
520
|
-
// "interestAssetCode":"BTT-I",
|
|
521
|
-
// "nativeScale":0,
|
|
522
|
-
// "numConfirmations":1,
|
|
523
|
-
// "withdrawFee":"100.0",
|
|
524
|
-
// "minWithdrawalAmt":"1000.0",
|
|
525
|
-
// "statusCode":"Normal",
|
|
526
|
-
// "statusMessage":"",
|
|
527
|
-
// "interestRate":"0.001"
|
|
528
|
-
// }
|
|
529
|
-
// ]
|
|
530
|
-
// }
|
|
531
|
-
//
|
|
532
|
-
const cashPromise = this.v1PublicGetCashAssets(params);
|
|
495
|
+
const response = await this.v2PublicGetAssets(params);
|
|
533
496
|
//
|
|
534
|
-
//
|
|
535
|
-
//
|
|
536
|
-
//
|
|
537
|
-
//
|
|
538
|
-
//
|
|
539
|
-
//
|
|
540
|
-
//
|
|
541
|
-
//
|
|
542
|
-
//
|
|
543
|
-
//
|
|
544
|
-
//
|
|
545
|
-
//
|
|
546
|
-
//
|
|
497
|
+
// {
|
|
498
|
+
// "code": "0",
|
|
499
|
+
// "data": [
|
|
500
|
+
// {
|
|
501
|
+
// "assetCode": "USDT",
|
|
502
|
+
// "assetName": "Tether",
|
|
503
|
+
// "precisionScale": 9,
|
|
504
|
+
// "nativeScale": 4,
|
|
505
|
+
// "blockChain": [
|
|
506
|
+
// {
|
|
507
|
+
// "chainName": "Solana",
|
|
508
|
+
// "withdrawFee": "2.0",
|
|
509
|
+
// "allowDeposit": true,
|
|
510
|
+
// "allowWithdraw": true,
|
|
511
|
+
// "minDepositAmt": "0.01",
|
|
512
|
+
// "minWithdrawal": "4.0",
|
|
513
|
+
// "numConfirmations": 1
|
|
514
|
+
// },
|
|
515
|
+
// ...
|
|
516
|
+
// ]
|
|
517
|
+
// },
|
|
547
518
|
// ]
|
|
548
|
-
//
|
|
519
|
+
// }
|
|
549
520
|
//
|
|
550
|
-
const
|
|
551
|
-
const assetsData = this.safeList(assets, 'data', []);
|
|
552
|
-
const marginData = this.safeList(margin, 'data', []);
|
|
553
|
-
const cashData = this.safeList(cash, 'data', []);
|
|
554
|
-
const assetsById = this.indexBy(assetsData, 'assetCode');
|
|
555
|
-
const marginById = this.indexBy(marginData, 'assetCode');
|
|
556
|
-
const cashById = this.indexBy(cashData, 'assetCode');
|
|
557
|
-
const dataById = this.deepExtend(assetsById, marginById, cashById);
|
|
558
|
-
const ids = Object.keys(dataById);
|
|
521
|
+
const data = this.safeList(response, 'data', []);
|
|
559
522
|
const result = {};
|
|
560
|
-
for (let i = 0; i <
|
|
561
|
-
const
|
|
562
|
-
const
|
|
523
|
+
for (let i = 0; i < data.length; i++) {
|
|
524
|
+
const currency = data[i];
|
|
525
|
+
const id = this.safeString(currency, 'assetCode');
|
|
563
526
|
const code = this.safeCurrencyCode(id);
|
|
564
|
-
const
|
|
565
|
-
const precision = this.parseNumber(this.parsePrecision(
|
|
566
|
-
const
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
527
|
+
const chains = this.safeList(currency, 'blockChain', []);
|
|
528
|
+
const precision = this.parseNumber(this.parsePrecision(this.safeString(currency, 'nativeScale')));
|
|
529
|
+
const networks = {};
|
|
530
|
+
for (let j = 0; j < chains.length; j++) {
|
|
531
|
+
const networkEtnry = chains[j];
|
|
532
|
+
const networkId = this.safeString(networkEtnry, 'chainName');
|
|
533
|
+
const networkCode = this.networkCodeToId(networkId);
|
|
534
|
+
networks[networkCode] = {
|
|
535
|
+
'fee': this.safeNumber(networkEtnry, 'withdrawFee'),
|
|
536
|
+
'active': undefined,
|
|
537
|
+
'withdraw': this.safeBool(networkEtnry, 'allowWithdraw'),
|
|
538
|
+
'deposit': this.safeBool(networkEtnry, 'allowDeposit'),
|
|
539
|
+
'precision': precision,
|
|
540
|
+
'limits': {
|
|
541
|
+
'amount': {
|
|
542
|
+
'min': undefined,
|
|
543
|
+
'max': undefined,
|
|
544
|
+
},
|
|
545
|
+
'withdraw': {
|
|
546
|
+
'min': this.safeNumber(networkEtnry, 'minWithdrawal'),
|
|
547
|
+
'max': undefined,
|
|
548
|
+
},
|
|
549
|
+
'deposit': {
|
|
550
|
+
'min': this.safeNumber(networkEtnry, 'minDepositAmt'),
|
|
551
|
+
'max': undefined,
|
|
552
|
+
},
|
|
553
|
+
},
|
|
554
|
+
};
|
|
587
555
|
}
|
|
588
|
-
|
|
589
|
-
result[code] = {
|
|
556
|
+
// todo type: if (chainsLength === 0 && (assetName.endsWith (' Staking') || assetName.indexOf (' Reward ') >= 0 || assetName.indexOf ('Slot Auction') >= 0 || assetName.indexOf (' Freeze Asset') >= 0))
|
|
557
|
+
result[code] = this.safeCurrencyStructure({
|
|
590
558
|
'id': id,
|
|
591
559
|
'code': code,
|
|
592
560
|
'info': currency,
|
|
593
561
|
'type': undefined,
|
|
594
|
-
'margin':
|
|
562
|
+
'margin': undefined,
|
|
595
563
|
'name': this.safeString(currency, 'assetName'),
|
|
596
|
-
'active':
|
|
597
|
-
'deposit':
|
|
598
|
-
'withdraw':
|
|
599
|
-
'fee':
|
|
564
|
+
'active': undefined,
|
|
565
|
+
'deposit': undefined,
|
|
566
|
+
'withdraw': undefined,
|
|
567
|
+
'fee': undefined,
|
|
600
568
|
'precision': precision,
|
|
601
569
|
'limits': {
|
|
602
570
|
'amount': {
|
|
603
|
-
'min':
|
|
571
|
+
'min': undefined,
|
|
604
572
|
'max': undefined,
|
|
605
573
|
},
|
|
606
574
|
'withdraw': {
|
|
@@ -608,8 +576,8 @@ export default class ascendex extends Exchange {
|
|
|
608
576
|
'max': undefined,
|
|
609
577
|
},
|
|
610
578
|
},
|
|
611
|
-
'networks':
|
|
612
|
-
};
|
|
579
|
+
'networks': networks,
|
|
580
|
+
});
|
|
613
581
|
}
|
|
614
582
|
return result;
|
|
615
583
|
}
|
|
@@ -621,6 +589,12 @@ export default class ascendex extends Exchange {
|
|
|
621
589
|
* @returns {object[]} an array of objects representing market data
|
|
622
590
|
*/
|
|
623
591
|
async fetchMarkets(params = {}) {
|
|
592
|
+
const spotPromise = this.fetchSpotMarkets(params);
|
|
593
|
+
const contractPromise = this.fetchContractMarkets(params);
|
|
594
|
+
const [spotMarkets, contractMarkets] = await Promise.all([spotPromise, contractPromise]);
|
|
595
|
+
return this.arrayConcat(spotMarkets, contractMarkets);
|
|
596
|
+
}
|
|
597
|
+
async fetchSpotMarkets(params = {}) {
|
|
624
598
|
const productsPromise = this.v1PublicGetProducts(params);
|
|
625
599
|
//
|
|
626
600
|
// {
|
|
@@ -672,7 +646,94 @@ export default class ascendex extends Exchange {
|
|
|
672
646
|
// ]
|
|
673
647
|
// }
|
|
674
648
|
//
|
|
675
|
-
const
|
|
649
|
+
const [products, cash] = await Promise.all([productsPromise, cashPromise]);
|
|
650
|
+
const productsData = this.safeList(products, 'data', []);
|
|
651
|
+
const productsById = this.indexBy(productsData, 'symbol');
|
|
652
|
+
const cashData = this.safeList(cash, 'data', []);
|
|
653
|
+
const cashAndPerpetualsById = this.indexBy(cashData, 'symbol');
|
|
654
|
+
const dataById = this.deepExtend(productsById, cashAndPerpetualsById);
|
|
655
|
+
const ids = Object.keys(dataById);
|
|
656
|
+
const result = [];
|
|
657
|
+
for (let i = 0; i < ids.length; i++) {
|
|
658
|
+
const id = ids[i];
|
|
659
|
+
if (id.indexOf('-PERP') >= 0) {
|
|
660
|
+
continue; // skip perpetuals, as separate endpoint returns them
|
|
661
|
+
}
|
|
662
|
+
const market = dataById[id];
|
|
663
|
+
const status = this.safeString(market, 'status');
|
|
664
|
+
const domain = this.safeString(market, 'domain');
|
|
665
|
+
let active = false;
|
|
666
|
+
if (((status === 'Normal') || (status === 'InternalTrading')) && (domain !== 'LeveragedETF')) {
|
|
667
|
+
active = true;
|
|
668
|
+
}
|
|
669
|
+
const minQty = this.safeNumber(market, 'minQty');
|
|
670
|
+
const maxQty = this.safeNumber(market, 'maxQty');
|
|
671
|
+
const minPrice = this.safeNumber(market, 'tickSize');
|
|
672
|
+
const maxPrice = undefined;
|
|
673
|
+
const underlying = this.safeString2(market, 'underlying', 'symbol');
|
|
674
|
+
const parts = underlying.split('/');
|
|
675
|
+
const baseId = this.safeString(parts, 0);
|
|
676
|
+
const quoteId = this.safeString(parts, 1);
|
|
677
|
+
const base = this.safeCurrencyCode(baseId);
|
|
678
|
+
const quote = this.safeCurrencyCode(quoteId);
|
|
679
|
+
const fee = this.safeNumber(market, 'commissionReserveRate');
|
|
680
|
+
const marginTradable = this.safeBool(market, 'marginTradable', false);
|
|
681
|
+
result.push({
|
|
682
|
+
'id': id,
|
|
683
|
+
'symbol': base + '/' + quote,
|
|
684
|
+
'base': base,
|
|
685
|
+
'baseId': baseId,
|
|
686
|
+
'quote': quote,
|
|
687
|
+
'quoteId': quoteId,
|
|
688
|
+
'settle': undefined,
|
|
689
|
+
'settleId': undefined,
|
|
690
|
+
'type': 'spot',
|
|
691
|
+
'spot': true,
|
|
692
|
+
'margin': marginTradable,
|
|
693
|
+
'swap': false,
|
|
694
|
+
'future': false,
|
|
695
|
+
'option': false,
|
|
696
|
+
'active': active,
|
|
697
|
+
'contract': false,
|
|
698
|
+
'linear': undefined,
|
|
699
|
+
'inverse': undefined,
|
|
700
|
+
'taker': fee,
|
|
701
|
+
'maker': fee,
|
|
702
|
+
'contractSize': undefined,
|
|
703
|
+
'expiry': undefined,
|
|
704
|
+
'expiryDatetime': undefined,
|
|
705
|
+
'strike': undefined,
|
|
706
|
+
'optionType': undefined,
|
|
707
|
+
'precision': {
|
|
708
|
+
'amount': this.safeNumber(market, 'lotSize'),
|
|
709
|
+
'price': this.safeNumber(market, 'tickSize'),
|
|
710
|
+
},
|
|
711
|
+
'limits': {
|
|
712
|
+
'leverage': {
|
|
713
|
+
'min': undefined,
|
|
714
|
+
'max': undefined,
|
|
715
|
+
},
|
|
716
|
+
'amount': {
|
|
717
|
+
'min': minQty,
|
|
718
|
+
'max': maxQty,
|
|
719
|
+
},
|
|
720
|
+
'price': {
|
|
721
|
+
'min': minPrice,
|
|
722
|
+
'max': maxPrice,
|
|
723
|
+
},
|
|
724
|
+
'cost': {
|
|
725
|
+
'min': this.safeNumber(market, 'minNotional'),
|
|
726
|
+
'max': this.safeNumber(market, 'maxNotional'),
|
|
727
|
+
},
|
|
728
|
+
},
|
|
729
|
+
'created': this.safeInteger(market, 'tradingStartTime'),
|
|
730
|
+
'info': market,
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
return result;
|
|
734
|
+
}
|
|
735
|
+
async fetchContractMarkets(params = {}) {
|
|
736
|
+
const contracts = await this.v2PublicGetFuturesContract(params);
|
|
676
737
|
//
|
|
677
738
|
// {
|
|
678
739
|
// "code": 0,
|
|
@@ -685,9 +746,9 @@ export default class ascendex extends Exchange {
|
|
|
685
746
|
// "underlying": "BTC/USDT",
|
|
686
747
|
// "tradingStartTime": 1579701600000,
|
|
687
748
|
// "priceFilter": {
|
|
688
|
-
// "minPrice": "1",
|
|
749
|
+
// "minPrice": "0.1",
|
|
689
750
|
// "maxPrice": "1000000",
|
|
690
|
-
// "tickSize": "1"
|
|
751
|
+
// "tickSize": "0.1"
|
|
691
752
|
// },
|
|
692
753
|
// "lotSizeFilter": {
|
|
693
754
|
// "minQty": "0.0001",
|
|
@@ -710,52 +771,25 @@ export default class ascendex extends Exchange {
|
|
|
710
771
|
// ]
|
|
711
772
|
// }
|
|
712
773
|
//
|
|
713
|
-
const
|
|
714
|
-
const productsData = this.safeList(products, 'data', []);
|
|
715
|
-
const productsById = this.indexBy(productsData, 'symbol');
|
|
716
|
-
const cashData = this.safeList(cash, 'data', []);
|
|
717
|
-
const perpetualsData = this.safeList(perpetuals, 'data', []);
|
|
718
|
-
const cashAndPerpetualsData = this.arrayConcat(cashData, perpetualsData);
|
|
719
|
-
const cashAndPerpetualsById = this.indexBy(cashAndPerpetualsData, 'symbol');
|
|
720
|
-
const dataById = this.deepExtend(productsById, cashAndPerpetualsById);
|
|
721
|
-
const ids = Object.keys(dataById);
|
|
774
|
+
const data = this.safeList(contracts, 'data', []);
|
|
722
775
|
const result = [];
|
|
723
|
-
for (let i = 0; i <
|
|
724
|
-
const
|
|
725
|
-
const
|
|
726
|
-
const
|
|
727
|
-
const settle = this.safeCurrencyCode(settleId);
|
|
728
|
-
const status = this.safeString(market, 'status');
|
|
729
|
-
const domain = this.safeString(market, 'domain');
|
|
730
|
-
let active = false;
|
|
731
|
-
if (((status === 'Normal') || (status === 'InternalTrading')) && (domain !== 'LeveragedETF')) {
|
|
732
|
-
active = true;
|
|
733
|
-
}
|
|
734
|
-
const spot = settle === undefined;
|
|
735
|
-
const swap = !spot;
|
|
736
|
-
const linear = swap ? true : undefined;
|
|
737
|
-
let minQty = this.safeNumber(market, 'minQty');
|
|
738
|
-
let maxQty = this.safeNumber(market, 'maxQty');
|
|
739
|
-
let minPrice = this.safeNumber(market, 'tickSize');
|
|
740
|
-
let maxPrice = undefined;
|
|
741
|
-
const underlying = this.safeString2(market, 'underlying', 'symbol');
|
|
776
|
+
for (let i = 0; i < data.length; i++) {
|
|
777
|
+
const market = data[i];
|
|
778
|
+
const id = this.safeString(market, 'symbol');
|
|
779
|
+
const underlying = this.safeString(market, 'underlying');
|
|
742
780
|
const parts = underlying.split('/');
|
|
743
781
|
const baseId = this.safeString(parts, 0);
|
|
744
|
-
const quoteId = this.safeString(parts, 1);
|
|
745
782
|
const base = this.safeCurrencyCode(baseId);
|
|
783
|
+
const quoteId = this.safeString(parts, 1);
|
|
746
784
|
const quote = this.safeCurrencyCode(quoteId);
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
maxPrice = this.safeNumber(priceFilter, 'maxPrice');
|
|
755
|
-
symbol = base + '/' + quote + ':' + settle;
|
|
756
|
-
}
|
|
785
|
+
const settleId = this.safeString(market, 'settlementAsset');
|
|
786
|
+
const settle = this.safeCurrencyCode(settleId);
|
|
787
|
+
const linear = settle === quote;
|
|
788
|
+
const inverse = settle === base;
|
|
789
|
+
const symbol = base + '/' + quote + ':' + settle;
|
|
790
|
+
const priceFilter = this.safeDict(market, 'priceFilter');
|
|
791
|
+
const lotSizeFilter = this.safeDict(market, 'lotSizeFilter');
|
|
757
792
|
const fee = this.safeNumber(market, 'commissionReserveRate');
|
|
758
|
-
const marginTradable = this.safeBool(market, 'marginTradable', false);
|
|
759
793
|
result.push({
|
|
760
794
|
'id': id,
|
|
761
795
|
'symbol': symbol,
|
|
@@ -765,26 +799,26 @@ export default class ascendex extends Exchange {
|
|
|
765
799
|
'baseId': baseId,
|
|
766
800
|
'quoteId': quoteId,
|
|
767
801
|
'settleId': settleId,
|
|
768
|
-
'type':
|
|
769
|
-
'spot':
|
|
770
|
-
'margin':
|
|
771
|
-
'swap':
|
|
802
|
+
'type': 'swap',
|
|
803
|
+
'spot': false,
|
|
804
|
+
'margin': undefined,
|
|
805
|
+
'swap': true,
|
|
772
806
|
'future': false,
|
|
773
807
|
'option': false,
|
|
774
|
-
'active':
|
|
775
|
-
'contract':
|
|
808
|
+
'active': this.safeString(market, 'status') === 'Normal',
|
|
809
|
+
'contract': true,
|
|
776
810
|
'linear': linear,
|
|
777
|
-
'inverse':
|
|
811
|
+
'inverse': inverse,
|
|
778
812
|
'taker': fee,
|
|
779
813
|
'maker': fee,
|
|
780
|
-
'contractSize':
|
|
814
|
+
'contractSize': this.parseNumber('1'),
|
|
781
815
|
'expiry': undefined,
|
|
782
816
|
'expiryDatetime': undefined,
|
|
783
817
|
'strike': undefined,
|
|
784
818
|
'optionType': undefined,
|
|
785
819
|
'precision': {
|
|
786
|
-
'amount': this.safeNumber(
|
|
787
|
-
'price': this.safeNumber(
|
|
820
|
+
'amount': this.safeNumber(lotSizeFilter, 'lotSize'),
|
|
821
|
+
'price': this.safeNumber(priceFilter, 'tickSize'),
|
|
788
822
|
},
|
|
789
823
|
'limits': {
|
|
790
824
|
'leverage': {
|
|
@@ -792,12 +826,12 @@ export default class ascendex extends Exchange {
|
|
|
792
826
|
'max': undefined,
|
|
793
827
|
},
|
|
794
828
|
'amount': {
|
|
795
|
-
'min': minQty,
|
|
796
|
-
'max': maxQty,
|
|
829
|
+
'min': this.safeNumber(lotSizeFilter, 'minQty'),
|
|
830
|
+
'max': this.safeNumber(lotSizeFilter, 'maxQty'),
|
|
797
831
|
},
|
|
798
832
|
'price': {
|
|
799
|
-
'min': minPrice,
|
|
800
|
-
'max': maxPrice,
|
|
833
|
+
'min': this.safeNumber(priceFilter, 'minPrice'),
|
|
834
|
+
'max': this.safeNumber(priceFilter, 'maxPrice'),
|
|
801
835
|
},
|
|
802
836
|
'cost': {
|
|
803
837
|
'min': this.safeNumber(market, 'minNotional'),
|
|
@@ -335,7 +335,21 @@ export default class Exchange {
|
|
|
335
335
|
onRestResponse(statusCode: any, statusText: any, url: any, method: any, responseHeaders: any, responseBody: any, requestHeaders: any, requestBody: any): any;
|
|
336
336
|
onJsonResponse(responseBody: any): any;
|
|
337
337
|
loadMarketsHelper(reload?: boolean, params?: {}): Promise<Dictionary<any>>;
|
|
338
|
-
|
|
338
|
+
/**
|
|
339
|
+
* @method
|
|
340
|
+
* @name Exchange#loadMarkets
|
|
341
|
+
* @description Loads and prepares the markets for trading.
|
|
342
|
+
* @param {boolean} reload - If true, the markets will be reloaded from the exchange.
|
|
343
|
+
* @param {object} params - Additional exchange-specific parameters for the request.
|
|
344
|
+
* @returns A promise that resolves to a dictionary of markets.
|
|
345
|
+
* @throws An error if the markets cannot be loaded or prepared.
|
|
346
|
+
* @remarks This method is asynchronous and returns a promise.
|
|
347
|
+
* It ensures that the markets are only loaded once, even if the method is called multiple times.
|
|
348
|
+
* If the markets are already loaded and not reloading, the method returns the existing markets.
|
|
349
|
+
* If the markets are being reloaded, the method waits for the reload to complete before returning the markets.
|
|
350
|
+
* If an error occurs during the loading or preparation of the markets, the promise is rejected with the error.
|
|
351
|
+
*/
|
|
352
|
+
loadMarkets(reload?: boolean, params?: object): Promise<Dictionary<Market>>;
|
|
339
353
|
fetchCurrencies(params?: {}): Promise<Currencies>;
|
|
340
354
|
fetchCurrenciesWs(params?: {}): Promise<unknown>;
|
|
341
355
|
fetchMarkets(params?: {}): Promise<Market[]>;
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -729,8 +729,21 @@ export default class Exchange {
|
|
|
729
729
|
const markets = await this.fetchMarkets(params);
|
|
730
730
|
return this.setMarkets(markets, currencies);
|
|
731
731
|
}
|
|
732
|
+
/**
|
|
733
|
+
* @method
|
|
734
|
+
* @name Exchange#loadMarkets
|
|
735
|
+
* @description Loads and prepares the markets for trading.
|
|
736
|
+
* @param {boolean} reload - If true, the markets will be reloaded from the exchange.
|
|
737
|
+
* @param {object} params - Additional exchange-specific parameters for the request.
|
|
738
|
+
* @returns A promise that resolves to a dictionary of markets.
|
|
739
|
+
* @throws An error if the markets cannot be loaded or prepared.
|
|
740
|
+
* @remarks This method is asynchronous and returns a promise.
|
|
741
|
+
* It ensures that the markets are only loaded once, even if the method is called multiple times.
|
|
742
|
+
* If the markets are already loaded and not reloading, the method returns the existing markets.
|
|
743
|
+
* If the markets are being reloaded, the method waits for the reload to complete before returning the markets.
|
|
744
|
+
* If an error occurs during the loading or preparation of the markets, the promise is rejected with the error.
|
|
745
|
+
*/
|
|
732
746
|
async loadMarkets(reload = false, params = {}) {
|
|
733
|
-
// this method is async, it returns a promise
|
|
734
747
|
if ((reload && !this.reloadingMarkets) || !this.marketsLoading) {
|
|
735
748
|
this.reloadingMarkets = true;
|
|
736
749
|
this.marketsLoading = this.loadMarketsHelper(reload, params).then((resolved) => {
|
|
@@ -2579,7 +2592,7 @@ export default class Exchange {
|
|
|
2579
2592
|
currency['networks'][key]['active'] = false;
|
|
2580
2593
|
}
|
|
2581
2594
|
}
|
|
2582
|
-
active = this.safeBool(
|
|
2595
|
+
active = this.safeBool(currency['networks'][key], 'active'); // dict might have been updated on above lines, so access directly instead of `network` variable
|
|
2583
2596
|
const currencyActive = this.safeBool(currency, 'active');
|
|
2584
2597
|
if (currencyActive === undefined || active) {
|
|
2585
2598
|
currency['active'] = active;
|
package/js/src/base/types.d.ts
CHANGED
package/js/src/bequant.js
CHANGED
|
@@ -12,8 +12,8 @@ export default class bequant extends hitbtc {
|
|
|
12
12
|
return this.deepExtend(super.describe(), {
|
|
13
13
|
'id': 'bequant',
|
|
14
14
|
'name': 'Bequant',
|
|
15
|
-
'countries': ['MT'],
|
|
16
15
|
'pro': true,
|
|
16
|
+
'countries': ['MT'],
|
|
17
17
|
'urls': {
|
|
18
18
|
'logo': 'https://github.com/user-attachments/assets/0583ef1f-29fe-4b7c-8189-63565a0e2867',
|
|
19
19
|
'api': {
|
package/js/src/bitget.js
CHANGED
|
@@ -2080,9 +2080,7 @@ export default class bitget extends Exchange {
|
|
|
2080
2080
|
const chain = chains[j];
|
|
2081
2081
|
const networkId = this.safeString(chain, 'chain');
|
|
2082
2082
|
let network = this.networkIdToCode(networkId, code);
|
|
2083
|
-
|
|
2084
|
-
network = network.toUpperCase();
|
|
2085
|
-
}
|
|
2083
|
+
network = network.toUpperCase();
|
|
2086
2084
|
networks[network] = {
|
|
2087
2085
|
'info': chain,
|
|
2088
2086
|
'id': networkId,
|
|
@@ -2395,7 +2393,7 @@ export default class bitget extends Exchange {
|
|
|
2395
2393
|
'coin': currency['id'],
|
|
2396
2394
|
'address': address,
|
|
2397
2395
|
'chain': networkId,
|
|
2398
|
-
'size': amount,
|
|
2396
|
+
'size': this.currencyToPrecision(code, amount, networkCode),
|
|
2399
2397
|
'transferType': 'on_chain',
|
|
2400
2398
|
};
|
|
2401
2399
|
if (tag !== undefined) {
|
|
@@ -2420,8 +2418,6 @@ export default class bitget extends Exchange {
|
|
|
2420
2418
|
const fillResponseFromRequest = this.safeBool(withdrawOptions, 'fillResponseFromRequest', true);
|
|
2421
2419
|
if (fillResponseFromRequest) {
|
|
2422
2420
|
result['currency'] = code;
|
|
2423
|
-
result['timestamp'] = this.milliseconds();
|
|
2424
|
-
result['datetime'] = this.iso8601(this.milliseconds());
|
|
2425
2421
|
result['amount'] = amount;
|
|
2426
2422
|
result['tag'] = tag;
|
|
2427
2423
|
result['address'] = address;
|
|
@@ -2545,7 +2541,10 @@ export default class bitget extends Exchange {
|
|
|
2545
2541
|
const status = this.safeString(transaction, 'status');
|
|
2546
2542
|
const tag = this.safeString(transaction, 'tag');
|
|
2547
2543
|
const feeCostString = this.safeString(transaction, 'fee');
|
|
2548
|
-
|
|
2544
|
+
let feeCostAbsString = undefined;
|
|
2545
|
+
if (feeCostString !== undefined) {
|
|
2546
|
+
feeCostAbsString = Precise.stringAbs(feeCostString);
|
|
2547
|
+
}
|
|
2549
2548
|
let fee = undefined;
|
|
2550
2549
|
let amountString = this.safeString(transaction, 'size');
|
|
2551
2550
|
if (feeCostAbsString !== undefined) {
|
package/js/src/bitmart.js
CHANGED
|
@@ -2374,7 +2374,7 @@ export default class bitmart extends Exchange {
|
|
|
2374
2374
|
const code = this.safeCurrencyCode(currencyId);
|
|
2375
2375
|
const account = this.account();
|
|
2376
2376
|
account['free'] = this.safeString2(balance, 'available', 'available_balance');
|
|
2377
|
-
account['used'] = this.
|
|
2377
|
+
account['used'] = this.safeStringN(balance, ['unAvailable', 'frozen', 'frozen_balance']);
|
|
2378
2378
|
result[code] = account;
|
|
2379
2379
|
}
|
|
2380
2380
|
return this.safeBalance(result);
|