ccxt 4.4.75__py2.py3-none-any.whl → 4.4.77__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/binance.py CHANGED
@@ -1356,195 +1356,8 @@ class binance(Exchange, ImplicitAPI):
1356
1356
  'SPL': 'SOL', # temporarily keep support for SPL(old name)
1357
1357
  'SOL': 'SOL', # we shouldn't rename SOL
1358
1358
  },
1359
- # keeping self object for backward-compatibility
1360
- 'reverseNetworks': {
1361
- 'tronscan.org': 'TRC20',
1362
- 'etherscan.io': 'ERC20',
1363
- 'bscscan.com': 'BSC',
1364
- 'explorer.binance.org': 'BEP2',
1365
- 'bithomp.com': 'XRP',
1366
- 'bloks.io': 'EOS',
1367
- 'stellar.expert': 'XLM',
1368
- 'blockchair.com/bitcoin': 'BTC',
1369
- 'blockchair.com/bitcoin-cash': 'BCH',
1370
- 'blockchair.com/ecash': 'XEC',
1371
- 'explorer.litecoin.net': 'LTC',
1372
- 'explorer.avax.network': 'AVAX',
1373
- 'solscan.io': 'SOL',
1374
- 'polkadot.subscan.io': 'DOT',
1375
- 'dashboard.internetcomputer.org': 'ICP',
1376
- 'explorer.chiliz.com': 'CHZ',
1377
- 'cardanoscan.io': 'ADA',
1378
- 'mainnet.theoan.com': 'AION',
1379
- 'algoexplorer.io': 'ALGO',
1380
- 'explorer.ambrosus.com': 'AMB',
1381
- 'viewblock.io/zilliqa': 'ZIL',
1382
- 'viewblock.io/arweave': 'AR',
1383
- 'explorer.ark.io': 'ARK',
1384
- 'atomscan.com': 'ATOM',
1385
- 'www.mintscan.io': 'CTK',
1386
- 'explorer.bitcoindiamond.org': 'BCD',
1387
- 'btgexplorer.com': 'BTG',
1388
- 'bts.ai': 'BTS',
1389
- 'explorer.celo.org': 'CELO',
1390
- 'explorer.nervos.org': 'CKB',
1391
- 'cerebro.cortexlabs.ai': 'CTXC',
1392
- 'chainz.cryptoid.info': 'VIA',
1393
- 'explorer.dcrdata.org': 'DCR',
1394
- 'digiexplorer.info': 'DGB',
1395
- 'dock.subscan.io': 'DOCK',
1396
- 'dogechain.info': 'DOGE',
1397
- 'explorer.elrond.com': 'EGLD',
1398
- 'blockscout.com': 'ETC',
1399
- 'explore-fetchhub.fetch.ai': 'FET',
1400
- 'filfox.info': 'FIL',
1401
- 'fio.bloks.io': 'FIO',
1402
- 'explorer.firo.org': 'FIRO',
1403
- 'neoscan.io': 'NEO',
1404
- 'ftmscan.com': 'FTM',
1405
- 'explorer.gochain.io': 'GO',
1406
- 'block.gxb.io': 'GXS',
1407
- 'hash-hash.info': 'HBAR',
1408
- 'www.hiveblockexplorer.com': 'HIVE',
1409
- 'explorer.helium.com': 'HNT',
1410
- 'tracker.icon.foundation': 'ICX',
1411
- 'www.iostabc.com': 'IOST',
1412
- 'explorer.iota.org': 'IOTA',
1413
- 'iotexscan.io': 'IOTX',
1414
- 'irishub.iobscan.io': 'IRIS',
1415
- 'kava.mintscan.io': 'KAVA',
1416
- 'scope.klaytn.com': 'KLAY',
1417
- 'kmdexplorer.io': 'KMD',
1418
- 'kusama.subscan.io': 'KSM',
1419
- 'explorer.lto.network': 'LTO',
1420
- 'polygonscan.com': 'POLYGON',
1421
- 'explorer.ont.io': 'ONT',
1422
- 'minaexplorer.com': 'MINA',
1423
- 'nanolooker.com': 'NANO',
1424
- 'explorer.nebulas.io': 'NAS',
1425
- 'explorer.nbs.plus': 'NBS',
1426
- 'explorer.nebl.io': 'NEBL',
1427
- 'nulscan.io': 'NULS',
1428
- 'nxscan.com': 'NXS',
1429
- 'explorer.harmony.one': 'ONE',
1430
- 'explorer.poa.network': 'POA',
1431
- 'qtum.info': 'QTUM',
1432
- 'explorer.rsk.co': 'RSK',
1433
- 'www.oasisscan.com': 'ROSE',
1434
- 'ravencoin.network': 'RVN',
1435
- 'sc.tokenview.com': 'SC',
1436
- 'secretnodes.com': 'SCRT',
1437
- 'explorer.skycoin.com': 'SKY',
1438
- 'steemscan.com': 'STEEM',
1439
- 'explorer.stacks.co': 'STX',
1440
- 'www.thetascan.io': 'THETA',
1441
- 'scan.tomochain.com': 'TOMO',
1442
- 'explore.vechain.org': 'VET',
1443
- 'explorer.vite.net': 'VITE',
1444
- 'www.wanscan.org': 'WAN',
1445
- 'wavesexplorer.com': 'WAVES',
1446
- 'wax.eosx.io': 'WAXP',
1447
- 'waltonchain.pro': 'WTC',
1448
- 'chain.nem.ninja': 'XEM',
1449
- 'verge-blockchain.info': 'XVG',
1450
- 'explorer.yoyow.org': 'YOYOW',
1451
- 'explorer.zcha.in': 'ZEC',
1452
- 'explorer.zensystem.io': 'ZEN',
1453
- },
1454
1359
  'networksById': {
1455
1360
  'SOL': 'SOL', # temporary fix for SPL definition
1456
- 'tronscan.org': 'TRC20',
1457
- 'etherscan.io': 'ERC20',
1458
- 'bscscan.com': 'BSC',
1459
- 'explorer.binance.org': 'BEP2',
1460
- 'bithomp.com': 'XRP',
1461
- 'bloks.io': 'EOS',
1462
- 'stellar.expert': 'XLM',
1463
- 'blockchair.com/bitcoin': 'BTC',
1464
- 'blockchair.com/bitcoin-cash': 'BCH',
1465
- 'blockchair.com/ecash': 'XEC',
1466
- 'explorer.litecoin.net': 'LTC',
1467
- 'explorer.avax.network': 'AVAX',
1468
- 'solscan.io': 'SOL',
1469
- 'polkadot.subscan.io': 'DOT',
1470
- 'dashboard.internetcomputer.org': 'ICP',
1471
- 'explorer.chiliz.com': 'CHZ',
1472
- 'cardanoscan.io': 'ADA',
1473
- 'mainnet.theoan.com': 'AION',
1474
- 'algoexplorer.io': 'ALGO',
1475
- 'explorer.ambrosus.com': 'AMB',
1476
- 'viewblock.io/zilliqa': 'ZIL',
1477
- 'viewblock.io/arweave': 'AR',
1478
- 'explorer.ark.io': 'ARK',
1479
- 'atomscan.com': 'ATOM',
1480
- 'www.mintscan.io': 'CTK',
1481
- 'explorer.bitcoindiamond.org': 'BCD',
1482
- 'btgexplorer.com': 'BTG',
1483
- 'bts.ai': 'BTS',
1484
- 'explorer.celo.org': 'CELO',
1485
- 'explorer.nervos.org': 'CKB',
1486
- 'cerebro.cortexlabs.ai': 'CTXC',
1487
- 'chainz.cryptoid.info': 'VIA',
1488
- 'explorer.dcrdata.org': 'DCR',
1489
- 'digiexplorer.info': 'DGB',
1490
- 'dock.subscan.io': 'DOCK',
1491
- 'dogechain.info': 'DOGE',
1492
- 'explorer.elrond.com': 'EGLD',
1493
- 'blockscout.com': 'ETC',
1494
- 'explore-fetchhub.fetch.ai': 'FET',
1495
- 'filfox.info': 'FIL',
1496
- 'fio.bloks.io': 'FIO',
1497
- 'explorer.firo.org': 'FIRO',
1498
- 'neoscan.io': 'NEO',
1499
- 'ftmscan.com': 'FTM',
1500
- 'explorer.gochain.io': 'GO',
1501
- 'block.gxb.io': 'GXS',
1502
- 'hash-hash.info': 'HBAR',
1503
- 'www.hiveblockexplorer.com': 'HIVE',
1504
- 'explorer.helium.com': 'HNT',
1505
- 'tracker.icon.foundation': 'ICX',
1506
- 'www.iostabc.com': 'IOST',
1507
- 'explorer.iota.org': 'IOTA',
1508
- 'iotexscan.io': 'IOTX',
1509
- 'irishub.iobscan.io': 'IRIS',
1510
- 'kava.mintscan.io': 'KAVA',
1511
- 'scope.klaytn.com': 'KLAY',
1512
- 'kmdexplorer.io': 'KMD',
1513
- 'kusama.subscan.io': 'KSM',
1514
- 'explorer.lto.network': 'LTO',
1515
- 'polygonscan.com': 'POLYGON',
1516
- 'explorer.ont.io': 'ONT',
1517
- 'minaexplorer.com': 'MINA',
1518
- 'nanolooker.com': 'NANO',
1519
- 'explorer.nebulas.io': 'NAS',
1520
- 'explorer.nbs.plus': 'NBS',
1521
- 'explorer.nebl.io': 'NEBL',
1522
- 'nulscan.io': 'NULS',
1523
- 'nxscan.com': 'NXS',
1524
- 'explorer.harmony.one': 'ONE',
1525
- 'explorer.poa.network': 'POA',
1526
- 'qtum.info': 'QTUM',
1527
- 'explorer.rsk.co': 'RSK',
1528
- 'www.oasisscan.com': 'ROSE',
1529
- 'ravencoin.network': 'RVN',
1530
- 'sc.tokenview.com': 'SC',
1531
- 'secretnodes.com': 'SCRT',
1532
- 'explorer.skycoin.com': 'SKY',
1533
- 'steemscan.com': 'STEEM',
1534
- 'explorer.stacks.co': 'STX',
1535
- 'www.thetascan.io': 'THETA',
1536
- 'scan.tomochain.com': 'TOMO',
1537
- 'explore.vechain.org': 'VET',
1538
- 'explorer.vite.net': 'VITE',
1539
- 'www.wanscan.org': 'WAN',
1540
- 'wavesexplorer.com': 'WAVES',
1541
- 'wax.eosx.io': 'WAXP',
1542
- 'waltonchain.pro': 'WTC',
1543
- 'chain.nem.ninja': 'XEM',
1544
- 'verge-blockchain.info': 'XVG',
1545
- 'explorer.yoyow.org': 'YOYOW',
1546
- 'explorer.zcha.in': 'ZEC',
1547
- 'explorer.zensystem.io': 'ZEN',
1548
1361
  },
1549
1362
  'impliedNetworks': {
1550
1363
  'ETH': {'ERC20': 'ETH'},
@@ -8706,39 +8519,19 @@ class binance(Exchange, ImplicitAPI):
8706
8519
  def parse_deposit_address(self, response, currency: Currency = None) -> DepositAddress:
8707
8520
  #
8708
8521
  # {
8709
- # "currency": "XRP",
8522
+ # "coin": "XRP",
8710
8523
  # "address": "rEb8TK3gBgk5auZkwc6sHnwrGVJH8DuaLh",
8711
8524
  # "tag": "108618262",
8712
- # "info": {
8713
- # "coin": "XRP",
8714
- # "address": "rEb8TK3gBgk5auZkwc6sHnwrGVJH8DuaLh",
8715
- # "tag": "108618262",
8716
- # "url": "https://bithomp.com/explorer/rEb8TK3gBgk5auZkwc6sHnwrGVJH8DuaLh"
8717
- # }
8525
+ # "url": "https://bithomp.com/explorer/rEb8TK3gBgk5auZkwc6sHnwrGVJH8DuaLh"
8718
8526
  # }
8719
8527
  #
8720
- info = self.safe_dict(response, 'info', {})
8721
- url = self.safe_string(info, 'url')
8528
+ url = self.safe_string(response, 'url')
8722
8529
  address = self.safe_string(response, 'address')
8723
8530
  currencyId = self.safe_string(response, 'currency')
8724
8531
  code = self.safe_currency_code(currencyId, currency)
8725
- impliedNetwork = None
8726
- if url is not None:
8727
- reverseNetworks = self.safe_dict(self.options, 'reverseNetworks', {})
8728
- parts = url.split('/')
8729
- topLevel = self.safe_string(parts, 2)
8730
- if (topLevel == 'blockchair.com') or (topLevel == 'viewblock.io'):
8731
- subLevel = self.safe_string(parts, 3)
8732
- if subLevel is not None:
8733
- topLevel = topLevel + '/' + subLevel
8734
- impliedNetwork = self.safe_string(reverseNetworks, topLevel)
8735
- impliedNetworks = self.safe_dict(self.options, 'impliedNetworks', {
8736
- 'ETH': {'ERC20': 'ETH'},
8737
- 'TRX': {'TRC20': 'TRX'},
8738
- })
8739
- if code in impliedNetworks:
8740
- conversion = self.safe_dict(impliedNetworks, code, {})
8741
- impliedNetwork = self.safe_string(conversion, impliedNetwork, impliedNetwork)
8532
+ # deposit-address endpoint provides only network url(not network ID/CODE)
8533
+ # so we should map the url to network(their data is inside currencies)
8534
+ networkCode = self.get_network_code_by_network_url(code, url)
8742
8535
  tag = self.safe_string(response, 'tag', '')
8743
8536
  if len(tag) == 0:
8744
8537
  tag = None
@@ -8746,7 +8539,7 @@ class binance(Exchange, ImplicitAPI):
8746
8539
  return {
8747
8540
  'info': response,
8748
8541
  'currency': code,
8749
- 'network': impliedNetwork,
8542
+ 'network': networkCode,
8750
8543
  'address': address,
8751
8544
  'tag': tag,
8752
8545
  }
@@ -11294,6 +11087,35 @@ class binance(Exchange, ImplicitAPI):
11294
11087
  }
11295
11088
  return self.safe_string(ledgerType, type, type)
11296
11089
 
11090
+ def get_network_code_by_network_url(self, currencyCode: str, depositUrl: Str = None) -> Str:
11091
+ # depositUrl is like : https://bscscan.com/address/0xEF238AB229342849..
11092
+ if depositUrl is None:
11093
+ return None
11094
+ networkCode = None
11095
+ currency = self.currency(currencyCode)
11096
+ networks = self.safe_dict(currency, 'networks', {})
11097
+ networkCodes = list(networks.keys())
11098
+ for i in range(0, len(networkCodes)):
11099
+ currentNetworkCode = networkCodes[i]
11100
+ info = self.safe_dict(networks[currentNetworkCode], 'info', {})
11101
+ siteUrl = self.safe_string(info, 'contractAddressUrl')
11102
+ # check if url matches the field's value
11103
+ if siteUrl is not None and depositUrl.startswith(self.get_base_domain_from_url(siteUrl)):
11104
+ networkCode = currentNetworkCode
11105
+ return networkCode
11106
+
11107
+ def get_base_domain_from_url(self, url: Str) -> Str:
11108
+ if url is None:
11109
+ return None
11110
+ urlParts = url.split('/')
11111
+ scheme = self.safe_string(urlParts, 0)
11112
+ if scheme is None:
11113
+ return None
11114
+ domain = self.safe_string(urlParts, 2)
11115
+ if domain is None:
11116
+ return None
11117
+ return scheme + '//' + domain + '/'
11118
+
11297
11119
  def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
11298
11120
  urls = self.urls
11299
11121
  if not (api in urls['api']):
ccxt/bitget.py CHANGED
@@ -3218,7 +3218,7 @@ class bitget(Exchange, ImplicitAPI):
3218
3218
  else:
3219
3219
  request['businessType'] = 'spot'
3220
3220
  else:
3221
- request['businessType'] = 'contract'
3221
+ request['businessType'] = 'mix'
3222
3222
  response = self.privateCommonGetV2CommonTradeRate(self.extend(request, params))
3223
3223
  #
3224
3224
  # {
ccxt/bitrue.py CHANGED
@@ -50,20 +50,32 @@ class bitrue(Exchange, ImplicitAPI):
50
50
  'swap': True,
51
51
  'future': False,
52
52
  'option': False,
53
+ 'addMargin': False,
54
+ 'borrowCrossMargin': False,
55
+ 'borrowIsolatedMargin': False,
56
+ 'borrowMargin': False,
53
57
  'cancelAllOrders': True,
54
58
  'cancelOrder': True,
59
+ 'closeAllPositions': False,
60
+ 'closePosition': False,
55
61
  'createMarketBuyOrderWithCost': True,
56
62
  'createMarketOrderWithCost': False,
57
63
  'createMarketSellOrderWithCost': False,
58
64
  'createOrder': True,
65
+ 'createOrderWithTakeProfitAndStopLoss': False,
66
+ 'createOrderWithTakeProfitAndStopLossWs': False,
59
67
  'createReduceOnlyOrder': True,
60
68
  'createStopLimitOrder': True,
61
69
  'createStopMarketOrder': True,
62
70
  'createStopOrder': True,
63
71
  'fetchBalance': True,
64
72
  'fetchBidsAsks': True,
73
+ 'fetchBorrowInterest': False,
74
+ 'fetchBorrowRate': False,
65
75
  'fetchBorrowRateHistories': False,
66
76
  'fetchBorrowRateHistory': False,
77
+ 'fetchBorrowRates': False,
78
+ 'fetchBorrowRatesPerSymbol': False,
67
79
  'fetchClosedOrders': True,
68
80
  'fetchCrossBorrowRate': False,
69
81
  'fetchCrossBorrowRates': False,
@@ -74,20 +86,50 @@ class bitrue(Exchange, ImplicitAPI):
74
86
  'fetchDepositWithdrawFee': 'emulated',
75
87
  'fetchDepositWithdrawFees': True,
76
88
  'fetchFundingHistory': False,
89
+ 'fetchFundingInterval': False,
90
+ 'fetchFundingIntervals': False,
77
91
  'fetchFundingRate': False,
78
92
  'fetchFundingRateHistory': False,
79
93
  'fetchFundingRates': False,
94
+ 'fetchGreeks': False,
95
+ 'fetchIndexOHLCV': False,
80
96
  'fetchIsolatedBorrowRate': False,
81
97
  'fetchIsolatedBorrowRates': False,
98
+ 'fetchIsolatedPositions': False,
99
+ 'fetchLeverage': False,
100
+ 'fetchLeverages': False,
101
+ 'fetchLeverageTiers': False,
102
+ 'fetchLiquidations': False,
103
+ 'fetchLongShortRatio': False,
104
+ 'fetchLongShortRatioHistory': False,
105
+ 'fetchMarginAdjustmentHistory': False,
82
106
  'fetchMarginMode': False,
107
+ 'fetchMarginModes': False,
108
+ 'fetchMarketLeverageTiers': False,
83
109
  'fetchMarkets': True,
110
+ 'fetchMarkOHLCV': False,
111
+ 'fetchMarkPrices': False,
112
+ 'fetchMyLiquidations': False,
113
+ 'fetchMySettlementHistory': False,
84
114
  'fetchMyTrades': True,
85
115
  'fetchOHLCV': True,
116
+ 'fetchOpenInterest': False,
117
+ 'fetchOpenInterestHistory': False,
118
+ 'fetchOpenInterests': False,
86
119
  'fetchOpenOrders': True,
120
+ 'fetchOption': False,
121
+ 'fetchOptionChain': False,
87
122
  'fetchOrder': True,
88
123
  'fetchOrderBook': True,
89
124
  'fetchOrders': False,
125
+ 'fetchPosition': False,
126
+ 'fetchPositionHistory': False,
90
127
  'fetchPositionMode': False,
128
+ 'fetchPositions': False,
129
+ 'fetchPositionsHistory': False,
130
+ 'fetchPositionsRisk': False,
131
+ 'fetchPremiumIndexOHLCV': False,
132
+ 'fetchSettlementHistory': False,
91
133
  'fetchStatus': True,
92
134
  'fetchTicker': True,
93
135
  'fetchTickers': True,
@@ -98,9 +140,15 @@ class bitrue(Exchange, ImplicitAPI):
98
140
  'fetchTransactionFees': False,
99
141
  'fetchTransactions': False,
100
142
  'fetchTransfers': True,
143
+ 'fetchVolatilityHistory': False,
101
144
  'fetchWithdrawals': True,
145
+ 'reduceMargin': False,
146
+ 'repayCrossMargin': False,
147
+ 'repayIsolatedMargin': False,
102
148
  'setLeverage': True,
103
149
  'setMargin': True,
150
+ 'setMarginMode': False,
151
+ 'setPositionMode': False,
104
152
  'transfer': True,
105
153
  'withdraw': True,
106
154
  },
ccxt/coinex.py CHANGED
@@ -762,6 +762,8 @@ class coinex(Exchange, ImplicitAPI):
762
762
  for j in range(0, len(chains)):
763
763
  chain = chains[j]
764
764
  networkId = self.safe_string(chain, 'chain')
765
+ if networkId is None:
766
+ continue
765
767
  precisionString = self.parse_precision(self.safe_string(chain, 'withdrawal_precision'))
766
768
  feeString = self.safe_string(chain, 'withdrawal_fee')
767
769
  minNetworkDepositString = self.safe_string(chain, 'min_deposit_amount')
ccxt/coinlist.py CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.coinlist import ImplicitAPI
8
8
  import hashlib
9
9
  import math
10
- from ccxt.base.types import Account, Any, Balances, Currencies, Currency, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
10
+ from ccxt.base.types import Account, Any, Balances, Currencies, Currency, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, Trade, TradingFees, Transaction, TransferEntry
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import AuthenticationError
@@ -79,7 +79,7 @@ class coinlist(Exchange, ImplicitAPI):
79
79
  'fetchDepositWithdrawFee': False,
80
80
  'fetchDepositWithdrawFees': False,
81
81
  'fetchFundingHistory': False,
82
- 'fetchFundingRate': False,
82
+ 'fetchFundingRate': True,
83
83
  'fetchFundingRateHistory': False,
84
84
  'fetchFundingRates': False,
85
85
  'fetchIndexOHLCV': False,
@@ -2405,6 +2405,89 @@ class coinlist(Exchange, ImplicitAPI):
2405
2405
  }
2406
2406
  return self.safe_string(types, type, type)
2407
2407
 
2408
+ def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
2409
+ """
2410
+ fetch the current funding rate
2411
+
2412
+ https://trade-docs.coinlist.co/#coinlist-pro-api-Funding-Rates
2413
+
2414
+ :param str symbol: unified market symbol
2415
+ :param dict [params]: extra parameters specific to the exchange API endpoint
2416
+ :returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
2417
+ """
2418
+ self.load_markets()
2419
+ market = self.market(symbol)
2420
+ if not market['swap']:
2421
+ raise BadSymbol(self.id + ' fetchFundingRate() supports swap contracts only')
2422
+ request: dict = {
2423
+ 'symbol': market['id'],
2424
+ }
2425
+ response = self.publicGetV1SymbolsSymbolFunding(self.extend(request, params))
2426
+ #
2427
+ # {
2428
+ # "last": {
2429
+ # "funding_rate": "-0.00043841",
2430
+ # "funding_time": "2025-04-15T04:00:00.000Z"
2431
+ # },
2432
+ # "next": {
2433
+ # "funding_rate": "-0.00046952",
2434
+ # "funding_time": "2025-04-15T12:00:00.000Z"
2435
+ # },
2436
+ # "indicative": {
2437
+ # "funding_rate": "-0.00042517",
2438
+ # "funding_time": "2025-04-15T20:00:00.000Z"
2439
+ # },
2440
+ # "timestamp": "2025-04-15T07:01:15.219Z"
2441
+ # }
2442
+ #
2443
+ return self.parse_funding_rate(response, market)
2444
+
2445
+ def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
2446
+ #
2447
+ # {
2448
+ # "last": {
2449
+ # "funding_rate": "-0.00043841",
2450
+ # "funding_time": "2025-04-15T04:00:00.000Z"
2451
+ # },
2452
+ # "next": {
2453
+ # "funding_rate": "-0.00046952",
2454
+ # "funding_time": "2025-04-15T12:00:00.000Z"
2455
+ # },
2456
+ # "indicative": {
2457
+ # "funding_rate": "-0.00042517",
2458
+ # "funding_time": "2025-04-15T20:00:00.000Z"
2459
+ # },
2460
+ # "timestamp": "2025-04-15T07:01:15.219Z"
2461
+ # }
2462
+ #
2463
+ previous = self.safe_dict(contract, 'last', {})
2464
+ current = self.safe_dict(contract, 'next', {})
2465
+ next = self.safe_dict(contract, 'indicative', {})
2466
+ previousDatetime = self.safe_string(previous, 'funding_time')
2467
+ currentDatetime = self.safe_string(current, 'funding_time')
2468
+ nextDatetime = self.safe_string(next, 'funding_time')
2469
+ datetime = self.safe_string(contract, 'timestamp')
2470
+ return {
2471
+ 'info': contract,
2472
+ 'symbol': self.safe_symbol(None, market),
2473
+ 'markPrice': None,
2474
+ 'indexPrice': None,
2475
+ 'interestRate': None,
2476
+ 'estimatedSettlePrice': None,
2477
+ 'timestamp': self.parse8601(datetime),
2478
+ 'datetime': datetime,
2479
+ 'fundingRate': self.safe_number(current, 'funding_rate'),
2480
+ 'fundingTimestamp': self.parse8601(currentDatetime),
2481
+ 'fundingDatetime': currentDatetime,
2482
+ 'nextFundingRate': self.safe_number(next, 'funding_rate'),
2483
+ 'nextFundingTimestamp': self.parse8601(nextDatetime),
2484
+ 'nextFundingDatetime': nextDatetime,
2485
+ 'previousFundingRate': self.safe_number(previous, 'funding_rate'),
2486
+ 'previousFundingTimestamp': self.parse8601(previousDatetime),
2487
+ 'previousFundingDatetime': previousDatetime,
2488
+ 'interval': '8h',
2489
+ }
2490
+
2408
2491
  def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
2409
2492
  request = self.omit(params, self.extract_params(path))
2410
2493
  endpoint = '/' + self.implode_params(path, params)
ccxt/okx.py CHANGED
@@ -397,6 +397,7 @@ class okx(Exchange, ImplicitAPI):
397
397
  'asset/subaccount/managed-subaccount-bills': 5 / 3,
398
398
  'users/entrust-subaccount-list': 10,
399
399
  'account/subaccount/interest-limits': 4,
400
+ 'users/subaccount/apikey': 10,
400
401
  # grid trading
401
402
  'tradingBot/grid/orders-algo-pending': 1,
402
403
  'tradingBot/grid/orders-algo-history': 1,
@@ -529,6 +530,9 @@ class okx(Exchange, ImplicitAPI):
529
530
  'asset/subaccount/transfer': 10,
530
531
  'users/subaccount/set-transfer-out': 10,
531
532
  'account/subaccount/set-loan-allocation': 4,
533
+ 'users/subaccount/create-subaccount': 10,
534
+ 'users/subaccount/subaccount-apikey': 10,
535
+ 'users/subaccount/delete-apikey': 10,
532
536
  # grid trading
533
537
  'tradingBot/grid/order-algo': 1,
534
538
  'tradingBot/grid/amend-order-algo': 1,
@@ -939,6 +943,11 @@ class okx(Exchange, ImplicitAPI):
939
943
  '59506': ExchangeError, # APIKey does not exist
940
944
  '59507': ExchangeError, # The two accounts involved in a transfer must be two different sub accounts under the same parent account
941
945
  '59508': AccountSuspended, # The sub account of {0} is suspended
946
+ '59515': ExchangeError, # You are currently not on the custody whitelist. Please contact customer service for assistance.
947
+ '59516': ExchangeError, # Please create the Copper custody funding account first.
948
+ '59517': ExchangeError, # Please create the Komainu custody funding account first.
949
+ '59518': ExchangeError, # You can’t create a sub-account using the API; please use the app or web.
950
+ '59519': ExchangeError, # You can’t use self function/feature while it's frozen, due to: {freezereason}
942
951
  '59642': BadRequest, # Lead and copy traders can only use margin-free or single-currency margin account modes
943
952
  '59643': ExchangeError, # Couldn’t switch account modes’re currently copying spot trades
944
953
  # WebSocket error Codes from 60000-63999
@@ -1607,8 +1616,8 @@ class okx(Exchange, ImplicitAPI):
1607
1616
  swap = (type == 'swap')
1608
1617
  option = (type == 'option')
1609
1618
  contract = swap or future or option
1610
- baseId = self.safe_string(market, 'baseCcy')
1611
- quoteId = self.safe_string(market, 'quoteCcy')
1619
+ baseId = self.safe_string(market, 'baseCcy', '') # defaulting to '' because some weird preopen markets have empty baseId
1620
+ quoteId = self.safe_string(market, 'quoteCcy', '')
1612
1621
  settleId = self.safe_string(market, 'settleCcy')
1613
1622
  settle = self.safe_currency_code(settleId)
1614
1623
  underlying = self.safe_string(market, 'uly')
@@ -1623,18 +1632,21 @@ class okx(Exchange, ImplicitAPI):
1623
1632
  strikePrice = None
1624
1633
  optionType = None
1625
1634
  if contract:
1626
- symbol = symbol + ':' + settle
1635
+ if settle is not None:
1636
+ symbol = symbol + ':' + settle
1627
1637
  if future:
1628
1638
  expiry = self.safe_integer(market, 'expTime')
1629
- ymd = self.yymmdd(expiry)
1630
- symbol = symbol + '-' + ymd
1639
+ if expiry is not None:
1640
+ ymd = self.yymmdd(expiry)
1641
+ symbol = symbol + '-' + ymd
1631
1642
  elif option:
1632
1643
  expiry = self.safe_integer(market, 'expTime')
1633
1644
  strikePrice = self.safe_string(market, 'stk')
1634
1645
  optionType = self.safe_string(market, 'optType')
1635
- ymd = self.yymmdd(expiry)
1636
- symbol = symbol + '-' + ymd + '-' + strikePrice + '-' + optionType
1637
- optionType = 'put' if (optionType == 'P') else 'call'
1646
+ if expiry is not None:
1647
+ ymd = self.yymmdd(expiry)
1648
+ symbol = symbol + '-' + ymd + '-' + strikePrice + '-' + optionType
1649
+ optionType = 'put' if (optionType == 'P') else 'call'
1638
1650
  tickSize = self.safe_string(market, 'tickSz')
1639
1651
  fees = self.safe_dict_2(self.fees, type, 'trading', {})
1640
1652
  maxLeverage = self.safe_string(market, 'lever', '1')
ccxt/paradex.py CHANGED
@@ -703,14 +703,9 @@ class paradex(Exchange, ImplicitAPI):
703
703
  """
704
704
  self.load_markets()
705
705
  symbols = self.market_symbols(symbols)
706
- request: dict = {}
707
- if symbols is not None:
708
- if isinstance(symbols, list):
709
- request['market'] = self.market_id(symbols[0])
710
- else:
711
- request['market'] = self.market_id(symbols)
712
- else:
713
- request['market'] = 'ALL'
706
+ request: dict = {
707
+ 'market': 'ALL',
708
+ }
714
709
  response = self.publicGetMarketsSummary(self.extend(request, params))
715
710
  #
716
711
  # {
ccxt/pro/__init__.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.75'
7
+ __version__ = '4.4.77'
8
8
 
9
9
  # ----------------------------------------------------------------------------
10
10
 
ccxt/pro/hyperliquid.py CHANGED
@@ -614,7 +614,7 @@ class hyperliquid(ccxt.async_support.hyperliquid):
614
614
  'datetime': self.iso8601(timestamp),
615
615
  'symbol': symbol,
616
616
  'id': id,
617
- 'order': None,
617
+ 'order': self.safe_string(trade, 'oid'),
618
618
  'type': None,
619
619
  'side': side,
620
620
  'takerOrMaker': None,