ccxt 4.4.77 → 4.4.80
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 +8 -10
- package/dist/ccxt.browser.min.js +7 -7
- package/dist/cjs/ccxt.js +8 -4
- package/dist/cjs/src/abstract/ace.js +1 -1
- package/dist/cjs/src/abstract/apex.js +9 -0
- package/dist/cjs/src/ace.js +1 -1
- package/dist/cjs/src/apex.js +1949 -0
- package/dist/cjs/src/ascendex.js +25 -4
- package/dist/cjs/src/base/Exchange.js +42 -2
- package/dist/cjs/src/binance.js +9 -1
- package/dist/cjs/src/bingx.js +3 -3
- package/dist/cjs/src/bitfinex.js +64 -36
- package/dist/cjs/src/bitget.js +191 -138
- package/dist/cjs/src/bitmart.js +7 -2
- package/dist/cjs/src/bitmex.js +16 -8
- package/dist/cjs/src/bitopro.js +5 -1
- package/dist/cjs/src/bitrue.js +2 -1
- package/dist/cjs/src/bitso.js +1 -1
- package/dist/cjs/src/bitteam.js +2 -0
- package/dist/cjs/src/bitvavo.js +28 -10
- package/dist/cjs/src/btcalpha.js +1 -1
- package/dist/cjs/src/btcmarkets.js +1 -1
- package/dist/cjs/src/btcturk.js +1 -1
- package/dist/cjs/src/bybit.js +32 -16
- package/dist/cjs/src/cex.js +1 -1
- package/dist/cjs/src/coinbase.js +18 -2
- package/dist/cjs/src/coincatch.js +68 -0
- package/dist/cjs/src/coinex.js +1 -0
- package/dist/cjs/src/coinlist.js +1 -0
- package/dist/cjs/src/coinone.js +1 -0
- package/dist/cjs/src/delta.js +4 -0
- package/dist/cjs/src/deribit.js +1 -0
- package/dist/cjs/src/hitbtc.js +3 -0
- package/dist/cjs/src/hollaex.js +1 -0
- package/dist/cjs/src/htx.js +7 -3
- package/dist/cjs/src/huobijp.js +1 -0
- package/dist/cjs/src/hyperliquid.js +14 -4
- package/dist/cjs/src/kraken.js +2 -0
- package/dist/cjs/src/mexc.js +50 -57
- package/dist/cjs/src/okx.js +1 -1
- package/dist/cjs/src/phemex.js +2 -1
- package/dist/cjs/src/poloniex.js +2 -1
- package/dist/cjs/src/pro/apex.js +1043 -0
- package/dist/cjs/src/pro/binance.js +3 -3
- package/dist/cjs/src/pro/coinbase.js +45 -68
- package/dist/cjs/src/pro/gate.js +27 -2
- package/dist/cjs/src/pro/hollaex.js +2 -2
- package/dist/cjs/src/pro/p2b.js +2 -2
- package/dist/cjs/src/pro/tradeogre.js +283 -0
- package/dist/cjs/src/pro/upbit.js +43 -0
- package/dist/cjs/src/probit.js +1 -0
- package/dist/cjs/src/static_dependencies/zklink/zklink-sdk-web.js +2639 -0
- package/dist/cjs/src/timex.js +2 -2
- package/dist/cjs/src/tradeogre.js +2 -1
- package/dist/cjs/src/upbit.js +277 -67
- package/dist/cjs/src/whitebit.js +66 -12
- package/dist/cjs/src/woo.js +3 -1
- package/dist/cjs/src/xt.js +9 -0
- package/js/ccxt.d.ts +11 -5
- package/js/ccxt.js +8 -4
- package/js/src/abstract/apex.d.ts +34 -0
- package/js/src/abstract/bitmart.d.ts +1 -0
- package/js/src/apex.d.ts +333 -0
- package/js/src/apex.js +1945 -0
- package/js/src/ascendex.d.ts +3 -3
- package/js/src/ascendex.js +25 -4
- package/js/src/base/Exchange.d.ts +2 -0
- package/js/src/base/Exchange.js +42 -1
- package/js/src/binance.d.ts +7 -7
- package/js/src/binance.js +9 -1
- package/js/src/bingx.js +3 -3
- package/js/src/bitfinex.d.ts +3 -3
- package/js/src/bitfinex.js +64 -36
- package/js/src/bitflyer.d.ts +2 -2
- package/js/src/bitget.d.ts +2 -0
- package/js/src/bitget.js +191 -138
- package/js/src/bitmart.d.ts +5 -4
- package/js/src/bitmart.js +7 -2
- package/js/src/bitmex.d.ts +3 -3
- package/js/src/bitmex.js +16 -8
- package/js/src/bitopro.js +5 -1
- package/js/src/bitrue.js +2 -1
- package/js/src/bitso.js +1 -1
- package/js/src/bitteam.js +2 -0
- package/js/src/bitvavo.js +28 -10
- package/js/src/btcalpha.js +1 -1
- package/js/src/btcmarkets.js +1 -1
- package/js/src/btcturk.js +1 -1
- package/js/src/bybit.js +32 -16
- package/js/src/cex.js +1 -1
- package/js/src/coinbase.d.ts +4 -4
- package/js/src/coinbase.js +18 -2
- package/js/src/coinbaseexchange.d.ts +1 -1
- package/js/src/coincatch.d.ts +11 -0
- package/js/src/coincatch.js +68 -0
- package/js/src/coinex.js +1 -0
- package/js/src/coinlist.js +1 -0
- package/js/src/coinone.js +1 -0
- package/js/src/cryptocom.d.ts +4 -4
- package/js/src/delta.js +4 -0
- package/js/src/deribit.d.ts +4 -4
- package/js/src/deribit.js +1 -0
- package/js/src/derive.d.ts +3 -3
- package/js/src/digifinex.d.ts +4 -4
- package/js/src/hitbtc.js +3 -0
- package/js/src/hollaex.js +1 -0
- package/js/src/htx.d.ts +4 -4
- package/js/src/htx.js +7 -3
- package/js/src/huobijp.js +1 -0
- package/js/src/hyperliquid.d.ts +1 -0
- package/js/src/hyperliquid.js +14 -4
- package/js/src/kraken.d.ts +3 -3
- package/js/src/kraken.js +2 -0
- package/js/src/krakenfutures.d.ts +2 -2
- package/js/src/kucoinfutures.d.ts +5 -5
- package/js/src/mexc.d.ts +1 -0
- package/js/src/mexc.js +50 -57
- package/js/src/okx.js +1 -1
- package/js/src/oxfun.d.ts +3 -3
- package/js/src/phemex.d.ts +3 -3
- package/js/src/phemex.js +2 -1
- package/js/src/poloniex.d.ts +3 -3
- package/js/src/poloniex.js +2 -1
- package/js/src/pro/apex.d.ts +160 -0
- package/js/src/pro/apex.js +1038 -0
- package/js/src/pro/binance.js +3 -3
- package/js/src/pro/coinbase.d.ts +4 -3
- package/js/src/pro/coinbase.js +45 -66
- package/js/src/pro/gate.js +27 -2
- package/js/src/pro/hollaex.js +2 -2
- package/js/src/pro/p2b.js +2 -2
- package/js/src/pro/tradeogre.d.ts +49 -0
- package/js/src/pro/tradeogre.js +278 -0
- package/js/src/pro/upbit.d.ts +16 -1
- package/js/src/pro/upbit.js +43 -0
- package/js/src/probit.js +1 -0
- package/js/src/static_dependencies/zklink/zklink-sdk-web.d.ts +1279 -0
- package/js/src/static_dependencies/zklink/zklink-sdk-web.js +4276 -0
- package/js/src/timex.js +2 -2
- package/js/src/tradeogre.js +2 -1
- package/js/src/upbit.d.ts +75 -23
- package/js/src/upbit.js +277 -67
- package/js/src/vertex.d.ts +3 -3
- package/js/src/whitebit.js +66 -12
- package/js/src/woo.d.ts +4 -4
- package/js/src/woo.js +3 -1
- package/js/src/woofipro.d.ts +4 -4
- package/js/src/xt.d.ts +4 -4
- package/js/src/xt.js +9 -0
- package/package.json +2 -2
- package/js/src/abstract/ace.d.ts +0 -18
- package/js/src/ace.d.ts +0 -158
- package/js/src/ace.js +0 -1175
- /package/js/src/abstract/{ace.js → apex.js} +0 -0
package/dist/cjs/src/bitget.js
CHANGED
|
@@ -1371,28 +1371,44 @@ class bitget extends bitget$1 {
|
|
|
1371
1371
|
'fillResponseFromRequest': true,
|
|
1372
1372
|
},
|
|
1373
1373
|
'fetchOHLCV': {
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
'
|
|
1378
|
-
'method': 'publicMixGetV2MixMarketCandles', // publicMixGetV2MixMarketCandles or publicMixGetV2MixMarketHistoryCandles or publicMixGetV2MixMarketHistoryIndexCandles or publicMixGetV2MixMarketHistoryMarkCandles
|
|
1379
|
-
},
|
|
1380
|
-
'maxDaysPerTimeframe': {
|
|
1374
|
+
// ### Timeframe settings ###
|
|
1375
|
+
// after testing, the below values are real ones, because the values provided by API DOCS are wrong
|
|
1376
|
+
// so, start timestamp should be within these thresholds to be able to call "recent" candles endpoint
|
|
1377
|
+
'maxRecentDaysPerTimeframe': {
|
|
1381
1378
|
'1m': 30,
|
|
1382
1379
|
'3m': 30,
|
|
1383
1380
|
'5m': 30,
|
|
1384
|
-
'
|
|
1385
|
-
'
|
|
1386
|
-
'
|
|
1387
|
-
'1h': 83,
|
|
1388
|
-
'2h': 120,
|
|
1381
|
+
'15m': 30,
|
|
1382
|
+
'30m': 30,
|
|
1383
|
+
'1h': 60,
|
|
1389
1384
|
'4h': 240,
|
|
1390
1385
|
'6h': 360,
|
|
1391
|
-
'12h':
|
|
1392
|
-
'1d':
|
|
1393
|
-
'3d':
|
|
1394
|
-
'1w':
|
|
1395
|
-
'1M':
|
|
1386
|
+
'12h': 720,
|
|
1387
|
+
'1d': 1440,
|
|
1388
|
+
'3d': 1440 * 3,
|
|
1389
|
+
'1w': 1440 * 7,
|
|
1390
|
+
'1M': 1440 * 30,
|
|
1391
|
+
},
|
|
1392
|
+
'spot': {
|
|
1393
|
+
'maxLimitPerTimeframe': {
|
|
1394
|
+
'1d': 300,
|
|
1395
|
+
'3d': 100,
|
|
1396
|
+
'1w': 100,
|
|
1397
|
+
'1M': 100,
|
|
1398
|
+
},
|
|
1399
|
+
'method': 'publicSpotGetV2SpotMarketCandles', // publicSpotGetV2SpotMarketCandles or publicSpotGetV2SpotMarketHistoryCandles
|
|
1400
|
+
},
|
|
1401
|
+
'swap': {
|
|
1402
|
+
'maxLimitPerTimeframe': {
|
|
1403
|
+
'4h': 540,
|
|
1404
|
+
'6h': 360,
|
|
1405
|
+
'12h': 180,
|
|
1406
|
+
'1d': 90,
|
|
1407
|
+
'3d': 30,
|
|
1408
|
+
'1w': 13,
|
|
1409
|
+
'1M': 4,
|
|
1410
|
+
},
|
|
1411
|
+
'method': 'publicMixGetV2MixMarketCandles', // publicMixGetV2MixMarketCandles or publicMixGetV2MixMarketHistoryCandles or publicMixGetV2MixMarketHistoryIndexCandles or publicMixGetV2MixMarketHistoryMarkCandles
|
|
1396
1412
|
},
|
|
1397
1413
|
},
|
|
1398
1414
|
'fetchTrades': {
|
|
@@ -1403,6 +1419,9 @@ class bitget extends bitget$1 {
|
|
|
1403
1419
|
'method': 'publicMixGetV2MixMarketFillsHistory', // or publicMixGetV2MixMarketFills
|
|
1404
1420
|
},
|
|
1405
1421
|
},
|
|
1422
|
+
'fetchFundingRate': {
|
|
1423
|
+
'method': 'publicMixGetV2MixMarketCurrentFundRate', // or publicMixGetV2MixMarketFundingTime
|
|
1424
|
+
},
|
|
1406
1425
|
'accountsByType': {
|
|
1407
1426
|
'spot': 'spot',
|
|
1408
1427
|
'cross': 'crossed_margin',
|
|
@@ -1524,7 +1543,9 @@ class bitget extends bitget$1 {
|
|
|
1524
1543
|
'fetchPositions': {
|
|
1525
1544
|
'method': 'privateMixGetV2MixPositionAllPosition', // or privateMixGetV2MixPositionHistoryPosition
|
|
1526
1545
|
},
|
|
1527
|
-
'defaultTimeInForce': 'GTC',
|
|
1546
|
+
'defaultTimeInForce': 'GTC',
|
|
1547
|
+
// fiat currencies on deposit page
|
|
1548
|
+
'fiatCurrencies': ['EUR', 'VND', 'PLN', 'CZK', 'HUF', 'DKK', 'AUD', 'CAD', 'NOK', 'SEK', 'CHF', 'MXN', 'COP', 'ARS', 'GBP', 'BRL', 'UAH', 'ZAR'],
|
|
1528
1549
|
},
|
|
1529
1550
|
'features': {
|
|
1530
1551
|
'spot': {
|
|
@@ -1599,7 +1620,7 @@ class bitget extends bitget$1 {
|
|
|
1599
1620
|
'symbolRequired': false,
|
|
1600
1621
|
},
|
|
1601
1622
|
'fetchOHLCV': {
|
|
1602
|
-
'limit':
|
|
1623
|
+
'limit': 200, // variable timespans for recent endpoint, 200 for historical
|
|
1603
1624
|
},
|
|
1604
1625
|
},
|
|
1605
1626
|
'forPerps': {
|
|
@@ -1674,13 +1695,12 @@ class bitget extends bitget$1 {
|
|
|
1674
1695
|
let defaultProductType = undefined;
|
|
1675
1696
|
if ((subType !== undefined) && (market === undefined)) {
|
|
1676
1697
|
// set default only if subType is defined and market is not defined, since there is also USDC productTypes which are also linear
|
|
1677
|
-
const sandboxMode = this.safeBool(this.options, 'sandboxMode', false);
|
|
1678
|
-
if (sandboxMode) {
|
|
1679
|
-
|
|
1680
|
-
}
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
}
|
|
1698
|
+
// const sandboxMode = this.safeBool (this.options, 'sandboxMode', false);
|
|
1699
|
+
// if (sandboxMode) {
|
|
1700
|
+
// defaultProductType = (subType === 'linear') ? 'SUSDT-FUTURES' : 'SCOIN-FUTURES';
|
|
1701
|
+
// } else {
|
|
1702
|
+
defaultProductType = (subType === 'linear') ? 'USDT-FUTURES' : 'COIN-FUTURES';
|
|
1703
|
+
// }
|
|
1684
1704
|
}
|
|
1685
1705
|
let productType = this.safeString(params, 'productType', defaultProductType);
|
|
1686
1706
|
if ((productType === undefined) && (market !== undefined)) {
|
|
@@ -2012,47 +2032,47 @@ class bitget extends bitget$1 {
|
|
|
2012
2032
|
async fetchCurrencies(params = {}) {
|
|
2013
2033
|
const response = await this.publicSpotGetV2SpotPublicCoins(params);
|
|
2014
2034
|
//
|
|
2015
|
-
//
|
|
2016
|
-
//
|
|
2017
|
-
//
|
|
2018
|
-
//
|
|
2019
|
-
//
|
|
2020
|
-
//
|
|
2021
|
-
//
|
|
2022
|
-
//
|
|
2023
|
-
//
|
|
2024
|
-
//
|
|
2025
|
-
//
|
|
2026
|
-
//
|
|
2027
|
-
//
|
|
2028
|
-
//
|
|
2029
|
-
//
|
|
2030
|
-
//
|
|
2031
|
-
//
|
|
2032
|
-
//
|
|
2033
|
-
//
|
|
2034
|
-
//
|
|
2035
|
-
//
|
|
2036
|
-
//
|
|
2037
|
-
//
|
|
2038
|
-
//
|
|
2039
|
-
//
|
|
2040
|
-
//
|
|
2041
|
-
//
|
|
2035
|
+
// {
|
|
2036
|
+
// "code": "00000",
|
|
2037
|
+
// "msg": "success",
|
|
2038
|
+
// "requestTime": "1746195617812",
|
|
2039
|
+
// "data": [
|
|
2040
|
+
// {
|
|
2041
|
+
// "coinId": "1456",
|
|
2042
|
+
// "coin": "NEIROETH",
|
|
2043
|
+
// "transfer": "false",
|
|
2044
|
+
// "chains": [
|
|
2045
|
+
// {
|
|
2046
|
+
// "chain": "ERC20",
|
|
2047
|
+
// "needTag": "false",
|
|
2048
|
+
// "withdrawable": "true",
|
|
2049
|
+
// "rechargeable": "true",
|
|
2050
|
+
// "withdrawFee": "44.91017965",
|
|
2051
|
+
// "extraWithdrawFee": "0",
|
|
2052
|
+
// "depositConfirm": "12",
|
|
2053
|
+
// "withdrawConfirm": "64",
|
|
2054
|
+
// "minDepositAmount": "0.06",
|
|
2055
|
+
// "minWithdrawAmount": "60",
|
|
2056
|
+
// "browserUrl": "https://etherscan.io/tx/",
|
|
2057
|
+
// "contractAddress": "0xee2a03aa6dacf51c18679c516ad5283d8e7c2637",
|
|
2058
|
+
// "withdrawStep": "0",
|
|
2059
|
+
// "withdrawMinScale": "8",
|
|
2060
|
+
// "congestion": "normal"
|
|
2061
|
+
// }
|
|
2062
|
+
// ],
|
|
2063
|
+
// "areaCoin": "no"
|
|
2064
|
+
// },
|
|
2065
|
+
// ...
|
|
2042
2066
|
//
|
|
2043
2067
|
const result = {};
|
|
2044
2068
|
const data = this.safeValue(response, 'data', []);
|
|
2069
|
+
const fiatCurrencies = this.safeList(this.options, 'fiatCurrencies', []);
|
|
2045
2070
|
for (let i = 0; i < data.length; i++) {
|
|
2046
2071
|
const entry = data[i];
|
|
2047
2072
|
const id = this.safeString(entry, 'coin'); // we don't use 'coinId' as it has no use. it is 'coin' field that needs to be used in currency related endpoints (deposit, withdraw, etc..)
|
|
2048
2073
|
const code = this.safeCurrencyCode(id);
|
|
2049
2074
|
const chains = this.safeValue(entry, 'chains', []);
|
|
2050
2075
|
const networks = {};
|
|
2051
|
-
let deposit = false;
|
|
2052
|
-
let withdraw = false;
|
|
2053
|
-
let minWithdrawString = undefined;
|
|
2054
|
-
let minDepositString = undefined;
|
|
2055
|
-
let minWithdrawFeeString = undefined;
|
|
2056
2076
|
for (let j = 0; j < chains.length; j++) {
|
|
2057
2077
|
const chain = chains[j];
|
|
2058
2078
|
const networkId = this.safeString(chain, 'chain');
|
|
@@ -2060,56 +2080,39 @@ class bitget extends bitget$1 {
|
|
|
2060
2080
|
if (network !== undefined) {
|
|
2061
2081
|
network = network.toUpperCase();
|
|
2062
2082
|
}
|
|
2063
|
-
const withdrawEnabled = this.safeString(chain, 'withdrawable');
|
|
2064
|
-
const canWithdraw = withdrawEnabled === 'true';
|
|
2065
|
-
withdraw = (canWithdraw) ? canWithdraw : withdraw;
|
|
2066
|
-
const depositEnabled = this.safeString(chain, 'rechargeable');
|
|
2067
|
-
const canDeposit = depositEnabled === 'true';
|
|
2068
|
-
deposit = (canDeposit) ? canDeposit : deposit;
|
|
2069
|
-
const networkWithdrawFeeString = this.safeString(chain, 'withdrawFee');
|
|
2070
|
-
if (networkWithdrawFeeString !== undefined) {
|
|
2071
|
-
minWithdrawFeeString = (minWithdrawFeeString === undefined) ? networkWithdrawFeeString : Precise["default"].stringMin(networkWithdrawFeeString, minWithdrawFeeString);
|
|
2072
|
-
}
|
|
2073
|
-
const networkMinWithdrawString = this.safeString(chain, 'minWithdrawAmount');
|
|
2074
|
-
if (networkMinWithdrawString !== undefined) {
|
|
2075
|
-
minWithdrawString = (minWithdrawString === undefined) ? networkMinWithdrawString : Precise["default"].stringMin(networkMinWithdrawString, minWithdrawString);
|
|
2076
|
-
}
|
|
2077
|
-
const networkMinDepositString = this.safeString(chain, 'minDepositAmount');
|
|
2078
|
-
if (networkMinDepositString !== undefined) {
|
|
2079
|
-
minDepositString = (minDepositString === undefined) ? networkMinDepositString : Precise["default"].stringMin(networkMinDepositString, minDepositString);
|
|
2080
|
-
}
|
|
2081
2083
|
networks[network] = {
|
|
2082
2084
|
'info': chain,
|
|
2083
2085
|
'id': networkId,
|
|
2084
2086
|
'network': network,
|
|
2085
2087
|
'limits': {
|
|
2086
2088
|
'withdraw': {
|
|
2087
|
-
'min': this.
|
|
2089
|
+
'min': this.safeNumber(chain, 'minWithdrawAmount'),
|
|
2088
2090
|
'max': undefined,
|
|
2089
2091
|
},
|
|
2090
2092
|
'deposit': {
|
|
2091
|
-
'min': this.
|
|
2093
|
+
'min': this.safeNumber(chain, 'minDepositAmount'),
|
|
2092
2094
|
'max': undefined,
|
|
2093
2095
|
},
|
|
2094
2096
|
},
|
|
2095
|
-
'active':
|
|
2096
|
-
'withdraw':
|
|
2097
|
-
'deposit':
|
|
2098
|
-
'fee': this.
|
|
2099
|
-
'precision':
|
|
2097
|
+
'active': undefined,
|
|
2098
|
+
'withdraw': this.safeString(chain, 'withdrawable') === 'true',
|
|
2099
|
+
'deposit': this.safeString(chain, 'rechargeable') === 'true',
|
|
2100
|
+
'fee': this.safeNumber(chain, 'withdrawFee'),
|
|
2101
|
+
'precision': this.parseNumber(this.parsePrecision(this.safeString(chain, 'withdrawMinScale'))),
|
|
2100
2102
|
};
|
|
2101
2103
|
}
|
|
2102
|
-
|
|
2104
|
+
const isFiat = this.inArray(code, fiatCurrencies);
|
|
2105
|
+
result[code] = this.safeCurrencyStructure({
|
|
2103
2106
|
'info': entry,
|
|
2104
2107
|
'id': id,
|
|
2105
2108
|
'code': code,
|
|
2106
2109
|
'networks': networks,
|
|
2107
|
-
'type':
|
|
2110
|
+
'type': isFiat ? 'fiat' : 'crypto',
|
|
2108
2111
|
'name': undefined,
|
|
2109
|
-
'active':
|
|
2110
|
-
'deposit':
|
|
2111
|
-
'withdraw':
|
|
2112
|
-
'fee':
|
|
2112
|
+
'active': undefined,
|
|
2113
|
+
'deposit': undefined,
|
|
2114
|
+
'withdraw': undefined,
|
|
2115
|
+
'fee': undefined,
|
|
2113
2116
|
'precision': undefined,
|
|
2114
2117
|
'limits': {
|
|
2115
2118
|
'amount': {
|
|
@@ -2117,16 +2120,16 @@ class bitget extends bitget$1 {
|
|
|
2117
2120
|
'max': undefined,
|
|
2118
2121
|
},
|
|
2119
2122
|
'withdraw': {
|
|
2120
|
-
'min':
|
|
2123
|
+
'min': undefined,
|
|
2121
2124
|
'max': undefined,
|
|
2122
2125
|
},
|
|
2123
2126
|
'deposit': {
|
|
2124
|
-
'min':
|
|
2127
|
+
'min': undefined,
|
|
2125
2128
|
'max': undefined,
|
|
2126
2129
|
},
|
|
2127
2130
|
},
|
|
2128
2131
|
'created': undefined,
|
|
2129
|
-
};
|
|
2132
|
+
});
|
|
2130
2133
|
}
|
|
2131
2134
|
return result;
|
|
2132
2135
|
}
|
|
@@ -2771,7 +2774,7 @@ class bitget extends bitget$1 {
|
|
|
2771
2774
|
const close = this.safeString(ticker, 'lastPr');
|
|
2772
2775
|
const timestamp = this.safeIntegerOmitZero(ticker, 'ts'); // exchange bitget provided 0
|
|
2773
2776
|
const change = this.safeString(ticker, 'change24h');
|
|
2774
|
-
const open24 = this.
|
|
2777
|
+
const open24 = this.safeString2(ticker, 'open24', 'open24h');
|
|
2775
2778
|
const open = this.safeString(ticker, 'open');
|
|
2776
2779
|
let symbol;
|
|
2777
2780
|
let openValue;
|
|
@@ -3489,34 +3492,36 @@ class bitget extends bitget$1 {
|
|
|
3489
3492
|
const market = this.market(symbol);
|
|
3490
3493
|
const marketType = market['spot'] ? 'spot' : 'swap';
|
|
3491
3494
|
const timeframes = this.options['timeframes'][marketType];
|
|
3492
|
-
const msInDay = 86400000;
|
|
3493
|
-
const duration = this.parseTimeframe(timeframe) * 1000;
|
|
3494
3495
|
const request = {
|
|
3495
3496
|
'symbol': market['id'],
|
|
3496
3497
|
'granularity': this.safeString(timeframes, timeframe, timeframe),
|
|
3497
3498
|
};
|
|
3499
|
+
const msInDay = 86400000;
|
|
3500
|
+
const now = this.milliseconds();
|
|
3501
|
+
const duration = this.parseTimeframe(timeframe) * 1000;
|
|
3498
3502
|
const until = this.safeInteger(params, 'until');
|
|
3499
3503
|
const limitDefined = limit !== undefined;
|
|
3500
3504
|
const sinceDefined = since !== undefined;
|
|
3501
3505
|
const untilDefined = until !== undefined;
|
|
3502
3506
|
params = this.omit(params, ['until']);
|
|
3503
|
-
let response = undefined;
|
|
3504
|
-
const now = this.milliseconds();
|
|
3505
3507
|
// retrievable periods listed here:
|
|
3506
3508
|
// - https://www.bitget.com/api-doc/spot/market/Get-Candle-Data#request-parameters
|
|
3507
3509
|
// - https://www.bitget.com/api-doc/contract/market/Get-Candle-Data#description
|
|
3508
|
-
const
|
|
3509
|
-
const
|
|
3510
|
-
const
|
|
3511
|
-
const
|
|
3510
|
+
const key = market['spot'] ? 'spot' : 'swap';
|
|
3511
|
+
const ohlcOptions = this.safeDict(this.options['fetchOHLCV'], key, {});
|
|
3512
|
+
const maxLimitPerTimeframe = this.safeDict(ohlcOptions, 'maxLimitPerTimeframe', {});
|
|
3513
|
+
const maxLimitForThisTimeframe = this.safeInteger(maxLimitPerTimeframe, timeframe, limit);
|
|
3514
|
+
const recentEndpointDaysMap = this.safeDict(this.options['fetchOHLCV'], 'maxRecentDaysPerTimeframe', {});
|
|
3515
|
+
const recentEndpointAvailableDays = this.safeInteger(recentEndpointDaysMap, timeframe);
|
|
3516
|
+
const recentEndpointBoundaryTs = now - (recentEndpointAvailableDays - 1) * msInDay;
|
|
3512
3517
|
if (limitDefined) {
|
|
3513
3518
|
limit = Math.min(limit, maxLimitForRecentEndpoint);
|
|
3514
|
-
|
|
3519
|
+
limit = Math.min(limit, maxLimitForThisTimeframe);
|
|
3515
3520
|
}
|
|
3516
3521
|
else {
|
|
3517
3522
|
limit = defaultLimit;
|
|
3518
3523
|
}
|
|
3519
|
-
|
|
3524
|
+
let limitMultipliedDuration = limit * duration;
|
|
3520
3525
|
// exchange aligns from endTime, so it's important, not startTime
|
|
3521
3526
|
// startTime is supported only on "recent" endpoint, not on "historical" endpoint
|
|
3522
3527
|
let calculatedStartTime = undefined;
|
|
@@ -3537,17 +3542,32 @@ class bitget extends bitget$1 {
|
|
|
3537
3542
|
// we do not need to set "startTime" here
|
|
3538
3543
|
}
|
|
3539
3544
|
}
|
|
3540
|
-
|
|
3541
|
-
|
|
3545
|
+
// if historical endpoint is needed, we should re-set the variables
|
|
3546
|
+
let historicalEndpointNeeded = false;
|
|
3547
|
+
if ((calculatedStartTime !== undefined && calculatedStartTime <= recentEndpointBoundaryTs) || useHistoryEndpoint) {
|
|
3548
|
+
historicalEndpointNeeded = true;
|
|
3542
3549
|
// only for "historical-candles" - ensure we use correct max limit
|
|
3543
|
-
|
|
3544
|
-
|
|
3550
|
+
limit = Math.min(limit, maxLimitForHistoryEndpoint);
|
|
3551
|
+
limitMultipliedDuration = limit * duration;
|
|
3552
|
+
calculatedStartTime = calculatedEndTime - limitMultipliedDuration;
|
|
3553
|
+
request['startTime'] = calculatedStartTime;
|
|
3554
|
+
// for contract, maximum 90 days allowed between start-end times
|
|
3555
|
+
if (!market['spot']) {
|
|
3556
|
+
const maxDistanceDaysForContracts = 90;
|
|
3557
|
+
// only correct if request is larger
|
|
3558
|
+
if (calculatedEndTime - calculatedStartTime > maxDistanceDaysForContracts * msInDay) {
|
|
3559
|
+
calculatedEndTime = this.sum(calculatedStartTime, maxDistanceDaysForContracts * msInDay);
|
|
3560
|
+
request['endTime'] = calculatedEndTime;
|
|
3561
|
+
}
|
|
3545
3562
|
}
|
|
3546
3563
|
}
|
|
3564
|
+
// we need to set limit to safely cover the period
|
|
3565
|
+
request['limit'] = limit;
|
|
3547
3566
|
// make request
|
|
3567
|
+
let response = undefined;
|
|
3548
3568
|
if (market['spot']) {
|
|
3549
3569
|
// checks if we need history endpoint
|
|
3550
|
-
if (historicalEndpointNeeded
|
|
3570
|
+
if (historicalEndpointNeeded) {
|
|
3551
3571
|
response = await this.publicSpotGetV2SpotMarketHistoryCandles(this.extend(request, params));
|
|
3552
3572
|
}
|
|
3553
3573
|
else {
|
|
@@ -3555,16 +3575,6 @@ class bitget extends bitget$1 {
|
|
|
3555
3575
|
}
|
|
3556
3576
|
}
|
|
3557
3577
|
else {
|
|
3558
|
-
const maxDistanceDaysForContracts = 90; // for contract, maximum 90 days allowed between start-end times
|
|
3559
|
-
// only correct the request to fix 90 days if until was auto-calculated
|
|
3560
|
-
if (sinceDefined) {
|
|
3561
|
-
if (!untilDefined) {
|
|
3562
|
-
request['endTime'] = Math.min(calculatedEndTime, this.sum(since, maxDistanceDaysForContracts * msInDay));
|
|
3563
|
-
}
|
|
3564
|
-
else if (calculatedEndTime - calculatedStartTime > maxDistanceDaysForContracts * msInDay) {
|
|
3565
|
-
throw new errors.BadRequest(this.id + ' fetchOHLCV() between start and end must be less than ' + maxDistanceDaysForContracts.toString() + ' days');
|
|
3566
|
-
}
|
|
3567
|
-
}
|
|
3568
3578
|
let priceType = undefined;
|
|
3569
3579
|
[priceType, params] = this.handleParamString(params, 'price');
|
|
3570
3580
|
let productType = undefined;
|
|
@@ -3579,7 +3589,7 @@ class bitget extends bitget$1 {
|
|
|
3579
3589
|
response = await this.publicMixGetV2MixMarketHistoryIndexCandles(extended);
|
|
3580
3590
|
}
|
|
3581
3591
|
else {
|
|
3582
|
-
if (historicalEndpointNeeded
|
|
3592
|
+
if (historicalEndpointNeeded) {
|
|
3583
3593
|
response = await this.publicMixGetV2MixMarketHistoryCandles(extended);
|
|
3584
3594
|
}
|
|
3585
3595
|
else {
|
|
@@ -6816,8 +6826,10 @@ class bitget extends bitget$1 {
|
|
|
6816
6826
|
* @name bitget#fetchFundingRate
|
|
6817
6827
|
* @description fetch the current funding rate
|
|
6818
6828
|
* @see https://www.bitget.com/api-doc/contract/market/Get-Current-Funding-Rate
|
|
6829
|
+
* @see https://www.bitget.com/api-doc/contract/market/Get-Symbol-Next-Funding-Time
|
|
6819
6830
|
* @param {string} symbol unified market symbol
|
|
6820
6831
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6832
|
+
* @param {string} [params.method] either (default) 'publicMixGetV2MixMarketCurrentFundRate' or 'publicMixGetV2MixMarketFundingTime'
|
|
6821
6833
|
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
6822
6834
|
*/
|
|
6823
6835
|
async fetchFundingRate(symbol, params = {}) {
|
|
@@ -6832,21 +6844,47 @@ class bitget extends bitget$1 {
|
|
|
6832
6844
|
'symbol': market['id'],
|
|
6833
6845
|
'productType': productType,
|
|
6834
6846
|
};
|
|
6835
|
-
|
|
6836
|
-
|
|
6837
|
-
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
|
|
6844
|
-
|
|
6845
|
-
|
|
6846
|
-
|
|
6847
|
-
|
|
6848
|
-
|
|
6849
|
-
|
|
6847
|
+
let method = undefined;
|
|
6848
|
+
[method, params] = this.handleOptionAndParams(params, 'fetchFundingRate', 'method', 'publicMixGetV2MixMarketCurrentFundRate');
|
|
6849
|
+
let response = undefined;
|
|
6850
|
+
if (method === 'publicMixGetV2MixMarketCurrentFundRate') {
|
|
6851
|
+
response = await this.publicMixGetV2MixMarketCurrentFundRate(this.extend(request, params));
|
|
6852
|
+
//
|
|
6853
|
+
// {
|
|
6854
|
+
// "code": "00000",
|
|
6855
|
+
// "msg": "success",
|
|
6856
|
+
// "requestTime": 1745500709429,
|
|
6857
|
+
// "data": [
|
|
6858
|
+
// {
|
|
6859
|
+
// "symbol": "BTCUSDT",
|
|
6860
|
+
// "fundingRate": "-0.000013",
|
|
6861
|
+
// "fundingRateInterval": "8",
|
|
6862
|
+
// "nextUpdate": "1745510400000",
|
|
6863
|
+
// "minFundingRate": "-0.003",
|
|
6864
|
+
// "maxFundingRate": "0.003"
|
|
6865
|
+
// }
|
|
6866
|
+
// ]
|
|
6867
|
+
// }
|
|
6868
|
+
//
|
|
6869
|
+
}
|
|
6870
|
+
else if (method === 'publicMixGetV2MixMarketFundingTime') {
|
|
6871
|
+
response = await this.publicMixGetV2MixMarketFundingTime(this.extend(request, params));
|
|
6872
|
+
//
|
|
6873
|
+
// {
|
|
6874
|
+
// "code": "00000",
|
|
6875
|
+
// "msg": "success",
|
|
6876
|
+
// "requestTime": 1745402092428,
|
|
6877
|
+
// "data": [
|
|
6878
|
+
// {
|
|
6879
|
+
// "symbol": "BTCUSDT",
|
|
6880
|
+
// "nextFundingTime": "1745424000000",
|
|
6881
|
+
// "ratePeriod": "8"
|
|
6882
|
+
// }
|
|
6883
|
+
// ]
|
|
6884
|
+
// }
|
|
6885
|
+
//
|
|
6886
|
+
}
|
|
6887
|
+
const data = this.safeList(response, 'data', []);
|
|
6850
6888
|
return this.parseFundingRate(data[0], market);
|
|
6851
6889
|
}
|
|
6852
6890
|
/**
|
|
@@ -6910,11 +6948,23 @@ class bitget extends bitget$1 {
|
|
|
6910
6948
|
}
|
|
6911
6949
|
parseFundingRate(contract, market = undefined) {
|
|
6912
6950
|
//
|
|
6913
|
-
// fetchFundingRate
|
|
6951
|
+
// fetchFundingRate: publicMixGetV2MixMarketCurrentFundRate
|
|
6952
|
+
//
|
|
6953
|
+
// {
|
|
6954
|
+
// "symbol": "BTCUSDT",
|
|
6955
|
+
// "fundingRate": "-0.000013",
|
|
6956
|
+
// "fundingRateInterval": "8",
|
|
6957
|
+
// "nextUpdate": "1745510400000",
|
|
6958
|
+
// "minFundingRate": "-0.003",
|
|
6959
|
+
// "maxFundingRate": "0.003"
|
|
6960
|
+
// }
|
|
6961
|
+
//
|
|
6962
|
+
// fetchFundingRate: publicMixGetV2MixMarketFundingTime
|
|
6914
6963
|
//
|
|
6915
6964
|
// {
|
|
6916
6965
|
// "symbol": "BTCUSDT",
|
|
6917
|
-
// "
|
|
6966
|
+
// "nextFundingTime": "1745424000000",
|
|
6967
|
+
// "ratePeriod": "8"
|
|
6918
6968
|
// }
|
|
6919
6969
|
//
|
|
6920
6970
|
// fetchFundingInterval
|
|
@@ -6924,7 +6974,9 @@ class bitget extends bitget$1 {
|
|
|
6924
6974
|
// "nextFundingTime": "1727942400000",
|
|
6925
6975
|
// "ratePeriod": "8"
|
|
6926
6976
|
// }
|
|
6977
|
+
//
|
|
6927
6978
|
// fetchFundingRates
|
|
6979
|
+
//
|
|
6928
6980
|
// {
|
|
6929
6981
|
// "symbol": "BTCUSD",
|
|
6930
6982
|
// "lastPr": "29904.5",
|
|
@@ -6950,10 +7002,11 @@ class bitget extends bitget$1 {
|
|
|
6950
7002
|
// "open24h": "0",
|
|
6951
7003
|
// "markPrice": "12345"
|
|
6952
7004
|
// }
|
|
7005
|
+
//
|
|
6953
7006
|
const marketId = this.safeString(contract, 'symbol');
|
|
6954
7007
|
const symbol = this.safeSymbol(marketId, market, undefined, 'swap');
|
|
6955
|
-
const fundingTimestamp = this.
|
|
6956
|
-
const interval = this.
|
|
7008
|
+
const fundingTimestamp = this.safeInteger2(contract, 'nextFundingTime', 'nextUpdate');
|
|
7009
|
+
const interval = this.safeString2(contract, 'ratePeriod', 'fundingRateInterval');
|
|
6957
7010
|
const timestamp = this.safeInteger(contract, 'ts');
|
|
6958
7011
|
const markPrice = this.safeNumber(contract, 'markPrice');
|
|
6959
7012
|
const indexPrice = this.safeNumber(contract, 'indexPrice');
|
package/dist/cjs/src/bitmart.js
CHANGED
|
@@ -206,6 +206,7 @@ class bitmart extends bitmart$1 {
|
|
|
206
206
|
'contract/private/order': 1.2,
|
|
207
207
|
'contract/private/order-history': 10,
|
|
208
208
|
'contract/private/position': 10,
|
|
209
|
+
'contract/private/position-v2': 10,
|
|
209
210
|
'contract/private/get-open-orders': 1.2,
|
|
210
211
|
'contract/private/current-plan-order': 1.2,
|
|
211
212
|
'contract/private/trades': 10,
|
|
@@ -1203,6 +1204,7 @@ class bitmart extends bitmart$1 {
|
|
|
1203
1204
|
// {
|
|
1204
1205
|
// "currency": "BTC",
|
|
1205
1206
|
// "name": "Bitcoin",
|
|
1207
|
+
// "recharge_minsize": '0.00000001',
|
|
1206
1208
|
// "contract_address": null,
|
|
1207
1209
|
// "network": "BTC",
|
|
1208
1210
|
// "withdraw_enabled": true,
|
|
@@ -1224,7 +1226,8 @@ class bitmart extends bitmart$1 {
|
|
|
1224
1226
|
const fullId = this.safeString(currency, 'currency');
|
|
1225
1227
|
let currencyId = fullId;
|
|
1226
1228
|
let networkId = this.safeString(currency, 'network');
|
|
1227
|
-
|
|
1229
|
+
const isNtf = (fullId.indexOf('NFT') >= 0);
|
|
1230
|
+
if (!isNtf) {
|
|
1228
1231
|
const parts = fullId.split('-');
|
|
1229
1232
|
currencyId = this.safeString(parts, 0);
|
|
1230
1233
|
const second = this.safeString(parts, 1);
|
|
@@ -1245,6 +1248,7 @@ class bitmart extends bitmart$1 {
|
|
|
1245
1248
|
'withdraw': undefined,
|
|
1246
1249
|
'active': undefined,
|
|
1247
1250
|
'networks': {},
|
|
1251
|
+
'type': isNtf ? 'other' : 'crypto',
|
|
1248
1252
|
};
|
|
1249
1253
|
}
|
|
1250
1254
|
const networkCode = this.networkIdToCode(networkId);
|
|
@@ -4896,6 +4900,7 @@ class bitmart extends bitmart$1 {
|
|
|
4896
4900
|
* @name bitmart#fetchPositions
|
|
4897
4901
|
* @description fetch all open contract positions
|
|
4898
4902
|
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-keyed
|
|
4903
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-v2-keyed
|
|
4899
4904
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
4900
4905
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4901
4906
|
* @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
@@ -4914,7 +4919,7 @@ class bitmart extends bitmart$1 {
|
|
|
4914
4919
|
// only supports symbols as undefined or sending one symbol
|
|
4915
4920
|
request['symbol'] = market['id'];
|
|
4916
4921
|
}
|
|
4917
|
-
const response = await this.
|
|
4922
|
+
const response = await this.privateGetContractPrivatePositionV2(this.extend(request, params));
|
|
4918
4923
|
//
|
|
4919
4924
|
// {
|
|
4920
4925
|
// "code": 1000,
|
package/dist/cjs/src/bitmex.js
CHANGED
|
@@ -495,6 +495,7 @@ class bitmex extends bitmex$1 {
|
|
|
495
495
|
const maxWithdrawal = this.parseNumber(Precise["default"].stringMul(maxWithdrawalString, precisionString));
|
|
496
496
|
const minDepositString = this.safeString(currency, 'minDepositAmount');
|
|
497
497
|
const minDeposit = this.parseNumber(Precise["default"].stringMul(minDepositString, precisionString));
|
|
498
|
+
const isCrypto = this.safeString(currency, 'currencyType') === 'Crypto';
|
|
498
499
|
result[code] = {
|
|
499
500
|
'id': id,
|
|
500
501
|
'code': code,
|
|
@@ -520,6 +521,7 @@ class bitmex extends bitmex$1 {
|
|
|
520
521
|
},
|
|
521
522
|
},
|
|
522
523
|
'networks': networks,
|
|
524
|
+
'type': isCrypto ? 'crypto' : 'other',
|
|
523
525
|
};
|
|
524
526
|
}
|
|
525
527
|
return result;
|
|
@@ -728,11 +730,11 @@ class bitmex extends bitmex$1 {
|
|
|
728
730
|
const quote = this.safeCurrencyCode(quoteId);
|
|
729
731
|
const contract = swap || future;
|
|
730
732
|
let contractSize = undefined;
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
733
|
+
let isInverse = this.safeValue(market, 'isInverse'); // this is true when BASE and SETTLE are same, i.e. BTC/XXX:BTC
|
|
734
|
+
let isQuanto = this.safeValue(market, 'isQuanto'); // this is true when BASE and SETTLE are different, i.e. AXS/XXX:BTC
|
|
735
|
+
let linear = contract ? (!isInverse && !isQuanto) : undefined;
|
|
734
736
|
const status = this.safeString(market, 'state');
|
|
735
|
-
const active = status
|
|
737
|
+
const active = status === 'Open'; // Open, Settled, Unlisted
|
|
736
738
|
let expiry = undefined;
|
|
737
739
|
let expiryDatetime = undefined;
|
|
738
740
|
let symbol = undefined;
|
|
@@ -749,9 +751,9 @@ class bitmex extends bitmex$1 {
|
|
|
749
751
|
const multiplierString = Precise["default"].stringAbs(this.safeString(market, 'multiplier'));
|
|
750
752
|
contractSize = this.parseNumber(multiplierString);
|
|
751
753
|
}
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
754
|
+
expiryDatetime = this.safeString(market, 'expiry');
|
|
755
|
+
expiry = this.parse8601(expiryDatetime);
|
|
756
|
+
if (expiry !== undefined) {
|
|
755
757
|
symbol = symbol + '-' + this.yymmdd(expiry);
|
|
756
758
|
}
|
|
757
759
|
}
|
|
@@ -765,6 +767,12 @@ class bitmex extends bitmex$1 {
|
|
|
765
767
|
const maxOrderQty = this.safeNumber(market, 'maxOrderQty');
|
|
766
768
|
const initMargin = this.safeString(market, 'initMargin', '1');
|
|
767
769
|
const maxLeverage = this.parseNumber(Precise["default"].stringDiv('1', initMargin));
|
|
770
|
+
// subtype should be undefined for spot markets
|
|
771
|
+
if (spot) {
|
|
772
|
+
isInverse = undefined;
|
|
773
|
+
isQuanto = undefined;
|
|
774
|
+
linear = undefined;
|
|
775
|
+
}
|
|
768
776
|
return {
|
|
769
777
|
'id': id,
|
|
770
778
|
'symbol': symbol,
|
|
@@ -814,7 +822,7 @@ class bitmex extends bitmex$1 {
|
|
|
814
822
|
'max': positionIsQuote ? maxOrderQty : undefined,
|
|
815
823
|
},
|
|
816
824
|
},
|
|
817
|
-
'created':
|
|
825
|
+
'created': undefined,
|
|
818
826
|
'info': market,
|
|
819
827
|
};
|
|
820
828
|
}
|