ccxt 4.4.75__py2.py3-none-any.whl → 4.4.78__py2.py3-none-any.whl
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.
- ccxt/__init__.py +3 -3
- ccxt/abstract/apex.py +31 -0
- ccxt/abstract/myokx.py +4 -0
- ccxt/abstract/okx.py +4 -0
- ccxt/abstract/upbit.py +51 -37
- ccxt/abstract/xt.py +3 -0
- ccxt/apex.py +1884 -0
- ccxt/ascendex.py +2 -2
- ccxt/async_support/__init__.py +3 -3
- ccxt/async_support/apex.py +1884 -0
- ccxt/async_support/ascendex.py +2 -2
- ccxt/async_support/base/exchange.py +2 -2
- ccxt/async_support/binance.py +39 -217
- ccxt/async_support/bingx.py +1 -1
- ccxt/async_support/bitfinex.py +2 -2
- ccxt/async_support/bitflyer.py +2 -2
- ccxt/async_support/bitget.py +135 -65
- ccxt/async_support/bitmart.py +2 -2
- ccxt/async_support/bitmex.py +6 -6
- ccxt/async_support/bitrue.py +48 -0
- ccxt/async_support/cex.py +1 -1
- ccxt/async_support/coinbase.py +29 -4
- ccxt/async_support/coincatch.py +66 -0
- ccxt/async_support/coinex.py +3 -1
- ccxt/async_support/coinlist.py +85 -2
- ccxt/async_support/cryptocom.py +2 -2
- ccxt/async_support/defx.py +1 -1
- ccxt/async_support/delta.py +1 -1
- ccxt/async_support/deribit.py +2 -2
- ccxt/async_support/derive.py +2 -2
- ccxt/async_support/digifinex.py +2 -2
- ccxt/async_support/gate.py +1 -1
- ccxt/async_support/hitbtc.py +5 -2
- ccxt/async_support/htx.py +2 -2
- ccxt/async_support/hyperliquid.py +13 -6
- ccxt/async_support/kraken.py +2 -2
- ccxt/async_support/krakenfutures.py +2 -2
- ccxt/async_support/kucoinfutures.py +2 -2
- ccxt/async_support/mexc.py +50 -52
- ccxt/async_support/okx.py +21 -9
- ccxt/async_support/oxfun.py +2 -2
- ccxt/async_support/paradex.py +5 -10
- ccxt/async_support/phemex.py +4 -3
- ccxt/async_support/poloniex.py +3 -3
- ccxt/async_support/probit.py +1 -0
- ccxt/async_support/tradeogre.py +2 -1
- ccxt/async_support/upbit.py +265 -89
- ccxt/async_support/vertex.py +2 -2
- ccxt/async_support/whitebit.py +1 -0
- ccxt/async_support/woo.py +5 -3
- ccxt/async_support/woofipro.py +2 -2
- ccxt/async_support/xt.py +115 -5
- ccxt/base/exchange.py +76 -3
- ccxt/binance.py +39 -217
- ccxt/bingx.py +1 -1
- ccxt/bitfinex.py +2 -2
- ccxt/bitflyer.py +2 -2
- ccxt/bitget.py +135 -65
- ccxt/bitmart.py +2 -2
- ccxt/bitmex.py +6 -6
- ccxt/bitrue.py +48 -0
- ccxt/cex.py +1 -1
- ccxt/coinbase.py +29 -4
- ccxt/coincatch.py +66 -0
- ccxt/coinex.py +3 -1
- ccxt/coinlist.py +85 -2
- ccxt/cryptocom.py +2 -2
- ccxt/defx.py +1 -1
- ccxt/delta.py +1 -1
- ccxt/deribit.py +2 -2
- ccxt/derive.py +2 -2
- ccxt/digifinex.py +2 -2
- ccxt/gate.py +1 -1
- ccxt/hitbtc.py +5 -2
- ccxt/htx.py +2 -2
- ccxt/hyperliquid.py +13 -6
- ccxt/kraken.py +2 -2
- ccxt/krakenfutures.py +2 -2
- ccxt/kucoinfutures.py +2 -2
- ccxt/mexc.py +50 -52
- ccxt/okx.py +21 -9
- ccxt/oxfun.py +2 -2
- ccxt/paradex.py +5 -10
- ccxt/phemex.py +4 -3
- ccxt/poloniex.py +3 -3
- ccxt/pro/__init__.py +5 -1
- ccxt/pro/apex.py +984 -0
- ccxt/pro/coinbase.py +4 -6
- ccxt/pro/gate.py +22 -2
- ccxt/pro/hollaex.py +2 -2
- ccxt/pro/hyperliquid.py +1 -1
- ccxt/pro/p2b.py +2 -2
- ccxt/pro/tradeogre.py +272 -0
- ccxt/probit.py +1 -0
- ccxt/test/tests_async.py +27 -0
- ccxt/test/tests_sync.py +27 -0
- ccxt/tradeogre.py +2 -1
- ccxt/upbit.py +265 -89
- ccxt/vertex.py +2 -2
- ccxt/whitebit.py +1 -0
- ccxt/woo.py +5 -3
- ccxt/woofipro.py +2 -2
- ccxt/xt.py +115 -5
- {ccxt-4.4.75.dist-info → ccxt-4.4.78.dist-info}/METADATA +4 -4
- {ccxt-4.4.75.dist-info → ccxt-4.4.78.dist-info}/RECORD +108 -106
- ccxt/abstract/ace.py +0 -15
- ccxt/ace.py +0 -1152
- ccxt/async_support/ace.py +0 -1152
- {ccxt-4.4.75.dist-info → ccxt-4.4.78.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.75.dist-info → ccxt-4.4.78.dist-info}/WHEEL +0 -0
- {ccxt-4.4.75.dist-info → ccxt-4.4.78.dist-info}/top_level.txt +0 -0
ccxt/async_support/bitget.py
CHANGED
@@ -1393,28 +1393,44 @@ class bitget(Exchange, ImplicitAPI):
|
|
1393
1393
|
'fillResponseFromRequest': True,
|
1394
1394
|
},
|
1395
1395
|
'fetchOHLCV': {
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
'
|
1400
|
-
'method': 'publicMixGetV2MixMarketCandles', # publicMixGetV2MixMarketCandles or publicMixGetV2MixMarketHistoryCandles or publicMixGetV2MixMarketHistoryIndexCandles or publicMixGetV2MixMarketHistoryMarkCandles
|
1401
|
-
},
|
1402
|
-
'maxDaysPerTimeframe': {
|
1396
|
+
# ### Timeframe settings ###
|
1397
|
+
# after testing, the below values are real ones, because the values provided by API DOCS are wrong
|
1398
|
+
# so, start timestamp should be within these thresholds to be able to call "recent" candles endpoint
|
1399
|
+
'maxRecentDaysPerTimeframe': {
|
1403
1400
|
'1m': 30,
|
1404
1401
|
'3m': 30,
|
1405
1402
|
'5m': 30,
|
1406
|
-
'
|
1407
|
-
'
|
1408
|
-
'
|
1409
|
-
'1h': 83,
|
1410
|
-
'2h': 120,
|
1403
|
+
'15m': 30,
|
1404
|
+
'30m': 30,
|
1405
|
+
'1h': 60,
|
1411
1406
|
'4h': 240,
|
1412
1407
|
'6h': 360,
|
1413
|
-
'12h':
|
1414
|
-
'1d':
|
1415
|
-
'3d':
|
1416
|
-
'1w':
|
1417
|
-
'1M':
|
1408
|
+
'12h': 720,
|
1409
|
+
'1d': 1440,
|
1410
|
+
'3d': 1440 * 3,
|
1411
|
+
'1w': 1440 * 7,
|
1412
|
+
'1M': 1440 * 30,
|
1413
|
+
},
|
1414
|
+
'spot': {
|
1415
|
+
'maxLimitPerTimeframe': {
|
1416
|
+
'1d': 300,
|
1417
|
+
'3d': 100,
|
1418
|
+
'1w': 100,
|
1419
|
+
'1M': 100,
|
1420
|
+
},
|
1421
|
+
'method': 'publicSpotGetV2SpotMarketCandles', # publicSpotGetV2SpotMarketCandles or publicSpotGetV2SpotMarketHistoryCandles
|
1422
|
+
},
|
1423
|
+
'swap': {
|
1424
|
+
'maxLimitPerTimeframe': {
|
1425
|
+
'4h': 540,
|
1426
|
+
'6h': 360,
|
1427
|
+
'12h': 180,
|
1428
|
+
'1d': 90,
|
1429
|
+
'3d': 30,
|
1430
|
+
'1w': 13,
|
1431
|
+
'1M': 4,
|
1432
|
+
},
|
1433
|
+
'method': 'publicMixGetV2MixMarketCandles', # publicMixGetV2MixMarketCandles or publicMixGetV2MixMarketHistoryCandles or publicMixGetV2MixMarketHistoryIndexCandles or publicMixGetV2MixMarketHistoryMarkCandles
|
1418
1434
|
},
|
1419
1435
|
},
|
1420
1436
|
'fetchTrades': {
|
@@ -1425,6 +1441,9 @@ class bitget(Exchange, ImplicitAPI):
|
|
1425
1441
|
'method': 'publicMixGetV2MixMarketFillsHistory', # or publicMixGetV2MixMarketFills
|
1426
1442
|
},
|
1427
1443
|
},
|
1444
|
+
'fetchFundingRate': {
|
1445
|
+
'method': 'publicMixGetV2MixMarketCurrentFundRate', # or publicMixGetV2MixMarketFundingTime
|
1446
|
+
},
|
1428
1447
|
'accountsByType': {
|
1429
1448
|
'spot': 'spot',
|
1430
1449
|
'cross': 'crossed_margin',
|
@@ -1622,7 +1641,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
1622
1641
|
'symbolRequired': False,
|
1623
1642
|
},
|
1624
1643
|
'fetchOHLCV': {
|
1625
|
-
'limit':
|
1644
|
+
'limit': 200, # variable timespans for recent endpoint, 200 for historical
|
1626
1645
|
},
|
1627
1646
|
},
|
1628
1647
|
'forPerps': {
|
@@ -1697,11 +1716,12 @@ class bitget(Exchange, ImplicitAPI):
|
|
1697
1716
|
defaultProductType = None
|
1698
1717
|
if (subType is not None) and (market is None):
|
1699
1718
|
# set default only if subType is defined and market is not defined, since there is also USDC productTypes which are also linear
|
1700
|
-
sandboxMode = self.safe_bool(self.options, 'sandboxMode', False)
|
1701
|
-
if sandboxMode:
|
1702
|
-
|
1703
|
-
else:
|
1704
|
-
|
1719
|
+
# sandboxMode = self.safe_bool(self.options, 'sandboxMode', False)
|
1720
|
+
# if sandboxMode:
|
1721
|
+
# defaultProductType = 'SUSDT-FUTURES' if (subType == 'linear') else 'SCOIN-FUTURES'
|
1722
|
+
# else:
|
1723
|
+
defaultProductType = 'USDT-FUTURES' if (subType == 'linear') else 'COIN-FUTURES'
|
1724
|
+
# }
|
1705
1725
|
productType = self.safe_string(params, 'productType', defaultProductType)
|
1706
1726
|
if (productType is None) and (market is not None):
|
1707
1727
|
settle = market['settle']
|
@@ -3219,7 +3239,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
3219
3239
|
else:
|
3220
3240
|
request['businessType'] = 'spot'
|
3221
3241
|
else:
|
3222
|
-
request['businessType'] = '
|
3242
|
+
request['businessType'] = 'mix'
|
3223
3243
|
response = await self.privateCommonGetV2CommonTradeRate(self.extend(request, params))
|
3224
3244
|
#
|
3225
3245
|
# {
|
@@ -3416,29 +3436,31 @@ class bitget(Exchange, ImplicitAPI):
|
|
3416
3436
|
market = self.market(symbol)
|
3417
3437
|
marketType = 'spot' if market['spot'] else 'swap'
|
3418
3438
|
timeframes = self.options['timeframes'][marketType]
|
3419
|
-
msInDay = 86400000
|
3420
|
-
duration = self.parse_timeframe(timeframe) * 1000
|
3421
3439
|
request: dict = {
|
3422
3440
|
'symbol': market['id'],
|
3423
3441
|
'granularity': self.safe_string(timeframes, timeframe, timeframe),
|
3424
3442
|
}
|
3443
|
+
msInDay = 86400000
|
3444
|
+
now = self.milliseconds()
|
3445
|
+
duration = self.parse_timeframe(timeframe) * 1000
|
3425
3446
|
until = self.safe_integer(params, 'until')
|
3426
3447
|
limitDefined = limit is not None
|
3427
3448
|
sinceDefined = since is not None
|
3428
3449
|
untilDefined = until is not None
|
3429
3450
|
params = self.omit(params, ['until'])
|
3430
|
-
response = None
|
3431
|
-
now = self.milliseconds()
|
3432
3451
|
# retrievable periods listed here:
|
3433
3452
|
# - https://www.bitget.com/api-doc/spot/market/Get-Candle-Data#request-parameters
|
3434
3453
|
# - https://www.bitget.com/api-doc/contract/market/Get-Candle-Data#description
|
3435
|
-
|
3436
|
-
|
3437
|
-
|
3438
|
-
|
3454
|
+
key = 'spot' if market['spot'] else 'swap'
|
3455
|
+
ohlcOptions = self.safe_dict(self.options['fetchOHLCV'], key, {})
|
3456
|
+
maxLimitPerTimeframe = self.safe_dict(ohlcOptions, 'maxLimitPerTimeframe', {})
|
3457
|
+
maxLimitForThisTimeframe = self.safe_integer(maxLimitPerTimeframe, timeframe, limit)
|
3458
|
+
recentEndpointDaysMap = self.safe_dict(self.options['fetchOHLCV'], 'maxRecentDaysPerTimeframe', {})
|
3459
|
+
recentEndpointAvailableDays = self.safe_integer(recentEndpointDaysMap, timeframe)
|
3460
|
+
recentEndpointBoundaryTs = now - (recentEndpointAvailableDays - 1) * msInDay
|
3439
3461
|
if limitDefined:
|
3440
3462
|
limit = min(limit, maxLimitForRecentEndpoint)
|
3441
|
-
|
3463
|
+
limit = min(limit, maxLimitForThisTimeframe)
|
3442
3464
|
else:
|
3443
3465
|
limit = defaultLimit
|
3444
3466
|
limitMultipliedDuration = limit * duration
|
@@ -3458,26 +3480,33 @@ class bitget(Exchange, ImplicitAPI):
|
|
3458
3480
|
if not sinceDefined:
|
3459
3481
|
calculatedStartTime = calculatedEndTime - limitMultipliedDuration
|
3460
3482
|
# we do not need to set "startTime" here
|
3461
|
-
|
3462
|
-
|
3483
|
+
# if historical endpoint is needed, we should re-set the variables
|
3484
|
+
historicalEndpointNeeded = False
|
3485
|
+
if (calculatedStartTime is not None and calculatedStartTime <= recentEndpointBoundaryTs) or useHistoryEndpoint:
|
3486
|
+
historicalEndpointNeeded = True
|
3463
3487
|
# only for "historical-candles" - ensure we use correct max limit
|
3464
|
-
|
3465
|
-
|
3488
|
+
limit = min(limit, maxLimitForHistoryEndpoint)
|
3489
|
+
limitMultipliedDuration = limit * duration
|
3490
|
+
calculatedStartTime = calculatedEndTime - limitMultipliedDuration
|
3491
|
+
request['startTime'] = calculatedStartTime
|
3492
|
+
# for contract, maximum 90 days allowed between start-end times
|
3493
|
+
if not market['spot']:
|
3494
|
+
maxDistanceDaysForContracts = 90
|
3495
|
+
# only correct if request is larger
|
3496
|
+
if calculatedEndTime - calculatedStartTime > maxDistanceDaysForContracts * msInDay:
|
3497
|
+
calculatedEndTime = self.sum(calculatedStartTime, maxDistanceDaysForContracts * msInDay)
|
3498
|
+
request['endTime'] = calculatedEndTime
|
3499
|
+
# we need to set limit to safely cover the period
|
3500
|
+
request['limit'] = limit
|
3466
3501
|
# make request
|
3502
|
+
response = None
|
3467
3503
|
if market['spot']:
|
3468
3504
|
# checks if we need history endpoint
|
3469
|
-
if historicalEndpointNeeded
|
3505
|
+
if historicalEndpointNeeded:
|
3470
3506
|
response = await self.publicSpotGetV2SpotMarketHistoryCandles(self.extend(request, params))
|
3471
3507
|
else:
|
3472
3508
|
response = await self.publicSpotGetV2SpotMarketCandles(self.extend(request, params))
|
3473
3509
|
else:
|
3474
|
-
maxDistanceDaysForContracts = 90 # for contract, maximum 90 days allowed between start-end times
|
3475
|
-
# only correct the request to fix 90 days if until was auto-calculated
|
3476
|
-
if sinceDefined:
|
3477
|
-
if not untilDefined:
|
3478
|
-
request['endTime'] = min(calculatedEndTime, self.sum(since, maxDistanceDaysForContracts * msInDay))
|
3479
|
-
elif calculatedEndTime - calculatedStartTime > maxDistanceDaysForContracts * msInDay:
|
3480
|
-
raise BadRequest(self.id + ' fetchOHLCV() between start and end must be less than ' + str(maxDistanceDaysForContracts) + ' days')
|
3481
3510
|
priceType = None
|
3482
3511
|
priceType, params = self.handle_param_string(params, 'price')
|
3483
3512
|
productType = None
|
@@ -3490,7 +3519,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
3490
3519
|
elif priceType == 'index':
|
3491
3520
|
response = await self.publicMixGetV2MixMarketHistoryIndexCandles(extended)
|
3492
3521
|
else:
|
3493
|
-
if historicalEndpointNeeded
|
3522
|
+
if historicalEndpointNeeded:
|
3494
3523
|
response = await self.publicMixGetV2MixMarketHistoryCandles(extended)
|
3495
3524
|
else:
|
3496
3525
|
response = await self.publicMixGetV2MixMarketCandles(extended)
|
@@ -6444,9 +6473,11 @@ class bitget(Exchange, ImplicitAPI):
|
|
6444
6473
|
fetch the current funding rate
|
6445
6474
|
|
6446
6475
|
https://www.bitget.com/api-doc/contract/market/Get-Current-Funding-Rate
|
6476
|
+
https://www.bitget.com/api-doc/contract/market/Get-Symbol-Next-Funding-Time
|
6447
6477
|
|
6448
6478
|
:param str symbol: unified market symbol
|
6449
6479
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
6480
|
+
:param str [params.method]: either(default) 'publicMixGetV2MixMarketCurrentFundRate' or 'publicMixGetV2MixMarketFundingTime'
|
6450
6481
|
:returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
6451
6482
|
"""
|
6452
6483
|
await self.load_markets()
|
@@ -6459,21 +6490,45 @@ class bitget(Exchange, ImplicitAPI):
|
|
6459
6490
|
'symbol': market['id'],
|
6460
6491
|
'productType': productType,
|
6461
6492
|
}
|
6462
|
-
|
6463
|
-
|
6464
|
-
|
6465
|
-
|
6466
|
-
|
6467
|
-
|
6468
|
-
|
6469
|
-
|
6470
|
-
|
6471
|
-
|
6472
|
-
|
6473
|
-
|
6474
|
-
|
6475
|
-
|
6476
|
-
|
6493
|
+
method = None
|
6494
|
+
method, params = self.handle_option_and_params(params, 'fetchFundingRate', 'method', 'publicMixGetV2MixMarketCurrentFundRate')
|
6495
|
+
response = None
|
6496
|
+
if method == 'publicMixGetV2MixMarketCurrentFundRate':
|
6497
|
+
response = await self.publicMixGetV2MixMarketCurrentFundRate(self.extend(request, params))
|
6498
|
+
#
|
6499
|
+
# {
|
6500
|
+
# "code": "00000",
|
6501
|
+
# "msg": "success",
|
6502
|
+
# "requestTime": 1745500709429,
|
6503
|
+
# "data": [
|
6504
|
+
# {
|
6505
|
+
# "symbol": "BTCUSDT",
|
6506
|
+
# "fundingRate": "-0.000013",
|
6507
|
+
# "fundingRateInterval": "8",
|
6508
|
+
# "nextUpdate": "1745510400000",
|
6509
|
+
# "minFundingRate": "-0.003",
|
6510
|
+
# "maxFundingRate": "0.003"
|
6511
|
+
# }
|
6512
|
+
# ]
|
6513
|
+
# }
|
6514
|
+
#
|
6515
|
+
elif method == 'publicMixGetV2MixMarketFundingTime':
|
6516
|
+
response = await self.publicMixGetV2MixMarketFundingTime(self.extend(request, params))
|
6517
|
+
#
|
6518
|
+
# {
|
6519
|
+
# "code": "00000",
|
6520
|
+
# "msg": "success",
|
6521
|
+
# "requestTime": 1745402092428,
|
6522
|
+
# "data": [
|
6523
|
+
# {
|
6524
|
+
# "symbol": "BTCUSDT",
|
6525
|
+
# "nextFundingTime": "1745424000000",
|
6526
|
+
# "ratePeriod": "8"
|
6527
|
+
# }
|
6528
|
+
# ]
|
6529
|
+
# }
|
6530
|
+
#
|
6531
|
+
data = self.safe_list(response, 'data', [])
|
6477
6532
|
return self.parse_funding_rate(data[0], market)
|
6478
6533
|
|
6479
6534
|
async def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
|
@@ -6536,11 +6591,23 @@ class bitget(Exchange, ImplicitAPI):
|
|
6536
6591
|
|
6537
6592
|
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
6538
6593
|
#
|
6539
|
-
# fetchFundingRate
|
6594
|
+
# fetchFundingRate: publicMixGetV2MixMarketCurrentFundRate
|
6540
6595
|
#
|
6541
6596
|
# {
|
6542
6597
|
# "symbol": "BTCUSDT",
|
6543
|
-
# "fundingRate": "-0.
|
6598
|
+
# "fundingRate": "-0.000013",
|
6599
|
+
# "fundingRateInterval": "8",
|
6600
|
+
# "nextUpdate": "1745510400000",
|
6601
|
+
# "minFundingRate": "-0.003",
|
6602
|
+
# "maxFundingRate": "0.003"
|
6603
|
+
# }
|
6604
|
+
#
|
6605
|
+
# fetchFundingRate: publicMixGetV2MixMarketFundingTime
|
6606
|
+
#
|
6607
|
+
# {
|
6608
|
+
# "symbol": "BTCUSDT",
|
6609
|
+
# "nextFundingTime": "1745424000000",
|
6610
|
+
# "ratePeriod": "8"
|
6544
6611
|
# }
|
6545
6612
|
#
|
6546
6613
|
# fetchFundingInterval
|
@@ -6550,7 +6617,9 @@ class bitget(Exchange, ImplicitAPI):
|
|
6550
6617
|
# "nextFundingTime": "1727942400000",
|
6551
6618
|
# "ratePeriod": "8"
|
6552
6619
|
# }
|
6620
|
+
#
|
6553
6621
|
# fetchFundingRates
|
6622
|
+
#
|
6554
6623
|
# {
|
6555
6624
|
# "symbol": "BTCUSD",
|
6556
6625
|
# "lastPr": "29904.5",
|
@@ -6576,10 +6645,11 @@ class bitget(Exchange, ImplicitAPI):
|
|
6576
6645
|
# "open24h": "0",
|
6577
6646
|
# "markPrice": "12345"
|
6578
6647
|
# }
|
6648
|
+
#
|
6579
6649
|
marketId = self.safe_string(contract, 'symbol')
|
6580
6650
|
symbol = self.safe_symbol(marketId, market, None, 'swap')
|
6581
|
-
fundingTimestamp = self.
|
6582
|
-
interval = self.
|
6651
|
+
fundingTimestamp = self.safe_integer_2(contract, 'nextFundingTime', 'nextUpdate')
|
6652
|
+
interval = self.safe_string_2(contract, 'ratePeriod', 'fundingRateInterval')
|
6583
6653
|
timestamp = self.safe_integer(contract, 'ts')
|
6584
6654
|
markPrice = self.safe_number(contract, 'markPrice')
|
6585
6655
|
indexPrice = self.safe_number(contract, 'indexPrice')
|
ccxt/async_support/bitmart.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.bitmart import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Any, Balances, BorrowInterest, Currencies, Currency, DepositAddress, FundingHistory, Int, IsolatedBorrowRate, IsolatedBorrowRates, LedgerEntry, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, Trade, TradingFeeInterface, Transaction, MarketInterface, TransferEntry
|
9
|
+
from ccxt.base.types import Any, Balances, BorrowInterest, Currencies, Currency, DepositAddress, FundingHistory, Int, IsolatedBorrowRate, IsolatedBorrowRates, LedgerEntry, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, Trade, TradingFeeInterface, Transaction, MarketInterface, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -4654,7 +4654,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4654
4654
|
first = self.safe_dict(data, 0, {})
|
4655
4655
|
return self.parse_position(first, market)
|
4656
4656
|
|
4657
|
-
async def fetch_positions(self, symbols: Strings = None, params={}):
|
4657
|
+
async def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
4658
4658
|
"""
|
4659
4659
|
fetch all open contract positions
|
4660
4660
|
|
ccxt/async_support/bitmex.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.bitmex import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Any, Balances, Currencies, Currency, DepositAddress, Int, LedgerEntry, Leverage, Leverages, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, Transaction
|
9
|
+
from ccxt.base.types import Any, Balances, Currencies, Currency, DepositAddress, Int, LedgerEntry, Leverage, Leverages, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, Transaction
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -729,7 +729,7 @@ class bitmex(Exchange, ImplicitAPI):
|
|
729
729
|
isQuanto = self.safe_value(market, 'isQuanto') # self is True when BASE and SETTLE are different, i.e. AXS/XXX:BTC
|
730
730
|
linear = (not isInverse and not isQuanto) if contract else None
|
731
731
|
status = self.safe_string(market, 'state')
|
732
|
-
active = status
|
732
|
+
active = status == 'Open' # Open, Settled, Unlisted
|
733
733
|
expiry = None
|
734
734
|
expiryDatetime = None
|
735
735
|
symbol = None
|
@@ -743,9 +743,9 @@ class bitmex(Exchange, ImplicitAPI):
|
|
743
743
|
else:
|
744
744
|
multiplierString = Precise.string_abs(self.safe_string(market, 'multiplier'))
|
745
745
|
contractSize = self.parse_number(multiplierString)
|
746
|
-
|
747
|
-
|
748
|
-
|
746
|
+
expiryDatetime = self.safe_string(market, 'expiry')
|
747
|
+
expiry = self.parse8601(expiryDatetime)
|
748
|
+
if expiry is not None:
|
749
749
|
symbol = symbol + '-' + self.yymmdd(expiry)
|
750
750
|
else:
|
751
751
|
# for index/exotic markets, default to id
|
@@ -2182,7 +2182,7 @@ class bitmex(Exchange, ImplicitAPI):
|
|
2182
2182
|
'shortLeverage': self.safe_integer(leverage, 'leverage'),
|
2183
2183
|
}
|
2184
2184
|
|
2185
|
-
async def fetch_positions(self, symbols: Strings = None, params={}):
|
2185
|
+
async def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
2186
2186
|
"""
|
2187
2187
|
fetch all open positions
|
2188
2188
|
|
ccxt/async_support/bitrue.py
CHANGED
@@ -51,20 +51,32 @@ class bitrue(Exchange, ImplicitAPI):
|
|
51
51
|
'swap': True,
|
52
52
|
'future': False,
|
53
53
|
'option': False,
|
54
|
+
'addMargin': False,
|
55
|
+
'borrowCrossMargin': False,
|
56
|
+
'borrowIsolatedMargin': False,
|
57
|
+
'borrowMargin': False,
|
54
58
|
'cancelAllOrders': True,
|
55
59
|
'cancelOrder': True,
|
60
|
+
'closeAllPositions': False,
|
61
|
+
'closePosition': False,
|
56
62
|
'createMarketBuyOrderWithCost': True,
|
57
63
|
'createMarketOrderWithCost': False,
|
58
64
|
'createMarketSellOrderWithCost': False,
|
59
65
|
'createOrder': True,
|
66
|
+
'createOrderWithTakeProfitAndStopLoss': False,
|
67
|
+
'createOrderWithTakeProfitAndStopLossWs': False,
|
60
68
|
'createReduceOnlyOrder': True,
|
61
69
|
'createStopLimitOrder': True,
|
62
70
|
'createStopMarketOrder': True,
|
63
71
|
'createStopOrder': True,
|
64
72
|
'fetchBalance': True,
|
65
73
|
'fetchBidsAsks': True,
|
74
|
+
'fetchBorrowInterest': False,
|
75
|
+
'fetchBorrowRate': False,
|
66
76
|
'fetchBorrowRateHistories': False,
|
67
77
|
'fetchBorrowRateHistory': False,
|
78
|
+
'fetchBorrowRates': False,
|
79
|
+
'fetchBorrowRatesPerSymbol': False,
|
68
80
|
'fetchClosedOrders': True,
|
69
81
|
'fetchCrossBorrowRate': False,
|
70
82
|
'fetchCrossBorrowRates': False,
|
@@ -75,20 +87,50 @@ class bitrue(Exchange, ImplicitAPI):
|
|
75
87
|
'fetchDepositWithdrawFee': 'emulated',
|
76
88
|
'fetchDepositWithdrawFees': True,
|
77
89
|
'fetchFundingHistory': False,
|
90
|
+
'fetchFundingInterval': False,
|
91
|
+
'fetchFundingIntervals': False,
|
78
92
|
'fetchFundingRate': False,
|
79
93
|
'fetchFundingRateHistory': False,
|
80
94
|
'fetchFundingRates': False,
|
95
|
+
'fetchGreeks': False,
|
96
|
+
'fetchIndexOHLCV': False,
|
81
97
|
'fetchIsolatedBorrowRate': False,
|
82
98
|
'fetchIsolatedBorrowRates': False,
|
99
|
+
'fetchIsolatedPositions': False,
|
100
|
+
'fetchLeverage': False,
|
101
|
+
'fetchLeverages': False,
|
102
|
+
'fetchLeverageTiers': False,
|
103
|
+
'fetchLiquidations': False,
|
104
|
+
'fetchLongShortRatio': False,
|
105
|
+
'fetchLongShortRatioHistory': False,
|
106
|
+
'fetchMarginAdjustmentHistory': False,
|
83
107
|
'fetchMarginMode': False,
|
108
|
+
'fetchMarginModes': False,
|
109
|
+
'fetchMarketLeverageTiers': False,
|
84
110
|
'fetchMarkets': True,
|
111
|
+
'fetchMarkOHLCV': False,
|
112
|
+
'fetchMarkPrices': False,
|
113
|
+
'fetchMyLiquidations': False,
|
114
|
+
'fetchMySettlementHistory': False,
|
85
115
|
'fetchMyTrades': True,
|
86
116
|
'fetchOHLCV': True,
|
117
|
+
'fetchOpenInterest': False,
|
118
|
+
'fetchOpenInterestHistory': False,
|
119
|
+
'fetchOpenInterests': False,
|
87
120
|
'fetchOpenOrders': True,
|
121
|
+
'fetchOption': False,
|
122
|
+
'fetchOptionChain': False,
|
88
123
|
'fetchOrder': True,
|
89
124
|
'fetchOrderBook': True,
|
90
125
|
'fetchOrders': False,
|
126
|
+
'fetchPosition': False,
|
127
|
+
'fetchPositionHistory': False,
|
91
128
|
'fetchPositionMode': False,
|
129
|
+
'fetchPositions': False,
|
130
|
+
'fetchPositionsHistory': False,
|
131
|
+
'fetchPositionsRisk': False,
|
132
|
+
'fetchPremiumIndexOHLCV': False,
|
133
|
+
'fetchSettlementHistory': False,
|
92
134
|
'fetchStatus': True,
|
93
135
|
'fetchTicker': True,
|
94
136
|
'fetchTickers': True,
|
@@ -99,9 +141,15 @@ class bitrue(Exchange, ImplicitAPI):
|
|
99
141
|
'fetchTransactionFees': False,
|
100
142
|
'fetchTransactions': False,
|
101
143
|
'fetchTransfers': True,
|
144
|
+
'fetchVolatilityHistory': False,
|
102
145
|
'fetchWithdrawals': True,
|
146
|
+
'reduceMargin': False,
|
147
|
+
'repayCrossMargin': False,
|
148
|
+
'repayIsolatedMargin': False,
|
103
149
|
'setLeverage': True,
|
104
150
|
'setMargin': True,
|
151
|
+
'setMarginMode': False,
|
152
|
+
'setPositionMode': False,
|
105
153
|
'transfer': True,
|
106
154
|
'withdraw': True,
|
107
155
|
},
|
ccxt/async_support/cex.py
CHANGED
@@ -555,7 +555,7 @@ class cex(Exchange, ImplicitAPI):
|
|
555
555
|
'askVolume': None,
|
556
556
|
'vwap': None,
|
557
557
|
'open': None,
|
558
|
-
'close': self.safe_string(ticker, '
|
558
|
+
'close': self.safe_string(ticker, 'last'), # last indicative price per api docs(difference also seen here: https://github.com/ccxt/ccxt/actions/runs/14593899575/job/40935513901?pr=25767#step:11:456 )
|
559
559
|
'previousClose': None,
|
560
560
|
'change': self.safe_number(ticker, 'priceChange'),
|
561
561
|
'percentage': self.safe_number(ticker, 'priceChangePercentage'),
|
ccxt/async_support/coinbase.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.coinbase import ImplicitAPI
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
|
-
from ccxt.base.types import Account, Any, Balances, Conversion, Currencies, Currency, DepositAddress, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, MarketInterface
|
10
|
+
from ccxt.base.types import Account, Any, Balances, Conversion, Currencies, Currency, DepositAddress, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, MarketInterface
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import AuthenticationError
|
@@ -387,6 +387,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
387
387
|
'fetchBalance': 'v2PrivateGetAccounts', # 'v2PrivateGetAccounts' or 'v3PrivateGetBrokerageAccounts'
|
388
388
|
'fetchTime': 'v2PublicGetTime', # 'v2PublicGetTime' or 'v3PublicGetBrokerageTime'
|
389
389
|
'user_native_currency': 'USD', # needed to get fees for v3
|
390
|
+
'aliasCbMarketIds': {},
|
390
391
|
},
|
391
392
|
'features': {
|
392
393
|
'default': {
|
@@ -1474,7 +1475,29 @@ class coinbase(Exchange, ImplicitAPI):
|
|
1474
1475
|
perpetualData = self.safe_list(perpetualFutures, 'products', [])
|
1475
1476
|
for i in range(0, len(perpetualData)):
|
1476
1477
|
result.append(self.parse_contract_market(perpetualData[i], perpetualFeeTier))
|
1477
|
-
|
1478
|
+
# remove aliases
|
1479
|
+
self.options['aliasCbMarketIds'] = {}
|
1480
|
+
newMarkets = []
|
1481
|
+
for i in range(0, len(result)):
|
1482
|
+
market = result[i]
|
1483
|
+
info = self.safe_value(market, 'info', {})
|
1484
|
+
realMarketIds = self.safe_list(info, 'alias_to', [])
|
1485
|
+
length = len(realMarketIds)
|
1486
|
+
if length > 0:
|
1487
|
+
self.options['aliasCbMarketIds'][market['id']] = realMarketIds[0]
|
1488
|
+
self.options['aliasCbMarketIds'][market['symbol']] = realMarketIds[0]
|
1489
|
+
else:
|
1490
|
+
newMarkets.append(market)
|
1491
|
+
return newMarkets
|
1492
|
+
|
1493
|
+
def market(self, symbol: str) -> MarketInterface:
|
1494
|
+
finalSymbol = self.safe_string(self.options['aliasCbMarketIds'], symbol, symbol)
|
1495
|
+
return super(coinbase, self).market(finalSymbol)
|
1496
|
+
|
1497
|
+
def safe_market(self, marketId: Str = None, market: Market = None, delimiter: Str = None, marketType: Str = None) -> MarketInterface:
|
1498
|
+
if marketId in self.options['aliasCbMarketIds']:
|
1499
|
+
return self.market(marketId)
|
1500
|
+
return super(coinbase, self).safe_market(marketId, market, delimiter, marketType)
|
1478
1501
|
|
1479
1502
|
def parse_spot_market(self, market, feeTier) -> MarketInterface:
|
1480
1503
|
#
|
@@ -1883,6 +1906,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
1883
1906
|
'withdraw': None,
|
1884
1907
|
'fee': None,
|
1885
1908
|
'precision': None,
|
1909
|
+
'networks': {},
|
1886
1910
|
'limits': {
|
1887
1911
|
'amount': {
|
1888
1912
|
'min': self.safe_number(currency, 'min_size'),
|
@@ -2194,10 +2218,11 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2194
2218
|
ask = self.safe_number(asks[0], 'price')
|
2195
2219
|
askVolume = self.safe_number(asks[0], 'size')
|
2196
2220
|
marketId = self.safe_string(ticker, 'product_id')
|
2221
|
+
market = self.safe_market(marketId, market)
|
2197
2222
|
last = self.safe_number(ticker, 'price')
|
2198
2223
|
datetime = self.safe_string(ticker, 'time')
|
2199
2224
|
return self.safe_ticker({
|
2200
|
-
'symbol':
|
2225
|
+
'symbol': market['symbol'],
|
2201
2226
|
'timestamp': self.parse8601(datetime),
|
2202
2227
|
'datetime': datetime,
|
2203
2228
|
'bid': bid,
|
@@ -4410,7 +4435,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
4410
4435
|
order = self.safe_dict(response, 'success_response', {})
|
4411
4436
|
return self.parse_order(order)
|
4412
4437
|
|
4413
|
-
async def fetch_positions(self, symbols: Strings = None, params={}):
|
4438
|
+
async def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
4414
4439
|
"""
|
4415
4440
|
fetch all open positions
|
4416
4441
|
|
ccxt/async_support/coincatch.py
CHANGED
@@ -90,6 +90,7 @@ class coincatch(Exchange, ImplicitAPI):
|
|
90
90
|
'fetchDepositAddress': True,
|
91
91
|
'fetchDeposits': True,
|
92
92
|
'fetchDepositsWithdrawals': False,
|
93
|
+
'fetchDepositWithdrawFees': True,
|
93
94
|
'fetchFundingHistory': False,
|
94
95
|
'fetchFundingRate': True,
|
95
96
|
'fetchFundingRateHistory': True,
|
@@ -724,6 +725,71 @@ class coincatch(Exchange, ImplicitAPI):
|
|
724
725
|
self.options['currencyIdsListForParseMarket'] = currenciesIds
|
725
726
|
return result
|
726
727
|
|
728
|
+
async def fetch_deposit_withdraw_fees(self, codes: Strings = None, params={}):
|
729
|
+
"""
|
730
|
+
fetch deposit and withdraw fees
|
731
|
+
|
732
|
+
https://coincatch.github.io/github.io/en/spot/#get-coin-list
|
733
|
+
|
734
|
+
:param str[] [codes]: list of unified currency codes
|
735
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
736
|
+
:returns dict: a list of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>`
|
737
|
+
"""
|
738
|
+
await self.load_markets()
|
739
|
+
response = await self.publicGetApiSpotV1PublicCurrencies(params)
|
740
|
+
data = self.safe_list(response, 'data', [])
|
741
|
+
return self.parse_deposit_withdraw_fees(data, codes, 'coinName')
|
742
|
+
|
743
|
+
def parse_deposit_withdraw_fee(self, fee, currency: Currency = None):
|
744
|
+
#
|
745
|
+
# {
|
746
|
+
# "coinId":"1",
|
747
|
+
# "coinName":"BTC",
|
748
|
+
# "transfer":"true",
|
749
|
+
# "chains":[
|
750
|
+
# {
|
751
|
+
# "chain":null,
|
752
|
+
# "needTag":"false",
|
753
|
+
# "withdrawable":"true",
|
754
|
+
# "rechargeAble":"true",
|
755
|
+
# "withdrawFee":"0.005",
|
756
|
+
# "depositConfirm":"1",
|
757
|
+
# "withdrawConfirm":"1",
|
758
|
+
# "minDepositAmount":"0.001",
|
759
|
+
# "minWithdrawAmount":"0.001",
|
760
|
+
# "browserUrl":"https://blockchair.com/bitcoin/testnet/transaction/"
|
761
|
+
# }
|
762
|
+
# ]
|
763
|
+
# }
|
764
|
+
#
|
765
|
+
chains = self.safe_list(fee, 'chains', [])
|
766
|
+
chainsLength = len(chains)
|
767
|
+
result: dict = {
|
768
|
+
'info': fee,
|
769
|
+
'withdraw': {
|
770
|
+
'fee': None,
|
771
|
+
'percentage': None,
|
772
|
+
},
|
773
|
+
'deposit': {
|
774
|
+
'fee': None,
|
775
|
+
'percentage': None,
|
776
|
+
},
|
777
|
+
'networks': {},
|
778
|
+
}
|
779
|
+
for i in range(0, chainsLength):
|
780
|
+
chain = chains[i]
|
781
|
+
networkId = self.safe_string(chain, 'chain')
|
782
|
+
currencyCode = self.safe_string(currency, 'code')
|
783
|
+
networkCode = self.network_id_to_code(networkId, currencyCode)
|
784
|
+
result['networks'][networkCode] = {
|
785
|
+
'deposit': {'fee': None, 'percentage': None},
|
786
|
+
'withdraw': {'fee': self.safe_number(chain, 'withdrawFee'), 'percentage': False},
|
787
|
+
}
|
788
|
+
if chainsLength == 1:
|
789
|
+
result['withdraw']['fee'] = self.safe_number(chain, 'withdrawFee')
|
790
|
+
result['withdraw']['percentage'] = False
|
791
|
+
return result
|
792
|
+
|
727
793
|
async def fetch_markets(self, params={}) -> List[Market]:
|
728
794
|
"""
|
729
795
|
retrieves data on all markets for the exchange
|