ccxt 4.4.4 → 4.4.6
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/binance.js +3 -3
- package/dist/cjs/src/binanceus.js +1 -0
- package/dist/cjs/src/bitflyer.js +2 -2
- package/dist/cjs/src/bitget.js +56 -95
- package/dist/cjs/src/bitmart.js +186 -127
- package/dist/cjs/src/bybit.js +90 -7
- package/dist/cjs/src/coinbase.js +6 -8
- package/dist/cjs/src/kraken.js +6 -1
- package/dist/cjs/src/lykke.js +2 -2
- package/dist/cjs/src/mexc.js +37 -7
- package/dist/cjs/src/paradex.js +1 -1
- package/dist/cjs/src/pro/binance.js +6 -2
- package/dist/cjs/src/pro/binanceus.js +2 -1
- package/dist/cjs/src/pro/htx.js +14 -0
- package/dist/cjs/src/pro/hyperliquid.js +16 -1
- package/dist/cjs/src/pro/kraken.js +60 -0
- package/dist/cjs/src/pro/paradex.js +1 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bitmart.d.ts +4 -0
- package/js/src/binance.js +3 -3
- package/js/src/binanceus.js +1 -0
- package/js/src/bitflyer.js +2 -2
- package/js/src/bitget.d.ts +1 -1
- package/js/src/bitget.js +56 -95
- package/js/src/bitmart.js +186 -127
- package/js/src/bybit.js +90 -7
- package/js/src/coinbase.js +6 -8
- package/js/src/kraken.js +6 -1
- package/js/src/lykke.js +2 -2
- package/js/src/mexc.d.ts +1 -0
- package/js/src/mexc.js +37 -7
- package/js/src/paradex.js +1 -1
- package/js/src/pro/binance.d.ts +140 -0
- package/js/src/pro/binance.js +6 -2
- package/js/src/pro/binanceus.js +2 -1
- package/js/src/pro/htx.js +14 -0
- package/js/src/pro/hyperliquid.d.ts +1 -0
- package/js/src/pro/hyperliquid.js +16 -1
- package/js/src/pro/kraken.d.ts +3 -0
- package/js/src/pro/kraken.js +60 -0
- package/js/src/pro/paradex.js +1 -0
- package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
- package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +1 -1
- package/package.json +1 -1
package/js/src/bitget.js
CHANGED
|
@@ -1318,6 +1318,8 @@ export default class bitget extends Exchange {
|
|
|
1318
1318
|
'TONCOIN': 'TON',
|
|
1319
1319
|
},
|
|
1320
1320
|
'options': {
|
|
1321
|
+
'timeDifference': 0,
|
|
1322
|
+
'adjustForTimeDifference': false,
|
|
1321
1323
|
'timeframes': {
|
|
1322
1324
|
'spot': {
|
|
1323
1325
|
'1m': '1min',
|
|
@@ -1536,18 +1538,23 @@ export default class bitget extends Exchange {
|
|
|
1536
1538
|
* @description retrieves data on all markets for bitget
|
|
1537
1539
|
* @see https://www.bitget.com/api-doc/spot/market/Get-Symbols
|
|
1538
1540
|
* @see https://www.bitget.com/api-doc/contract/market/Get-All-Symbols-Contracts
|
|
1541
|
+
* @see https://www.bitget.com/api-doc/margin/common/support-currencies
|
|
1539
1542
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1540
1543
|
* @returns {object[]} an array of objects representing market data
|
|
1541
1544
|
*/
|
|
1545
|
+
if (this.options['adjustForTimeDifference']) {
|
|
1546
|
+
await this.loadTimeDifference();
|
|
1547
|
+
}
|
|
1542
1548
|
const sandboxMode = this.safeBool(this.options, 'sandboxMode', false);
|
|
1543
1549
|
let types = this.safeValue(this.options, 'fetchMarkets', ['spot', 'swap']);
|
|
1544
1550
|
if (sandboxMode) {
|
|
1545
1551
|
types = ['swap'];
|
|
1546
1552
|
}
|
|
1547
|
-
|
|
1553
|
+
const promises = [];
|
|
1554
|
+
let fetchMargins = false;
|
|
1548
1555
|
for (let i = 0; i < types.length; i++) {
|
|
1549
1556
|
const type = types[i];
|
|
1550
|
-
if (type === 'swap') {
|
|
1557
|
+
if ((type === 'swap') || (type === 'future')) {
|
|
1551
1558
|
let subTypes = undefined;
|
|
1552
1559
|
if (sandboxMode) {
|
|
1553
1560
|
// the following are simulated trading markets [ 'SUSDT-FUTURES', 'SCOIN-FUTURES', 'SUSDC-FUTURES' ];
|
|
@@ -1557,19 +1564,41 @@ export default class bitget extends Exchange {
|
|
|
1557
1564
|
subTypes = ['USDT-FUTURES', 'COIN-FUTURES', 'USDC-FUTURES'];
|
|
1558
1565
|
}
|
|
1559
1566
|
for (let j = 0; j < subTypes.length; j++) {
|
|
1560
|
-
promises.push(this.
|
|
1567
|
+
promises.push(this.publicMixGetV2MixMarketContracts(this.extend(params, {
|
|
1561
1568
|
'productType': subTypes[j],
|
|
1562
1569
|
})));
|
|
1563
1570
|
}
|
|
1564
1571
|
}
|
|
1572
|
+
else if (type === 'spot') {
|
|
1573
|
+
promises.push(this.publicSpotGetV2SpotPublicSymbols(params));
|
|
1574
|
+
fetchMargins = true;
|
|
1575
|
+
promises.push(this.publicMarginGetV2MarginCurrencies(params));
|
|
1576
|
+
}
|
|
1565
1577
|
else {
|
|
1566
|
-
|
|
1578
|
+
throw new NotSupported(this.id + ' does not support ' + type + ' market');
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
const results = await Promise.all(promises);
|
|
1582
|
+
let markets = [];
|
|
1583
|
+
this.options['crossMarginPairsData'] = [];
|
|
1584
|
+
this.options['isolatedMarginPairsData'] = [];
|
|
1585
|
+
for (let i = 0; i < results.length; i++) {
|
|
1586
|
+
const res = this.safeDict(results, i);
|
|
1587
|
+
const data = this.safeList(res, 'data', []);
|
|
1588
|
+
const firstData = this.safeDict(data, 0, {});
|
|
1589
|
+
const isBorrowable = this.safeString(firstData, 'isBorrowable');
|
|
1590
|
+
if (fetchMargins && isBorrowable !== undefined) {
|
|
1591
|
+
const keysList = Object.keys(this.indexBy(data, 'symbol'));
|
|
1592
|
+
this.options['crossMarginPairsData'] = keysList;
|
|
1593
|
+
this.options['isolatedMarginPairsData'] = keysList;
|
|
1594
|
+
}
|
|
1595
|
+
else {
|
|
1596
|
+
markets = this.arrayConcat(markets, data);
|
|
1567
1597
|
}
|
|
1568
1598
|
}
|
|
1569
|
-
|
|
1570
|
-
let
|
|
1571
|
-
|
|
1572
|
-
result = this.arrayConcat(result, promises[i]);
|
|
1599
|
+
const result = [];
|
|
1600
|
+
for (let i = 0; i < markets.length; i++) {
|
|
1601
|
+
result.push(this.parseMarket(markets[i]));
|
|
1573
1602
|
}
|
|
1574
1603
|
return result;
|
|
1575
1604
|
}
|
|
@@ -1661,11 +1690,20 @@ export default class bitget extends Exchange {
|
|
|
1661
1690
|
let expiry = undefined;
|
|
1662
1691
|
let expiryDatetime = undefined;
|
|
1663
1692
|
const symbolType = this.safeString(market, 'symbolType');
|
|
1693
|
+
let marginModes = undefined;
|
|
1694
|
+
let isMarginTradingAllowed = false;
|
|
1664
1695
|
if (symbolType === undefined) {
|
|
1665
1696
|
type = 'spot';
|
|
1666
1697
|
spot = true;
|
|
1667
1698
|
pricePrecision = this.parseNumber(this.parsePrecision(this.safeString(market, 'pricePrecision')));
|
|
1668
1699
|
amountPrecision = this.parseNumber(this.parsePrecision(this.safeString(market, 'quantityPrecision')));
|
|
1700
|
+
const hasCrossMargin = this.inArray(marketId, this.options['crossMarginPairsData']);
|
|
1701
|
+
const hasIsolatedMargin = this.inArray(marketId, this.options['isolatedMarginPairsData']);
|
|
1702
|
+
marginModes = {
|
|
1703
|
+
'cross': hasCrossMargin,
|
|
1704
|
+
'isolated': hasIsolatedMargin,
|
|
1705
|
+
};
|
|
1706
|
+
isMarginTradingAllowed = hasCrossMargin || hasCrossMargin;
|
|
1669
1707
|
}
|
|
1670
1708
|
else {
|
|
1671
1709
|
if (symbolType === 'perpetual') {
|
|
@@ -1704,6 +1742,10 @@ export default class bitget extends Exchange {
|
|
|
1704
1742
|
preciseAmount.reduce();
|
|
1705
1743
|
const amountString = preciseAmount.toString();
|
|
1706
1744
|
amountPrecision = this.parseNumber(amountString);
|
|
1745
|
+
marginModes = {
|
|
1746
|
+
'cross': true,
|
|
1747
|
+
'isolated': true,
|
|
1748
|
+
};
|
|
1707
1749
|
}
|
|
1708
1750
|
const status = this.safeString2(market, 'status', 'symbolStatus');
|
|
1709
1751
|
let active = undefined;
|
|
@@ -1726,7 +1768,8 @@ export default class bitget extends Exchange {
|
|
|
1726
1768
|
'settleId': settleId,
|
|
1727
1769
|
'type': type,
|
|
1728
1770
|
'spot': spot,
|
|
1729
|
-
'margin':
|
|
1771
|
+
'margin': spot && isMarginTradingAllowed,
|
|
1772
|
+
'marginModes': marginModes,
|
|
1730
1773
|
'swap': swap,
|
|
1731
1774
|
'future': future,
|
|
1732
1775
|
'option': false,
|
|
@@ -1767,91 +1810,6 @@ export default class bitget extends Exchange {
|
|
|
1767
1810
|
'info': market,
|
|
1768
1811
|
};
|
|
1769
1812
|
}
|
|
1770
|
-
async fetchMarketsByType(type, params = {}) {
|
|
1771
|
-
let response = undefined;
|
|
1772
|
-
if (type === 'spot') {
|
|
1773
|
-
response = await this.publicSpotGetV2SpotPublicSymbols(params);
|
|
1774
|
-
}
|
|
1775
|
-
else if ((type === 'swap') || (type === 'future')) {
|
|
1776
|
-
response = await this.publicMixGetV2MixMarketContracts(params);
|
|
1777
|
-
}
|
|
1778
|
-
else {
|
|
1779
|
-
throw new NotSupported(this.id + ' does not support ' + type + ' market');
|
|
1780
|
-
}
|
|
1781
|
-
//
|
|
1782
|
-
// spot
|
|
1783
|
-
//
|
|
1784
|
-
// {
|
|
1785
|
-
// "code": "00000",
|
|
1786
|
-
// "msg": "success",
|
|
1787
|
-
// "requestTime": 1700102364653,
|
|
1788
|
-
// "data": [
|
|
1789
|
-
// {
|
|
1790
|
-
// "symbol": "TRXUSDT",
|
|
1791
|
-
// "baseCoin": "TRX",
|
|
1792
|
-
// "quoteCoin": "USDT",
|
|
1793
|
-
// "minTradeAmount": "0",
|
|
1794
|
-
// "maxTradeAmount": "10000000000",
|
|
1795
|
-
// "takerFeeRate": "0.002",
|
|
1796
|
-
// "makerFeeRate": "0.002",
|
|
1797
|
-
// "pricePrecision": "6",
|
|
1798
|
-
// "quantityPrecision": "4",
|
|
1799
|
-
// "quotePrecision": "6",
|
|
1800
|
-
// "status": "online",
|
|
1801
|
-
// "minTradeUSDT": "5",
|
|
1802
|
-
// "buyLimitPriceRatio": "0.05",
|
|
1803
|
-
// "sellLimitPriceRatio": "0.05"
|
|
1804
|
-
// },
|
|
1805
|
-
// ]
|
|
1806
|
-
// }
|
|
1807
|
-
//
|
|
1808
|
-
// swap and future
|
|
1809
|
-
//
|
|
1810
|
-
// {
|
|
1811
|
-
// "code": "00000",
|
|
1812
|
-
// "msg": "success",
|
|
1813
|
-
// "requestTime": 1700102364709,
|
|
1814
|
-
// "data": [
|
|
1815
|
-
// {
|
|
1816
|
-
// "symbol": "BTCUSDT",
|
|
1817
|
-
// "baseCoin": "BTC",
|
|
1818
|
-
// "quoteCoin": "USDT",
|
|
1819
|
-
// "buyLimitPriceRatio": "0.01",
|
|
1820
|
-
// "sellLimitPriceRatio": "0.01",
|
|
1821
|
-
// "feeRateUpRatio": "0.005",
|
|
1822
|
-
// "makerFeeRate": "0.0002",
|
|
1823
|
-
// "takerFeeRate": "0.0006",
|
|
1824
|
-
// "openCostUpRatio": "0.01",
|
|
1825
|
-
// "supportMarginCoins": ["USDT"],
|
|
1826
|
-
// "minTradeNum": "0.001",
|
|
1827
|
-
// "priceEndStep": "1",
|
|
1828
|
-
// "volumePlace": "3",
|
|
1829
|
-
// "pricePlace": "1",
|
|
1830
|
-
// "sizeMultiplier": "0.001",
|
|
1831
|
-
// "symbolType": "perpetual",
|
|
1832
|
-
// "minTradeUSDT": "5",
|
|
1833
|
-
// "maxSymbolOrderNum": "200",
|
|
1834
|
-
// "maxProductOrderNum": "400",
|
|
1835
|
-
// "maxPositionNum": "150",
|
|
1836
|
-
// "symbolStatus": "normal",
|
|
1837
|
-
// "offTime": "-1",
|
|
1838
|
-
// "limitOpenTime": "-1",
|
|
1839
|
-
// "deliveryTime": "",
|
|
1840
|
-
// "deliveryStartTime": "",
|
|
1841
|
-
// "deliveryPeriod": "",
|
|
1842
|
-
// "launchTime": "",
|
|
1843
|
-
// "fundInterval": "8",
|
|
1844
|
-
// "minLever": "1",
|
|
1845
|
-
// "maxLever": "125",
|
|
1846
|
-
// "posLimit": "0.05",
|
|
1847
|
-
// "maintainTime": ""
|
|
1848
|
-
// },
|
|
1849
|
-
// ]
|
|
1850
|
-
// }
|
|
1851
|
-
//
|
|
1852
|
-
const data = this.safeValue(response, 'data', []);
|
|
1853
|
-
return this.parseMarkets(data);
|
|
1854
|
-
}
|
|
1855
1813
|
async fetchCurrencies(params = {}) {
|
|
1856
1814
|
/**
|
|
1857
1815
|
* @method
|
|
@@ -8872,6 +8830,9 @@ export default class bitget extends Exchange {
|
|
|
8872
8830
|
}
|
|
8873
8831
|
return undefined;
|
|
8874
8832
|
}
|
|
8833
|
+
nonce() {
|
|
8834
|
+
return this.milliseconds() - this.options['timeDifference'];
|
|
8835
|
+
}
|
|
8875
8836
|
sign(path, api = [], method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
8876
8837
|
const signed = api[0] === 'private';
|
|
8877
8838
|
const endpoint = api[1];
|
|
@@ -8889,7 +8850,7 @@ export default class bitget extends Exchange {
|
|
|
8889
8850
|
}
|
|
8890
8851
|
if (signed) {
|
|
8891
8852
|
this.checkRequiredCredentials();
|
|
8892
|
-
const timestamp = this.
|
|
8853
|
+
const timestamp = this.nonce().toString();
|
|
8893
8854
|
let auth = timestamp + method + payload;
|
|
8894
8855
|
if (method === 'POST') {
|
|
8895
8856
|
body = this.json(params);
|