ccxt 4.4.92 → 4.4.93
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 +3 -3
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ascendex.js +9 -8
- package/dist/cjs/src/base/Exchange.js +67 -11
- package/dist/cjs/src/binance.js +44 -1
- package/dist/cjs/src/bitmex.js +3 -3
- package/dist/cjs/src/bybit.js +83 -8
- package/dist/cjs/src/coinbaseexchange.js +53 -0
- package/dist/cjs/src/coincheck.js +47 -4
- package/dist/cjs/src/coinex.js +19 -14
- package/dist/cjs/src/cryptomus.js +30 -53
- package/dist/cjs/src/deribit.js +6 -6
- package/dist/cjs/src/exmo.js +66 -61
- package/dist/cjs/src/hyperliquid.js +2 -1
- package/dist/cjs/src/kucoin.js +13 -15
- package/dist/cjs/src/latoken.js +19 -74
- package/dist/cjs/src/lbank.js +2 -2
- package/dist/cjs/src/okx.js +156 -0
- package/dist/cjs/src/paradex.js +54 -0
- package/dist/cjs/src/phemex.js +3 -3
- package/dist/cjs/src/pro/bitstamp.js +55 -16
- package/dist/cjs/src/pro/bybit.js +2 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/ascendex.js +9 -8
- package/js/src/base/Exchange.d.ts +3 -1
- package/js/src/base/Exchange.js +67 -11
- package/js/src/binance.d.ts +10 -0
- package/js/src/binance.js +44 -1
- package/js/src/bitmex.d.ts +1 -1
- package/js/src/bitmex.js +3 -3
- package/js/src/bybit.d.ts +12 -1
- package/js/src/bybit.js +83 -8
- package/js/src/coinbaseexchange.js +53 -0
- package/js/src/coincheck.js +48 -5
- package/js/src/coinex.js +16 -13
- package/js/src/cryptomus.js +30 -53
- package/js/src/deribit.js +6 -6
- package/js/src/exmo.js +66 -61
- package/js/src/hyperliquid.js +2 -1
- package/js/src/kucoin.js +13 -15
- package/js/src/latoken.d.ts +0 -1
- package/js/src/latoken.js +19 -74
- package/js/src/lbank.js +2 -2
- package/js/src/okx.d.ts +12 -0
- package/js/src/okx.js +156 -0
- package/js/src/paradex.d.ts +10 -0
- package/js/src/paradex.js +54 -0
- package/js/src/phemex.js +3 -3
- package/js/src/pro/bitstamp.js +55 -16
- package/js/src/pro/bybit.js +2 -1
- package/package.json +1 -1
package/js/src/cryptomus.js
CHANGED
|
@@ -366,68 +366,45 @@ export default class cryptomus extends Exchange {
|
|
|
366
366
|
// }
|
|
367
367
|
//
|
|
368
368
|
const coins = this.safeList(response, 'result');
|
|
369
|
+
const groupedById = this.groupBy(coins, 'currency_code');
|
|
370
|
+
const keys = Object.keys(groupedById);
|
|
369
371
|
const result = {};
|
|
370
|
-
for (let i = 0; i <
|
|
371
|
-
const
|
|
372
|
-
const
|
|
373
|
-
const
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
'
|
|
381
|
-
'
|
|
382
|
-
'deposit': undefined,
|
|
383
|
-
'withdraw': undefined,
|
|
384
|
-
'fee': undefined,
|
|
372
|
+
for (let i = 0; i < keys.length; i++) {
|
|
373
|
+
const id = keys[i];
|
|
374
|
+
const code = this.safeCurrencyCode(id);
|
|
375
|
+
const networks = {};
|
|
376
|
+
const networkEntries = groupedById[id];
|
|
377
|
+
for (let j = 0; j < networkEntries.length; j++) {
|
|
378
|
+
const networkEntry = networkEntries[j];
|
|
379
|
+
const networkId = this.safeString(networkEntry, 'network_code');
|
|
380
|
+
const networkCode = this.networkIdToCode(networkId);
|
|
381
|
+
networks[networkCode] = {
|
|
382
|
+
'id': networkId,
|
|
383
|
+
'network': networkCode,
|
|
385
384
|
'limits': {
|
|
386
385
|
'withdraw': {
|
|
387
|
-
'min':
|
|
388
|
-
'max':
|
|
386
|
+
'min': this.safeNumber(networkEntry, 'min_withdraw'),
|
|
387
|
+
'max': this.safeNumber(networkEntry, 'max_withdraw'),
|
|
389
388
|
},
|
|
390
389
|
'deposit': {
|
|
391
|
-
'min':
|
|
392
|
-
'max':
|
|
390
|
+
'min': this.safeNumber(networkEntry, 'min_deposit'),
|
|
391
|
+
'max': this.safeNumber(networkEntry, 'max_deposit'),
|
|
393
392
|
},
|
|
394
393
|
},
|
|
395
|
-
'
|
|
396
|
-
'
|
|
394
|
+
'active': undefined,
|
|
395
|
+
'deposit': this.safeBool(networkEntry, 'can_withdraw'),
|
|
396
|
+
'withdraw': this.safeBool(networkEntry, 'can_deposit'),
|
|
397
|
+
'fee': undefined,
|
|
398
|
+
'precision': undefined,
|
|
399
|
+
'info': networkEntry,
|
|
397
400
|
};
|
|
398
401
|
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
'
|
|
403
|
-
'
|
|
404
|
-
|
|
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
|
|
402
|
+
result[code] = this.safeCurrencyStructure({
|
|
403
|
+
'id': id,
|
|
404
|
+
'code': code,
|
|
405
|
+
'networks': networks,
|
|
406
|
+
'info': networkEntries,
|
|
407
|
+
});
|
|
431
408
|
}
|
|
432
409
|
return result;
|
|
433
410
|
}
|
package/js/src/deribit.js
CHANGED
|
@@ -2694,21 +2694,21 @@ export default class deribit extends Exchange {
|
|
|
2694
2694
|
const unrealizedPnl = this.safeString(position, 'floating_profit_loss');
|
|
2695
2695
|
const initialMarginString = this.safeString(position, 'initial_margin');
|
|
2696
2696
|
const notionalString = this.safeString(position, 'size_currency');
|
|
2697
|
+
const notionalStringAbs = Precise.stringAbs(notionalString);
|
|
2697
2698
|
const maintenanceMarginString = this.safeString(position, 'maintenance_margin');
|
|
2698
|
-
const currentTime = this.milliseconds();
|
|
2699
2699
|
return this.safePosition({
|
|
2700
2700
|
'info': position,
|
|
2701
2701
|
'id': undefined,
|
|
2702
2702
|
'symbol': this.safeString(market, 'symbol'),
|
|
2703
|
-
'timestamp':
|
|
2704
|
-
'datetime':
|
|
2703
|
+
'timestamp': undefined,
|
|
2704
|
+
'datetime': undefined,
|
|
2705
2705
|
'lastUpdateTimestamp': undefined,
|
|
2706
2706
|
'initialMargin': this.parseNumber(initialMarginString),
|
|
2707
|
-
'initialMarginPercentage': this.parseNumber(Precise.stringMul(Precise.stringDiv(initialMarginString,
|
|
2707
|
+
'initialMarginPercentage': this.parseNumber(Precise.stringMul(Precise.stringDiv(initialMarginString, notionalStringAbs), '100')),
|
|
2708
2708
|
'maintenanceMargin': this.parseNumber(maintenanceMarginString),
|
|
2709
|
-
'maintenanceMarginPercentage': this.parseNumber(Precise.stringMul(Precise.stringDiv(maintenanceMarginString,
|
|
2709
|
+
'maintenanceMarginPercentage': this.parseNumber(Precise.stringMul(Precise.stringDiv(maintenanceMarginString, notionalStringAbs), '100')),
|
|
2710
2710
|
'entryPrice': this.safeNumber(position, 'average_price'),
|
|
2711
|
-
'notional': this.parseNumber(
|
|
2711
|
+
'notional': this.parseNumber(notionalStringAbs),
|
|
2712
2712
|
'leverage': this.safeInteger(position, 'leverage'),
|
|
2713
2713
|
'unrealizedPnl': this.parseNumber(unrealizedPnl),
|
|
2714
2714
|
'contracts': undefined,
|
package/js/src/exmo.js
CHANGED
|
@@ -716,86 +716,91 @@ export default class exmo extends Exchange {
|
|
|
716
716
|
for (let i = 0; i < currencyList.length; i++) {
|
|
717
717
|
const currency = currencyList[i];
|
|
718
718
|
const currencyId = this.safeString(currency, 'name');
|
|
719
|
-
const
|
|
720
|
-
const providers = this.safeValue(cryptoList, currencyId);
|
|
721
|
-
let active = false;
|
|
719
|
+
const code = this.safeCurrencyCode(currencyId);
|
|
722
720
|
let type = 'crypto';
|
|
723
|
-
const
|
|
724
|
-
|
|
725
|
-
'min': undefined,
|
|
726
|
-
'max': undefined,
|
|
727
|
-
},
|
|
728
|
-
'withdraw': {
|
|
729
|
-
'min': undefined,
|
|
730
|
-
'max': undefined,
|
|
731
|
-
},
|
|
732
|
-
};
|
|
733
|
-
let fee = undefined;
|
|
734
|
-
let depositEnabled = undefined;
|
|
735
|
-
let withdrawEnabled = undefined;
|
|
721
|
+
const networks = {};
|
|
722
|
+
const providers = this.safeList(cryptoList, currencyId);
|
|
736
723
|
if (providers === undefined) {
|
|
737
|
-
active = true;
|
|
738
724
|
type = 'fiat';
|
|
739
725
|
}
|
|
740
726
|
else {
|
|
741
727
|
for (let j = 0; j < providers.length; j++) {
|
|
742
728
|
const provider = providers[j];
|
|
729
|
+
const name = this.safeString(provider, 'name');
|
|
730
|
+
// get network-id by removing extra things
|
|
731
|
+
let networkId = name.replace(currencyId + ' ', '');
|
|
732
|
+
networkId = networkId.replace('(', '');
|
|
733
|
+
const replaceChar = ')'; // transpiler trick
|
|
734
|
+
networkId = networkId.replace(replaceChar, '');
|
|
735
|
+
const networkCode = this.networkIdToCode(networkId);
|
|
736
|
+
if (!(networkCode in networks)) {
|
|
737
|
+
networks[networkCode] = {
|
|
738
|
+
'id': networkId,
|
|
739
|
+
'network': networkCode,
|
|
740
|
+
'active': undefined,
|
|
741
|
+
'deposit': undefined,
|
|
742
|
+
'withdraw': undefined,
|
|
743
|
+
'fee': undefined,
|
|
744
|
+
'limits': {
|
|
745
|
+
'withdraw': {
|
|
746
|
+
'min': undefined,
|
|
747
|
+
'max': undefined,
|
|
748
|
+
},
|
|
749
|
+
'deposit': {
|
|
750
|
+
'min': undefined,
|
|
751
|
+
'max': undefined,
|
|
752
|
+
},
|
|
753
|
+
},
|
|
754
|
+
'info': [], // set as array, because of multiple network sub-entries
|
|
755
|
+
};
|
|
756
|
+
}
|
|
743
757
|
const typeInner = this.safeString(provider, 'type');
|
|
744
758
|
const minValue = this.safeString(provider, 'min');
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
}
|
|
749
|
-
const activeProvider = this.safeValue(provider, 'enabled');
|
|
759
|
+
const maxValue = this.safeString(provider, 'max');
|
|
760
|
+
const activeProvider = this.safeBool(provider, 'enabled');
|
|
761
|
+
const networkEntry = networks[networkCode];
|
|
750
762
|
if (typeInner === 'deposit') {
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
else if (!activeProvider) {
|
|
755
|
-
depositEnabled = false;
|
|
756
|
-
}
|
|
763
|
+
networkEntry['deposit'] = activeProvider;
|
|
764
|
+
networkEntry['limits']['deposit']['min'] = minValue;
|
|
765
|
+
networkEntry['limits']['deposit']['max'] = maxValue;
|
|
757
766
|
}
|
|
758
767
|
else if (typeInner === 'withdraw') {
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
else if (!activeProvider) {
|
|
763
|
-
withdrawEnabled = false;
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
if (activeProvider) {
|
|
767
|
-
active = true;
|
|
768
|
-
const limitMin = this.numberToString(limits[typeInner]['min']);
|
|
769
|
-
if ((limits[typeInner]['min'] === undefined) || (Precise.stringLt(minValue, limitMin))) {
|
|
770
|
-
limits[typeInner]['min'] = minValue;
|
|
771
|
-
limits[typeInner]['max'] = maxValue;
|
|
772
|
-
if (typeInner === 'withdraw') {
|
|
773
|
-
const commissionDesc = this.safeString(provider, 'commission_desc');
|
|
774
|
-
fee = this.parseFixedFloatValue(commissionDesc);
|
|
775
|
-
}
|
|
776
|
-
}
|
|
768
|
+
networkEntry['withdraw'] = activeProvider;
|
|
769
|
+
networkEntry['limits']['withdraw']['min'] = minValue;
|
|
770
|
+
networkEntry['limits']['withdraw']['max'] = maxValue;
|
|
777
771
|
}
|
|
772
|
+
const info = this.safeList(networkEntry, 'info');
|
|
773
|
+
info.push(provider);
|
|
774
|
+
networkEntry['info'] = info;
|
|
775
|
+
networks[networkCode] = networkEntry;
|
|
778
776
|
}
|
|
779
777
|
}
|
|
780
|
-
|
|
781
|
-
const info = {
|
|
782
|
-
'currency': currency,
|
|
783
|
-
'providers': providers,
|
|
784
|
-
};
|
|
785
|
-
result[code] = {
|
|
778
|
+
result[code] = this.safeCurrencyStructure({
|
|
786
779
|
'id': currencyId,
|
|
787
780
|
'code': code,
|
|
788
|
-
'name':
|
|
781
|
+
'name': this.safeString(currency, 'description'),
|
|
789
782
|
'type': type,
|
|
790
|
-
'active':
|
|
791
|
-
'deposit':
|
|
792
|
-
'withdraw':
|
|
793
|
-
'fee':
|
|
783
|
+
'active': undefined,
|
|
784
|
+
'deposit': undefined,
|
|
785
|
+
'withdraw': undefined,
|
|
786
|
+
'fee': undefined,
|
|
794
787
|
'precision': this.parseNumber('1e-8'),
|
|
795
|
-
'limits':
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
788
|
+
'limits': {
|
|
789
|
+
'withdraw': {
|
|
790
|
+
'min': undefined,
|
|
791
|
+
'max': undefined,
|
|
792
|
+
},
|
|
793
|
+
'deposit': {
|
|
794
|
+
'min': undefined,
|
|
795
|
+
'max': undefined,
|
|
796
|
+
},
|
|
797
|
+
},
|
|
798
|
+
'info': {
|
|
799
|
+
'currency': currency,
|
|
800
|
+
'providers': providers,
|
|
801
|
+
},
|
|
802
|
+
'networks': networks,
|
|
803
|
+
});
|
|
799
804
|
}
|
|
800
805
|
return result;
|
|
801
806
|
}
|
package/js/src/hyperliquid.js
CHANGED
|
@@ -695,7 +695,8 @@ export default class hyperliquid extends Exchange {
|
|
|
695
695
|
// }
|
|
696
696
|
//
|
|
697
697
|
const quoteId = 'USDC';
|
|
698
|
-
const
|
|
698
|
+
const baseName = this.safeString(market, 'name');
|
|
699
|
+
const base = this.safeCurrencyCode(baseName);
|
|
699
700
|
const quote = this.safeCurrencyCode(quoteId);
|
|
700
701
|
const baseId = this.safeString(market, 'baseId');
|
|
701
702
|
const settleId = 'USDC';
|
package/js/src/kucoin.js
CHANGED
|
@@ -1389,36 +1389,32 @@ export default class kucoin extends Exchange {
|
|
|
1389
1389
|
// }
|
|
1390
1390
|
//
|
|
1391
1391
|
const currenciesData = this.safeList(response, 'data', []);
|
|
1392
|
+
const brokenCurrencies = this.safeList(this.options, 'brokenCurrencies', ['00', 'OPEN_ERROR', 'HUF', 'BDT']);
|
|
1393
|
+
const otherFiats = this.safeList(this.options, 'fiats', ['KWD', 'IRR', 'PKR']);
|
|
1392
1394
|
const result = {};
|
|
1393
1395
|
for (let i = 0; i < currenciesData.length; i++) {
|
|
1394
1396
|
const entry = currenciesData[i];
|
|
1395
1397
|
const id = this.safeString(entry, 'currency');
|
|
1396
|
-
|
|
1398
|
+
if (this.inArray(id, brokenCurrencies)) {
|
|
1399
|
+
continue; // skip buggy entries: https://t.me/KuCoin_API/217798
|
|
1400
|
+
}
|
|
1397
1401
|
const code = this.safeCurrencyCode(id);
|
|
1398
1402
|
const networks = {};
|
|
1399
1403
|
const chains = this.safeList(entry, 'chains', []);
|
|
1400
|
-
const rawPrecision = this.safeString(entry, 'precision');
|
|
1401
|
-
const precision = this.parseNumber(this.parsePrecision(rawPrecision));
|
|
1402
1404
|
const chainsLength = chains.length;
|
|
1403
|
-
if (!chainsLength) {
|
|
1404
|
-
// one buggy coin, which doesn't contain info https://t.me/KuCoin_API/173118
|
|
1405
|
-
continue;
|
|
1406
|
-
}
|
|
1407
1405
|
for (let j = 0; j < chainsLength; j++) {
|
|
1408
1406
|
const chain = chains[j];
|
|
1409
1407
|
const chainId = this.safeString(chain, 'chainId');
|
|
1410
1408
|
const networkCode = this.networkIdToCode(chainId, code);
|
|
1411
|
-
const chainWithdrawEnabled = this.safeBool(chain, 'isWithdrawEnabled', false);
|
|
1412
|
-
const chainDepositEnabled = this.safeBool(chain, 'isDepositEnabled', false);
|
|
1413
1409
|
networks[networkCode] = {
|
|
1414
1410
|
'info': chain,
|
|
1415
1411
|
'id': chainId,
|
|
1416
1412
|
'name': this.safeString(chain, 'chainName'),
|
|
1417
1413
|
'code': networkCode,
|
|
1418
|
-
'active':
|
|
1414
|
+
'active': undefined,
|
|
1419
1415
|
'fee': this.safeNumber(chain, 'withdrawalMinFee'),
|
|
1420
|
-
'deposit':
|
|
1421
|
-
'withdraw':
|
|
1416
|
+
'deposit': this.safeBool(chain, 'isDepositEnabled'),
|
|
1417
|
+
'withdraw': this.safeBool(chain, 'isWithdrawEnabled'),
|
|
1422
1418
|
'precision': this.parseNumber(this.parsePrecision(this.safeString(chain, 'withdrawPrecision'))),
|
|
1423
1419
|
'limits': {
|
|
1424
1420
|
'withdraw': {
|
|
@@ -1433,10 +1429,12 @@ export default class kucoin extends Exchange {
|
|
|
1433
1429
|
};
|
|
1434
1430
|
}
|
|
1435
1431
|
// kucoin has determined 'fiat' currencies with below logic
|
|
1436
|
-
const
|
|
1432
|
+
const rawPrecision = this.safeString(entry, 'precision');
|
|
1433
|
+
const precision = this.parseNumber(this.parsePrecision(rawPrecision));
|
|
1434
|
+
const isFiat = this.inArray(id, otherFiats) || ((rawPrecision === '2') && (chainsLength === 0));
|
|
1437
1435
|
result[code] = this.safeCurrencyStructure({
|
|
1438
1436
|
'id': id,
|
|
1439
|
-
'name':
|
|
1437
|
+
'name': this.safeString(entry, 'fullName'),
|
|
1440
1438
|
'code': code,
|
|
1441
1439
|
'type': isFiat ? 'fiat' : 'crypto',
|
|
1442
1440
|
'precision': precision,
|
|
@@ -2697,7 +2695,7 @@ export default class kucoin extends Exchange {
|
|
|
2697
2695
|
async cancelAllOrders(symbol = undefined, params = {}) {
|
|
2698
2696
|
await this.loadMarkets();
|
|
2699
2697
|
const request = {};
|
|
2700
|
-
const trigger = this.
|
|
2698
|
+
const trigger = this.safeBool2(params, 'trigger', 'stop', false);
|
|
2701
2699
|
let hf = undefined;
|
|
2702
2700
|
[hf, params] = this.handleHfAndParams(params);
|
|
2703
2701
|
params = this.omit(params, 'stop');
|
package/js/src/latoken.d.ts
CHANGED
|
@@ -25,7 +25,6 @@ export default class latoken extends Exchange {
|
|
|
25
25
|
* @returns {object[]} an array of objects representing market data
|
|
26
26
|
*/
|
|
27
27
|
fetchMarkets(params?: {}): Promise<Market[]>;
|
|
28
|
-
fetchCurrenciesFromCache(params?: {}): Promise<any>;
|
|
29
28
|
/**
|
|
30
29
|
* @method
|
|
31
30
|
* @name latoken#fetchCurrencies
|
package/js/src/latoken.js
CHANGED
|
@@ -236,6 +236,8 @@ export default class latoken extends Exchange {
|
|
|
236
236
|
'fetchTradingFee': {
|
|
237
237
|
'method': 'fetchPrivateTradingFee', // or 'fetchPublicTradingFee'
|
|
238
238
|
},
|
|
239
|
+
'timeDifference': 0,
|
|
240
|
+
'adjustForTimeDifference': true, // controls the adjustment logic upon instantiation
|
|
239
241
|
},
|
|
240
242
|
'features': {
|
|
241
243
|
'spot': {
|
|
@@ -336,39 +338,6 @@ export default class latoken extends Exchange {
|
|
|
336
338
|
* @returns {object[]} an array of objects representing market data
|
|
337
339
|
*/
|
|
338
340
|
async fetchMarkets(params = {}) {
|
|
339
|
-
const currencies = await this.fetchCurrenciesFromCache(params);
|
|
340
|
-
//
|
|
341
|
-
// [
|
|
342
|
-
// {
|
|
343
|
-
// "id":"1a075819-9e0b-48fc-8784-4dab1d186d6d",
|
|
344
|
-
// "status":"CURRENCY_STATUS_ACTIVE",
|
|
345
|
-
// "type":"CURRENCY_TYPE_ALTERNATIVE", // CURRENCY_TYPE_CRYPTO, CURRENCY_TYPE_IEO
|
|
346
|
-
// "name":"MyCryptoBank",
|
|
347
|
-
// "tag":"MCB",
|
|
348
|
-
// "description":"",
|
|
349
|
-
// "logo":"",
|
|
350
|
-
// "decimals":18,
|
|
351
|
-
// "created":1572912000000,
|
|
352
|
-
// "tier":1,
|
|
353
|
-
// "assetClass":"ASSET_CLASS_UNKNOWN",
|
|
354
|
-
// "minTransferAmount":0
|
|
355
|
-
// },
|
|
356
|
-
// {
|
|
357
|
-
// "id":"db02758e-2507-46a5-a805-7bc60355b3eb",
|
|
358
|
-
// "status":"CURRENCY_STATUS_ACTIVE",
|
|
359
|
-
// "type":"CURRENCY_TYPE_FUTURES_CONTRACT",
|
|
360
|
-
// "name":"BTC USDT Futures Contract",
|
|
361
|
-
// "tag":"BTCUSDT",
|
|
362
|
-
// "description":"",
|
|
363
|
-
// "logo":"",
|
|
364
|
-
// "decimals":8,
|
|
365
|
-
// "created":1589459984395,
|
|
366
|
-
// "tier":1,
|
|
367
|
-
// "assetClass":"ASSET_CLASS_UNKNOWN",
|
|
368
|
-
// "minTransferAmount":0
|
|
369
|
-
// },
|
|
370
|
-
// ]
|
|
371
|
-
//
|
|
372
341
|
const response = await this.publicGetPair(params);
|
|
373
342
|
//
|
|
374
343
|
// [
|
|
@@ -390,9 +359,10 @@ export default class latoken extends Exchange {
|
|
|
390
359
|
// }
|
|
391
360
|
// ]
|
|
392
361
|
//
|
|
393
|
-
if (this.
|
|
362
|
+
if (this.safeBool(this.options, 'adjustForTimeDifference', false)) {
|
|
394
363
|
await this.loadTimeDifference();
|
|
395
364
|
}
|
|
365
|
+
const currencies = this.safeDict(this.options, 'cachedCurrencies', {});
|
|
396
366
|
const currenciesById = this.indexBy(currencies, 'id');
|
|
397
367
|
const result = [];
|
|
398
368
|
for (let i = 0; i < response.length; i++) {
|
|
@@ -401,11 +371,13 @@ export default class latoken extends Exchange {
|
|
|
401
371
|
// the exchange shows them inverted
|
|
402
372
|
const baseId = this.safeString(market, 'baseCurrency');
|
|
403
373
|
const quoteId = this.safeString(market, 'quoteCurrency');
|
|
404
|
-
const baseCurrency = this.
|
|
405
|
-
const quoteCurrency = this.
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
374
|
+
const baseCurrency = this.safeDict(currenciesById, baseId);
|
|
375
|
+
const quoteCurrency = this.safeDict(currenciesById, quoteId);
|
|
376
|
+
const baseCurrencyInfo = this.safeDict(baseCurrency, 'info');
|
|
377
|
+
const quoteCurrencyInfo = this.safeDict(quoteCurrency, 'info');
|
|
378
|
+
if (baseCurrencyInfo !== undefined && quoteCurrencyInfo !== undefined) {
|
|
379
|
+
const base = this.safeCurrencyCode(this.safeString(baseCurrencyInfo, 'tag'));
|
|
380
|
+
const quote = this.safeCurrencyCode(this.safeString(quoteCurrencyInfo, 'tag'));
|
|
409
381
|
const lowercaseQuote = quote.toLowerCase();
|
|
410
382
|
const capitalizedQuote = this.capitalize(lowercaseQuote);
|
|
411
383
|
const status = this.safeString(market, 'status');
|
|
@@ -462,22 +434,6 @@ export default class latoken extends Exchange {
|
|
|
462
434
|
}
|
|
463
435
|
return result;
|
|
464
436
|
}
|
|
465
|
-
async fetchCurrenciesFromCache(params = {}) {
|
|
466
|
-
// this method is now redundant
|
|
467
|
-
// currencies are now fetched before markets
|
|
468
|
-
const options = this.safeValue(this.options, 'fetchCurrencies', {});
|
|
469
|
-
const timestamp = this.safeInteger(options, 'timestamp');
|
|
470
|
-
const expires = this.safeInteger(options, 'expires', 1000);
|
|
471
|
-
const now = this.milliseconds();
|
|
472
|
-
if ((timestamp === undefined) || ((now - timestamp) > expires)) {
|
|
473
|
-
const response = await this.publicGetCurrency(params);
|
|
474
|
-
this.options['fetchCurrencies'] = this.extend(options, {
|
|
475
|
-
'response': response,
|
|
476
|
-
'timestamp': now,
|
|
477
|
-
});
|
|
478
|
-
}
|
|
479
|
-
return this.safeValue(this.options['fetchCurrencies'], 'response');
|
|
480
|
-
}
|
|
481
437
|
/**
|
|
482
438
|
* @method
|
|
483
439
|
* @name latoken#fetchCurrencies
|
|
@@ -486,7 +442,7 @@ export default class latoken extends Exchange {
|
|
|
486
442
|
* @returns {object} an associative dictionary of currencies
|
|
487
443
|
*/
|
|
488
444
|
async fetchCurrencies(params = {}) {
|
|
489
|
-
const response = await this.
|
|
445
|
+
const response = await this.publicGetCurrency(params);
|
|
490
446
|
//
|
|
491
447
|
// [
|
|
492
448
|
// {
|
|
@@ -525,29 +481,18 @@ export default class latoken extends Exchange {
|
|
|
525
481
|
const id = this.safeString(currency, 'id');
|
|
526
482
|
const tag = this.safeString(currency, 'tag');
|
|
527
483
|
const code = this.safeCurrencyCode(tag);
|
|
528
|
-
const fee = this.safeNumber(currency, 'fee');
|
|
529
484
|
const currencyType = this.safeString(currency, 'type');
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
type = 'other';
|
|
533
|
-
}
|
|
534
|
-
else {
|
|
535
|
-
// CURRENCY_TYPE_CRYPTO and CURRENCY_TYPE_IEO are all cryptos
|
|
536
|
-
type = 'crypto';
|
|
537
|
-
}
|
|
538
|
-
const status = this.safeString(currency, 'status');
|
|
539
|
-
const active = (status === 'CURRENCY_STATUS_ACTIVE');
|
|
540
|
-
const name = this.safeString(currency, 'name');
|
|
541
|
-
result[code] = {
|
|
485
|
+
const isCrypto = (currencyType === 'CURRENCY_TYPE_CRYPTO' || currencyType === 'CURRENCY_TYPE_IEO');
|
|
486
|
+
result[code] = this.safeCurrencyStructure({
|
|
542
487
|
'id': id,
|
|
543
488
|
'code': code,
|
|
544
489
|
'info': currency,
|
|
545
|
-
'name': name,
|
|
546
|
-
'type':
|
|
547
|
-
'active':
|
|
490
|
+
'name': this.safeString(currency, 'name'),
|
|
491
|
+
'type': isCrypto ? 'crypto' : 'other',
|
|
492
|
+
'active': this.safeString(currency, 'status') === 'CURRENCY_STATUS_ACTIVE',
|
|
548
493
|
'deposit': undefined,
|
|
549
494
|
'withdraw': undefined,
|
|
550
|
-
'fee': fee,
|
|
495
|
+
'fee': this.safeNumber(currency, 'fee'),
|
|
551
496
|
'precision': this.parseNumber(this.parsePrecision(this.safeString(currency, 'decimals'))),
|
|
552
497
|
'limits': {
|
|
553
498
|
'amount': {
|
|
@@ -560,7 +505,7 @@ export default class latoken extends Exchange {
|
|
|
560
505
|
},
|
|
561
506
|
},
|
|
562
507
|
'networks': {},
|
|
563
|
-
};
|
|
508
|
+
});
|
|
564
509
|
}
|
|
565
510
|
return result;
|
|
566
511
|
}
|
package/js/src/lbank.js
CHANGED
|
@@ -128,7 +128,7 @@ export default class lbank extends Exchange {
|
|
|
128
128
|
'accuracy': 2.5,
|
|
129
129
|
'usdToCny': 2.5,
|
|
130
130
|
'assetConfigs': 2.5,
|
|
131
|
-
'withdrawConfigs': 2.5,
|
|
131
|
+
'withdrawConfigs': 2.5 * 1.5,
|
|
132
132
|
'timestamp': 2.5,
|
|
133
133
|
'ticker/24hr': 2.5,
|
|
134
134
|
'ticker': 2.5,
|
|
@@ -672,7 +672,7 @@ export default class lbank extends Exchange {
|
|
|
672
672
|
'active': true,
|
|
673
673
|
'contract': true,
|
|
674
674
|
'linear': true,
|
|
675
|
-
'inverse':
|
|
675
|
+
'inverse': false,
|
|
676
676
|
'contractSize': this.safeNumber(market, 'volumeMultiple'),
|
|
677
677
|
'expiry': undefined,
|
|
678
678
|
'expiryDatetime': undefined,
|
package/js/src/okx.d.ts
CHANGED
|
@@ -959,6 +959,18 @@ export default class okx extends Exchange {
|
|
|
959
959
|
* @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
|
|
960
960
|
*/
|
|
961
961
|
fetchGreeks(symbol: string, params?: {}): Promise<Greeks>;
|
|
962
|
+
/**
|
|
963
|
+
* @method
|
|
964
|
+
* @name okx#fetchAllGreeks
|
|
965
|
+
* @description fetches all option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract
|
|
966
|
+
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-option-market-data
|
|
967
|
+
* @param {string[]} [symbols] unified symbols of the markets to fetch greeks for, all markets are returned if not assigned
|
|
968
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
969
|
+
* @param {string} params.uly Underlying, either uly or instFamily is required
|
|
970
|
+
* @param {string} params.instFamily Instrument family, either uly or instFamily is required
|
|
971
|
+
* @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
|
|
972
|
+
*/
|
|
973
|
+
fetchAllGreeks(symbols?: Strings, params?: {}): Promise<Greeks[]>;
|
|
962
974
|
parseGreeks(greeks: Dict, market?: Market): Greeks;
|
|
963
975
|
/**
|
|
964
976
|
* @method
|