ccxt 4.4.90__py2.py3-none-any.whl → 4.4.92__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 +1 -3
- ccxt/abstract/lbank.py +1 -0
- ccxt/async_support/__init__.py +1 -3
- ccxt/async_support/base/exchange.py +6 -3
- ccxt/async_support/base/ws/client.py +173 -64
- ccxt/async_support/base/ws/future.py +23 -50
- ccxt/async_support/binance.py +1 -1
- ccxt/async_support/bitmart.py +7 -0
- ccxt/async_support/bitmex.py +2 -1
- ccxt/async_support/bitvavo.py +7 -1
- ccxt/async_support/cex.py +61 -0
- ccxt/async_support/cryptocom.py +17 -2
- ccxt/async_support/cryptomus.py +1 -1
- ccxt/async_support/exmo.py +25 -10
- ccxt/async_support/gate.py +2 -2
- ccxt/async_support/htx.py +1 -1
- ccxt/async_support/hyperliquid.py +104 -53
- ccxt/async_support/kraken.py +26 -1
- ccxt/async_support/krakenfutures.py +1 -1
- ccxt/async_support/lbank.py +113 -33
- ccxt/async_support/mexc.py +1 -0
- ccxt/async_support/modetrade.py +2 -2
- ccxt/async_support/okx.py +2 -2
- ccxt/async_support/paradex.py +1 -1
- ccxt/base/exchange.py +22 -23
- ccxt/base/types.py +1 -0
- ccxt/binance.py +1 -1
- ccxt/bitmart.py +7 -0
- ccxt/bitmex.py +2 -1
- ccxt/bitvavo.py +7 -1
- ccxt/cex.py +61 -0
- ccxt/cryptocom.py +17 -2
- ccxt/cryptomus.py +1 -1
- ccxt/exmo.py +24 -10
- ccxt/gate.py +2 -2
- ccxt/htx.py +1 -1
- ccxt/hyperliquid.py +104 -53
- ccxt/kraken.py +26 -1
- ccxt/krakenfutures.py +1 -1
- ccxt/lbank.py +113 -33
- ccxt/mexc.py +1 -0
- ccxt/modetrade.py +2 -2
- ccxt/okx.py +2 -2
- ccxt/paradex.py +1 -1
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/bitstamp.py +1 -1
- ccxt/pro/bybit.py +9 -140
- ccxt/pro/kraken.py +246 -258
- ccxt/pro/mexc.py +0 -1
- {ccxt-4.4.90.dist-info → ccxt-4.4.92.dist-info}/METADATA +6 -7
- {ccxt-4.4.90.dist-info → ccxt-4.4.92.dist-info}/RECORD +54 -71
- ccxt/abstract/coinlist.py +0 -57
- ccxt/async_support/base/ws/aiohttp_client.py +0 -147
- ccxt/async_support/bitcoincom.py +0 -18
- ccxt/async_support/bitfinex1.py +0 -1711
- ccxt/async_support/bitpanda.py +0 -17
- ccxt/async_support/coinlist.py +0 -2542
- ccxt/async_support/poloniexfutures.py +0 -1875
- ccxt/bitcoincom.py +0 -18
- ccxt/bitfinex1.py +0 -1710
- ccxt/bitpanda.py +0 -17
- ccxt/coinlist.py +0 -2542
- ccxt/poloniexfutures.py +0 -1875
- ccxt/pro/bitcoincom.py +0 -35
- ccxt/pro/bitfinex1.py +0 -635
- ccxt/pro/bitpanda.py +0 -16
- ccxt/pro/poloniexfutures.py +0 -1004
- ccxt/pro/wazirx.py +0 -766
- {ccxt-4.4.90.dist-info → ccxt-4.4.92.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.90.dist-info → ccxt-4.4.92.dist-info}/WHEEL +0 -0
- {ccxt-4.4.90.dist-info → ccxt-4.4.92.dist-info}/top_level.txt +0 -0
ccxt/async_support/lbank.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.lbank import ImplicitAPI
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
|
-
from ccxt.base.types import Any, Balances, Currency, DepositAddress, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFeeInterface, TradingFees, Transaction
|
10
|
+
from ccxt.base.types import Any, Balances, Currencies, Currency, DepositAddress, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFeeInterface, TradingFees, Transaction
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import AuthenticationError
|
@@ -62,6 +62,7 @@ class lbank(Exchange, ImplicitAPI):
|
|
62
62
|
'fetchClosedOrders': False,
|
63
63
|
'fetchCrossBorrowRate': False,
|
64
64
|
'fetchCrossBorrowRates': False,
|
65
|
+
'fetchCurrencies': True,
|
65
66
|
'fetchDepositAddress': True,
|
66
67
|
'fetchDepositAddresses': False,
|
67
68
|
'fetchDepositAddressesByNetwork': False,
|
@@ -136,6 +137,7 @@ class lbank(Exchange, ImplicitAPI):
|
|
136
137
|
'currencyPairs': 2.5,
|
137
138
|
'accuracy': 2.5,
|
138
139
|
'usdToCny': 2.5,
|
140
|
+
'assetConfigs': 2.5,
|
139
141
|
'withdrawConfigs': 2.5,
|
140
142
|
'timestamp': 2.5,
|
141
143
|
'ticker/24hr': 2.5,
|
@@ -222,6 +224,7 @@ class lbank(Exchange, ImplicitAPI):
|
|
222
224
|
},
|
223
225
|
},
|
224
226
|
'commonCurrencies': {
|
227
|
+
'XBT': 'XBT', # not BTC!
|
225
228
|
'HIT': 'Hiver',
|
226
229
|
'VET_ERC20': 'VEN',
|
227
230
|
'PNT': 'Penta',
|
@@ -289,21 +292,12 @@ class lbank(Exchange, ImplicitAPI):
|
|
289
292
|
# ptx: 1
|
290
293
|
# }
|
291
294
|
},
|
292
|
-
'
|
295
|
+
'networksById': {
|
293
296
|
'erc20': 'ERC20',
|
294
297
|
'trc20': 'TRC20',
|
295
|
-
'
|
296
|
-
'
|
297
|
-
'bep20
|
298
|
-
'bep20': 'BSC',
|
299
|
-
'heco': 'HT',
|
300
|
-
'bep2': 'BNB',
|
301
|
-
'btc': 'BTC',
|
302
|
-
'dogecoin': 'DOGE',
|
303
|
-
'matic': 'MATIC',
|
304
|
-
'oec': 'OEC',
|
305
|
-
'btctron': 'BTCTRON',
|
306
|
-
'xrp': 'XRP',
|
298
|
+
'TRX': 'TRC20',
|
299
|
+
'bep20(bsc)': 'BEP20',
|
300
|
+
'bep20': 'BEP20',
|
307
301
|
},
|
308
302
|
'defaultNetworks': {
|
309
303
|
'USDT': 'TRC20',
|
@@ -424,6 +418,104 @@ class lbank(Exchange, ImplicitAPI):
|
|
424
418
|
#
|
425
419
|
return self.safe_integer(response, 'data')
|
426
420
|
|
421
|
+
async def fetch_currencies(self, params={}) -> Currencies:
|
422
|
+
"""
|
423
|
+
fetches all available currencies on an exchange
|
424
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
425
|
+
:returns dict: an associative dictionary of currencies
|
426
|
+
"""
|
427
|
+
response = await self.spotPublicGetWithdrawConfigs(params)
|
428
|
+
#
|
429
|
+
# {
|
430
|
+
# "msg": "Success",
|
431
|
+
# "result": "true",
|
432
|
+
# "data": [
|
433
|
+
# {
|
434
|
+
# "amountScale": "4",
|
435
|
+
# "chain": "bep20(bsc)",
|
436
|
+
# "assetCode": "usdt",
|
437
|
+
# "min": "10",
|
438
|
+
# "transferAmtScale": "4",
|
439
|
+
# "canWithDraw": True,
|
440
|
+
# "fee": "0.0000",
|
441
|
+
# "minTransfer": "0.0001",
|
442
|
+
# "type": "1"
|
443
|
+
# },
|
444
|
+
# {
|
445
|
+
# "amountScale": "4",
|
446
|
+
# "chain": "trc20",
|
447
|
+
# "assetCode": "usdt",
|
448
|
+
# "min": "1",
|
449
|
+
# "transferAmtScale": "4",
|
450
|
+
# "canWithDraw": True,
|
451
|
+
# "fee": "1.0000",
|
452
|
+
# "minTransfer": "0.0001",
|
453
|
+
# "type": "1"
|
454
|
+
# },
|
455
|
+
# ...
|
456
|
+
# ],
|
457
|
+
# "error_code": "0",
|
458
|
+
# "ts": "1747973911431"
|
459
|
+
# }
|
460
|
+
#
|
461
|
+
currenciesData = self.safe_list(response, 'data', [])
|
462
|
+
grouped = self.group_by(currenciesData, 'assetCode')
|
463
|
+
groupedKeys = list(grouped.keys())
|
464
|
+
result: dict = {}
|
465
|
+
for i in range(0, len(groupedKeys)):
|
466
|
+
id = str((groupedKeys[i])) # some currencies are numeric
|
467
|
+
code = self.safe_currency_code(id)
|
468
|
+
networksRaw = grouped[id]
|
469
|
+
networks = {}
|
470
|
+
for j in range(0, len(networksRaw)):
|
471
|
+
networkEntry = networksRaw[j]
|
472
|
+
networkId = self.safe_string(networkEntry, 'chain')
|
473
|
+
networkCode = self.network_id_to_code(networkId)
|
474
|
+
networks[networkCode] = {
|
475
|
+
'id': networkId,
|
476
|
+
'network': networkCode,
|
477
|
+
'limits': {
|
478
|
+
'withdraw': {
|
479
|
+
'min': self.safe_number(networkEntry, 'min'),
|
480
|
+
'max': None,
|
481
|
+
},
|
482
|
+
'deposit': {
|
483
|
+
'min': self.safe_number(networkEntry, 'minTransfer'),
|
484
|
+
'max': None,
|
485
|
+
},
|
486
|
+
},
|
487
|
+
'active': None,
|
488
|
+
'deposit': None,
|
489
|
+
'withdraw': self.safe_bool(networkEntry, 'canWithDraw'),
|
490
|
+
'fee': self.safe_number(networkEntry, 'fee'),
|
491
|
+
'precision': self.parse_number(self.parse_precision(self.safe_string(networkEntry, 'transferAmtScale'))),
|
492
|
+
'info': networkEntry,
|
493
|
+
}
|
494
|
+
result[code] = self.safe_currency_structure({
|
495
|
+
'id': id,
|
496
|
+
'code': code,
|
497
|
+
'precision': None,
|
498
|
+
'type': None,
|
499
|
+
'name': None,
|
500
|
+
'active': None,
|
501
|
+
'deposit': None,
|
502
|
+
'withdraw': None,
|
503
|
+
'fee': None,
|
504
|
+
'limits': {
|
505
|
+
'withdraw': {
|
506
|
+
'min': None,
|
507
|
+
'max': None,
|
508
|
+
},
|
509
|
+
'deposit': {
|
510
|
+
'min': None,
|
511
|
+
'max': None,
|
512
|
+
},
|
513
|
+
},
|
514
|
+
'networks': networks,
|
515
|
+
'info': networksRaw,
|
516
|
+
})
|
517
|
+
return result
|
518
|
+
|
427
519
|
async def fetch_markets(self, params={}) -> List[Market]:
|
428
520
|
"""
|
429
521
|
retrieves data on all markets for lbank
|
@@ -2098,13 +2190,10 @@ class lbank(Exchange, ImplicitAPI):
|
|
2098
2190
|
result = self.safe_value(response, 'data')
|
2099
2191
|
address = self.safe_string(result, 'address')
|
2100
2192
|
tag = self.safe_string(result, 'memo')
|
2101
|
-
networkId = self.safe_string(result, 'netWork')
|
2102
|
-
inverseNetworks = self.safe_value(self.options, 'inverse-networks', {})
|
2103
|
-
networkCode = self.safe_string_upper(inverseNetworks, networkId, networkId)
|
2104
2193
|
return {
|
2105
2194
|
'info': response,
|
2106
2195
|
'currency': code,
|
2107
|
-
'network':
|
2196
|
+
'network': self.network_id_to_code(self.safe_string(result, 'netWork')),
|
2108
2197
|
'address': address,
|
2109
2198
|
'tag': tag,
|
2110
2199
|
}
|
@@ -2138,12 +2227,10 @@ class lbank(Exchange, ImplicitAPI):
|
|
2138
2227
|
result = self.safe_value(response, 'data')
|
2139
2228
|
address = self.safe_string(result, 'address')
|
2140
2229
|
tag = self.safe_string(result, 'memo')
|
2141
|
-
inverseNetworks = self.safe_value(self.options, 'inverse-networks', {})
|
2142
|
-
networkCode = self.safe_string_upper(inverseNetworks, network, network)
|
2143
2230
|
return {
|
2144
2231
|
'info': response,
|
2145
2232
|
'currency': code,
|
2146
|
-
'network':
|
2233
|
+
'network': None,
|
2147
2234
|
'address': address,
|
2148
2235
|
'tag': tag,
|
2149
2236
|
}
|
@@ -2263,9 +2350,6 @@ class lbank(Exchange, ImplicitAPI):
|
|
2263
2350
|
type = 'withdrawal'
|
2264
2351
|
txid = self.safe_string(transaction, 'txId')
|
2265
2352
|
timestamp = self.safe_integer_2(transaction, 'insertTime', 'applyTime')
|
2266
|
-
networks = self.safe_value(self.options, 'inverse-networks', {})
|
2267
|
-
networkId = self.safe_string(transaction, 'networkName')
|
2268
|
-
network = self.safe_string(networks, networkId, networkId)
|
2269
2353
|
address = self.safe_string(transaction, 'address')
|
2270
2354
|
addressFrom = None
|
2271
2355
|
addressTo = None
|
@@ -2290,7 +2374,7 @@ class lbank(Exchange, ImplicitAPI):
|
|
2290
2374
|
'txid': txid,
|
2291
2375
|
'timestamp': timestamp,
|
2292
2376
|
'datetime': self.iso8601(timestamp),
|
2293
|
-
'network':
|
2377
|
+
'network': self.network_id_to_code(self.safe_string(transaction, 'networkName')),
|
2294
2378
|
'address': address,
|
2295
2379
|
'addressTo': addressTo,
|
2296
2380
|
'addressFrom': addressFrom,
|
@@ -2483,10 +2567,9 @@ class lbank(Exchange, ImplicitAPI):
|
|
2483
2567
|
withdrawFees[code] = {}
|
2484
2568
|
for j in range(0, len(networkList)):
|
2485
2569
|
networkEntry = networkList[j]
|
2486
|
-
networkId = self.safe_string(networkEntry, 'name')
|
2487
|
-
networkCode = self.safe_string(self.options['inverse-networks'], networkId, networkId)
|
2488
2570
|
fee = self.safe_number(networkEntry, 'withdrawFee')
|
2489
2571
|
if fee is not None:
|
2572
|
+
networkCode = self.network_id_to_code(self.safe_string(networkEntry, 'name'))
|
2490
2573
|
withdrawFees[code][networkCode] = fee
|
2491
2574
|
return {
|
2492
2575
|
'withdraw': withdrawFees,
|
@@ -2534,8 +2617,7 @@ class lbank(Exchange, ImplicitAPI):
|
|
2534
2617
|
if canWithdraw == 'true':
|
2535
2618
|
currencyId = self.safe_string(item, 'assetCode')
|
2536
2619
|
codeInner = self.safe_currency_code(currencyId)
|
2537
|
-
|
2538
|
-
network = self.safe_string(self.options['inverse-networks'], chain, chain)
|
2620
|
+
network = self.network_id_to_code(self.safe_string(item, 'chain'))
|
2539
2621
|
if network is None:
|
2540
2622
|
network = codeInner
|
2541
2623
|
fee = self.safe_string(item, 'fee')
|
@@ -2676,8 +2758,7 @@ class lbank(Exchange, ImplicitAPI):
|
|
2676
2758
|
else:
|
2677
2759
|
resultCodeInfo = result[code]['info']
|
2678
2760
|
resultCodeInfo.append(fee)
|
2679
|
-
|
2680
|
-
networkCode = self.safe_string(self.options['inverse-networks'], chain, chain)
|
2761
|
+
networkCode = self.network_id_to_code(self.safe_string(fee, 'chain'))
|
2681
2762
|
if networkCode is not None:
|
2682
2763
|
result[code]['networks'][networkCode] = {
|
2683
2764
|
'withdraw': {
|
@@ -2727,8 +2808,7 @@ class lbank(Exchange, ImplicitAPI):
|
|
2727
2808
|
networkList = self.safe_value(fee, 'networkList', [])
|
2728
2809
|
for j in range(0, len(networkList)):
|
2729
2810
|
networkEntry = networkList[j]
|
2730
|
-
|
2731
|
-
networkCode = self.safe_string_upper(self.options['inverse-networks'], networkId, networkId)
|
2811
|
+
networkCode = self.network_id_to_code(self.safe_string(networkEntry, 'name'))
|
2732
2812
|
withdrawFee = self.safe_number(networkEntry, 'withdrawFee')
|
2733
2813
|
isDefault = self.safe_value(networkEntry, 'isDefault')
|
2734
2814
|
if withdrawFee is not None:
|
ccxt/async_support/mexc.py
CHANGED
ccxt/async_support/modetrade.py
CHANGED
@@ -1651,7 +1651,7 @@ class modetrade(Exchange, ImplicitAPI):
|
|
1651
1651
|
#
|
1652
1652
|
# {
|
1653
1653
|
# "success": True,
|
1654
|
-
# "timestamp":
|
1654
|
+
# "timestamp": 1702989203988,
|
1655
1655
|
# "data": {
|
1656
1656
|
# "status": "CANCEL_SENT"
|
1657
1657
|
# }
|
@@ -1659,7 +1659,7 @@ class modetrade(Exchange, ImplicitAPI):
|
|
1659
1659
|
#
|
1660
1660
|
# {
|
1661
1661
|
# "success": True,
|
1662
|
-
# "timestamp":
|
1662
|
+
# "timestamp": 1702989203988,
|
1663
1663
|
# "status": "CANCEL_SENT"
|
1664
1664
|
# }
|
1665
1665
|
#
|
ccxt/async_support/okx.py
CHANGED
@@ -4894,7 +4894,7 @@ class okx(Exchange, ImplicitAPI):
|
|
4894
4894
|
fee = self.safe_string(params, 'fee')
|
4895
4895
|
if fee is None:
|
4896
4896
|
currencies = await self.fetch_currencies()
|
4897
|
-
self.currencies = self.deep_extend(self.currencies, currencies)
|
4897
|
+
self.currencies = self.map_to_safe_map(self.deep_extend(self.currencies, currencies))
|
4898
4898
|
targetNetwork = self.safe_dict(currency['networks'], self.network_id_to_code(network), {})
|
4899
4899
|
fee = self.safe_string(targetNetwork, 'fee')
|
4900
4900
|
if fee is None:
|
@@ -6844,7 +6844,7 @@ class okx(Exchange, ImplicitAPI):
|
|
6844
6844
|
|
6845
6845
|
async def fetch_borrow_interest(self, code: Str = None, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[BorrowInterest]:
|
6846
6846
|
"""
|
6847
|
-
fetch the interest owed
|
6847
|
+
fetch the interest owed b the user for borrowing currency for margin trading
|
6848
6848
|
|
6849
6849
|
https://www.okx.com/docs-v5/en/#rest-api-account-get-interest-accrued-data
|
6850
6850
|
|
ccxt/async_support/paradex.py
CHANGED
@@ -785,7 +785,7 @@ class paradex(Exchange, ImplicitAPI):
|
|
785
785
|
# "ask": "69578.2",
|
786
786
|
# "volume_24h": "5815541.397939004",
|
787
787
|
# "total_volume": "584031465.525259686",
|
788
|
-
# "created_at":
|
788
|
+
# "created_at": 1718170156581,
|
789
789
|
# "underlying_price": "67367.37268422",
|
790
790
|
# "open_interest": "162.272",
|
791
791
|
# "funding_rate": "0.01629574927887",
|
ccxt/base/exchange.py
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
# -----------------------------------------------------------------------------
|
6
6
|
|
7
|
-
__version__ = '4.4.
|
7
|
+
__version__ = '4.4.92'
|
8
8
|
|
9
9
|
# -----------------------------------------------------------------------------
|
10
10
|
|
@@ -1515,6 +1515,12 @@ class Exchange(object):
|
|
1515
1515
|
parts = re.sub(r'0+$', '', str).split('.')
|
1516
1516
|
return len(parts[1]) if len(parts) > 1 else 0
|
1517
1517
|
|
1518
|
+
def map_to_safe_map(self, dictionary):
|
1519
|
+
return dictionary # wrapper for go
|
1520
|
+
|
1521
|
+
def safe_map_to_map(self, dictionary):
|
1522
|
+
return dictionary # wrapper for go
|
1523
|
+
|
1518
1524
|
def load_markets(self, reload=False, params={}):
|
1519
1525
|
"""
|
1520
1526
|
Loads and prepares the markets for trading.
|
@@ -2580,6 +2586,9 @@ class Exchange(object):
|
|
2580
2586
|
def watch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}):
|
2581
2587
|
raise NotSupported(self.id + ' watchTrades() is not supported yet')
|
2582
2588
|
|
2589
|
+
def un_watch_orders(self, symbol: Str = None, params={}):
|
2590
|
+
raise NotSupported(self.id + ' unWatchOrders() is not supported yet')
|
2591
|
+
|
2583
2592
|
def un_watch_trades(self, symbol: str, params={}):
|
2584
2593
|
raise NotSupported(self.id + ' unWatchTrades() is not supported yet')
|
2585
2594
|
|
@@ -3219,14 +3228,14 @@ class Exchange(object):
|
|
3219
3228
|
else:
|
3220
3229
|
market['subType'] = None
|
3221
3230
|
values.append(market)
|
3222
|
-
self.markets = self.index_by(values, 'symbol')
|
3231
|
+
self.markets = self.map_to_safe_map(self.index_by(values, 'symbol'))
|
3223
3232
|
marketsSortedBySymbol = self.keysort(self.markets)
|
3224
3233
|
marketsSortedById = self.keysort(self.markets_by_id)
|
3225
3234
|
self.symbols = list(marketsSortedBySymbol.keys())
|
3226
3235
|
self.ids = list(marketsSortedById.keys())
|
3227
3236
|
if currencies is not None:
|
3228
3237
|
# currencies is always None when called in constructor but not when called from loadMarkets
|
3229
|
-
self.currencies = self.deep_extend(self.currencies, currencies)
|
3238
|
+
self.currencies = self.map_to_safe_map(self.deep_extend(self.currencies, currencies))
|
3230
3239
|
else:
|
3231
3240
|
baseCurrencies = []
|
3232
3241
|
quoteCurrencies = []
|
@@ -3252,8 +3261,8 @@ class Exchange(object):
|
|
3252
3261
|
quoteCurrencies.append(currency)
|
3253
3262
|
baseCurrencies = self.sort_by(baseCurrencies, 'code', False, '')
|
3254
3263
|
quoteCurrencies = self.sort_by(quoteCurrencies, 'code', False, '')
|
3255
|
-
self.baseCurrencies = self.index_by(baseCurrencies, 'code')
|
3256
|
-
self.quoteCurrencies = self.index_by(quoteCurrencies, 'code')
|
3264
|
+
self.baseCurrencies = self.map_to_safe_map(self.index_by(baseCurrencies, 'code'))
|
3265
|
+
self.quoteCurrencies = self.map_to_safe_map(self.index_by(quoteCurrencies, 'code'))
|
3257
3266
|
allCurrencies = self.array_concat(baseCurrencies, quoteCurrencies)
|
3258
3267
|
groupedCurrencies = self.group_by(allCurrencies, 'code')
|
3259
3268
|
codes = list(groupedCurrencies.keys())
|
@@ -3270,7 +3279,7 @@ class Exchange(object):
|
|
3270
3279
|
highestPrecisionCurrency = currentCurrency if (currentCurrency['precision'] > highestPrecisionCurrency['precision']) else highestPrecisionCurrency
|
3271
3280
|
resultingCurrencies.append(highestPrecisionCurrency)
|
3272
3281
|
sortedCurrencies = self.sort_by(resultingCurrencies, 'code')
|
3273
|
-
self.currencies = self.deep_extend(self.currencies, self.index_by(sortedCurrencies, 'code'))
|
3282
|
+
self.currencies = self.map_to_safe_map(self.deep_extend(self.currencies, self.index_by(sortedCurrencies, 'code')))
|
3274
3283
|
self.currencies_by_id = self.index_by_safe(self.currencies, 'id')
|
3275
3284
|
currenciesSortedByCode = self.keysort(self.currencies)
|
3276
3285
|
self.codes = list(currenciesSortedByCode.keys())
|
@@ -6789,7 +6798,7 @@ class Exchange(object):
|
|
6789
6798
|
return reconstructedDate
|
6790
6799
|
|
6791
6800
|
def convert_market_id_expire_date(self, date: str):
|
6792
|
-
# parse 03JAN24 to 240103
|
6801
|
+
# parse 03JAN24 to 240103.
|
6793
6802
|
monthMappping = {
|
6794
6803
|
'JAN': '01',
|
6795
6804
|
'FEB': '02',
|
@@ -6894,7 +6903,7 @@ class Exchange(object):
|
|
6894
6903
|
symbolAndTimeFrame = symbolsAndTimeFrames[i]
|
6895
6904
|
symbol = self.safe_string(symbolAndTimeFrame, 0)
|
6896
6905
|
timeframe = self.safe_string(symbolAndTimeFrame, 1)
|
6897
|
-
if symbol in self.ohlcvs:
|
6906
|
+
if (self.ohlcvs is not None) and (symbol in self.ohlcvs):
|
6898
6907
|
if timeframe in self.ohlcvs[symbol]:
|
6899
6908
|
del self.ohlcvs[symbol][timeframe]
|
6900
6909
|
elif symbolsLength > 0:
|
@@ -6910,21 +6919,11 @@ class Exchange(object):
|
|
6910
6919
|
if symbol in self.tickers:
|
6911
6920
|
del self.tickers[symbol]
|
6912
6921
|
else:
|
6913
|
-
if topic == 'myTrades':
|
6914
|
-
|
6915
|
-
|
6916
|
-
|
6917
|
-
|
6918
|
-
key = keys[i]
|
6919
|
-
if key in self.myTrades:
|
6920
|
-
del self.myTrades[key]
|
6921
|
-
elif topic == 'orders':
|
6922
|
-
orderSymbols = list(self.orders.keys())
|
6923
|
-
for i in range(0, len(orderSymbols)):
|
6924
|
-
orderSymbol = orderSymbols[i]
|
6925
|
-
if orderSymbol in self.orders:
|
6926
|
-
del self.orders[orderSymbol]
|
6927
|
-
elif topic == 'ticker':
|
6922
|
+
if topic == 'myTrades' and (self.myTrades is not None):
|
6923
|
+
self.myTrades = None
|
6924
|
+
elif topic == 'orders' and (self.orders is not None):
|
6925
|
+
self.orders = None
|
6926
|
+
elif topic == 'ticker' and (self.tickers is not None):
|
6928
6927
|
tickerSymbols = list(self.tickers.keys())
|
6929
6928
|
for i in range(0, len(tickerSymbols)):
|
6930
6929
|
tickerSymbol = tickerSymbols[i]
|
ccxt/base/types.py
CHANGED
ccxt/binance.py
CHANGED
@@ -3903,7 +3903,7 @@ class binance(Exchange, ImplicitAPI):
|
|
3903
3903
|
#
|
3904
3904
|
# {
|
3905
3905
|
# "symbol": "BTCUSDT",
|
3906
|
-
# "markPrice": "11793.
|
3906
|
+
# "markPrice": "11793.63104561", # mark price
|
3907
3907
|
# "indexPrice": "11781.80495970", # index price
|
3908
3908
|
# "estimatedSettlePrice": "11781.16138815", # Estimated Settle Price, only useful in the last hour before the settlement starts
|
3909
3909
|
# "lastFundingRate": "0.00038246", # This is the lastest estimated funding rate
|
ccxt/bitmart.py
CHANGED
@@ -2160,6 +2160,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2160
2160
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2161
2161
|
:param int [params.until]: the latest time in ms to fetch trades for
|
2162
2162
|
:param boolean [params.marginMode]: *spot* whether to fetch trades for margin orders or spot orders, defaults to spot orders(only isolated margin orders are supported)
|
2163
|
+
:param str [params.stpMode]: self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
|
2163
2164
|
:returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
|
2164
2165
|
"""
|
2165
2166
|
self.load_markets()
|
@@ -2264,6 +2265,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2264
2265
|
:param int [since]: the earliest time in ms to fetch trades for
|
2265
2266
|
:param int [limit]: the maximum number of trades to retrieve
|
2266
2267
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2268
|
+
:param str [params.stpMode]: self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
|
2267
2269
|
:returns dict[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
|
2268
2270
|
"""
|
2269
2271
|
self.load_markets()
|
@@ -2706,6 +2708,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2706
2708
|
:param str [params.stopLossPrice]: *swap only* the price to trigger a stop-loss order
|
2707
2709
|
:param str [params.takeProfitPrice]: *swap only* the price to trigger a take-profit order
|
2708
2710
|
:param int [params.plan_category]: *swap tp/sl only* 1: tp/sl, 2: position tp/sl, default is 1
|
2711
|
+
:param str [params.stpMode]: self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
|
2709
2712
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
2710
2713
|
"""
|
2711
2714
|
self.load_markets()
|
@@ -2768,6 +2771,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2768
2771
|
|
2769
2772
|
:param Array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
|
2770
2773
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2774
|
+
:param str [params.stpMode]: self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
|
2771
2775
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
2772
2776
|
"""
|
2773
2777
|
self.load_markets()
|
@@ -3270,6 +3274,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3270
3274
|
:param str [params.orderType]: *swap only* 'limit', 'market', or 'trailing'
|
3271
3275
|
:param boolean [params.trailing]: *swap only* set to True if you want to fetch trailing orders
|
3272
3276
|
:param boolean [params.trigger]: *swap only* set to True if you want to fetch trigger orders
|
3277
|
+
:param str [params.stpMode]: self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
|
3273
3278
|
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
3274
3279
|
"""
|
3275
3280
|
self.load_markets()
|
@@ -3383,6 +3388,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3383
3388
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3384
3389
|
:param int [params.until]: timestamp in ms of the latest entry
|
3385
3390
|
:param str [params.marginMode]: *spot only* 'cross' or 'isolated', for margin trading
|
3391
|
+
:param str [params.stpMode]: self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
|
3386
3392
|
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
3387
3393
|
"""
|
3388
3394
|
self.load_markets()
|
@@ -3441,6 +3447,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3441
3447
|
:param str [params.clientOrderId]: *spot* fetch the order by client order id instead of order id
|
3442
3448
|
:param str [params.orderType]: *swap only* 'limit', 'market', 'liquidate', 'bankruptcy', 'adl' or 'trailing'
|
3443
3449
|
:param boolean [params.trailing]: *swap only* set to True if you want to fetch a trailing order
|
3450
|
+
:param str [params.stpMode]: self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
|
3444
3451
|
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
3445
3452
|
"""
|
3446
3453
|
self.load_markets()
|
ccxt/bitmex.py
CHANGED
@@ -101,6 +101,7 @@ class bitmex(Exchange, ImplicitAPI):
|
|
101
101
|
'fetchTransactions': 'emulated',
|
102
102
|
'fetchTransfer': False,
|
103
103
|
'fetchTransfers': False,
|
104
|
+
'index': True,
|
104
105
|
'reduceMargin': None,
|
105
106
|
'sandbox': True,
|
106
107
|
'setLeverage': True,
|
@@ -427,8 +428,8 @@ class bitmex(Exchange, ImplicitAPI):
|
|
427
428
|
# # "mediumPrecision": "8",
|
428
429
|
# # "shorterPrecision": "4",
|
429
430
|
# # "symbol": "₿",
|
430
|
-
# # "weight": "1",
|
431
431
|
# # "tickLog": "0",
|
432
|
+
# # "weight": "1",
|
432
433
|
# "enabled": True,
|
433
434
|
# "isMarginCurrency": True,
|
434
435
|
# "minDepositAmount": "10000",
|
ccxt/bitvavo.py
CHANGED
@@ -666,7 +666,7 @@ class bitvavo(Exchange, ImplicitAPI):
|
|
666
666
|
},
|
667
667
|
})
|
668
668
|
# set currencies here to avoid calling publicGetAssets twice
|
669
|
-
self.currencies = self.deep_extend(self.currencies, result)
|
669
|
+
self.currencies = self.map_to_safe_map(self.deep_extend(self.currencies, result))
|
670
670
|
return result
|
671
671
|
|
672
672
|
def fetch_ticker(self, symbol: str, params={}) -> Ticker:
|
@@ -1207,6 +1207,8 @@ class bitvavo(Exchange, ImplicitAPI):
|
|
1207
1207
|
operatorId, params = self.handle_option_and_params(params, 'createOrder', 'operatorId')
|
1208
1208
|
if operatorId is not None:
|
1209
1209
|
request['operatorId'] = self.parse_to_int(operatorId)
|
1210
|
+
else:
|
1211
|
+
raise ArgumentsRequired(self.id + ' createOrder() requires an operatorId in params or options, eg: exchange.options[\'operatorId\'] = 1234567890')
|
1210
1212
|
return self.extend(request, params)
|
1211
1213
|
|
1212
1214
|
def create_order(self, symbol: Str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
@@ -1304,6 +1306,8 @@ class bitvavo(Exchange, ImplicitAPI):
|
|
1304
1306
|
operatorId, params = self.handle_option_and_params(params, 'editOrder', 'operatorId')
|
1305
1307
|
if operatorId is not None:
|
1306
1308
|
request['operatorId'] = self.parse_to_int(operatorId)
|
1309
|
+
else:
|
1310
|
+
raise ArgumentsRequired(self.id + ' editOrder() requires an operatorId in params or options, eg: exchange.options[\'operatorId\'] = 1234567890')
|
1307
1311
|
request['market'] = market['id']
|
1308
1312
|
return request
|
1309
1313
|
|
@@ -1342,6 +1346,8 @@ class bitvavo(Exchange, ImplicitAPI):
|
|
1342
1346
|
operatorId, params = self.handle_option_and_params(params, 'cancelOrder', 'operatorId')
|
1343
1347
|
if operatorId is not None:
|
1344
1348
|
request['operatorId'] = self.parse_to_int(operatorId)
|
1349
|
+
else:
|
1350
|
+
raise ArgumentsRequired(self.id + ' cancelOrder() requires an operatorId in params or options, eg: exchange.options[\'operatorId\'] = 1234567890')
|
1345
1351
|
return self.extend(request, params)
|
1346
1352
|
|
1347
1353
|
def cancel_order(self, id: str, symbol: Str = None, params={}):
|
ccxt/cex.py
CHANGED
@@ -35,34 +35,95 @@ class cex(Exchange, ImplicitAPI):
|
|
35
35
|
'swap': False,
|
36
36
|
'future': False,
|
37
37
|
'option': False,
|
38
|
+
'addMargin': False,
|
39
|
+
'borrowCrossMargin': False,
|
40
|
+
'borrowIsolatedMargin': False,
|
41
|
+
'borrowMargin': False,
|
38
42
|
'cancelAllOrders': True,
|
39
43
|
'cancelOrder': True,
|
44
|
+
'closeAllPositions': False,
|
45
|
+
'closePosition': False,
|
40
46
|
'createOrder': True,
|
47
|
+
'createOrderWithTakeProfitAndStopLoss': False,
|
48
|
+
'createOrderWithTakeProfitAndStopLossWs': False,
|
49
|
+
'createPostOnlyOrder': False,
|
41
50
|
'createReduceOnlyOrder': False,
|
42
51
|
'createStopOrder': True,
|
43
52
|
'createTriggerOrder': True,
|
44
53
|
'fetchAccounts': True,
|
45
54
|
'fetchBalance': True,
|
55
|
+
'fetchBorrowInterest': False,
|
56
|
+
'fetchBorrowRate': False,
|
57
|
+
'fetchBorrowRateHistories': False,
|
58
|
+
'fetchBorrowRateHistory': False,
|
59
|
+
'fetchBorrowRates': False,
|
60
|
+
'fetchBorrowRatesPerSymbol': False,
|
46
61
|
'fetchClosedOrder': True,
|
47
62
|
'fetchClosedOrders': True,
|
63
|
+
'fetchCrossBorrowRate': False,
|
64
|
+
'fetchCrossBorrowRates': False,
|
48
65
|
'fetchCurrencies': True,
|
49
66
|
'fetchDepositAddress': True,
|
50
67
|
'fetchDepositsWithdrawals': True,
|
51
68
|
'fetchFundingHistory': False,
|
69
|
+
'fetchFundingInterval': False,
|
70
|
+
'fetchFundingIntervals': False,
|
52
71
|
'fetchFundingRate': False,
|
53
72
|
'fetchFundingRateHistory': False,
|
54
73
|
'fetchFundingRates': False,
|
74
|
+
'fetchGreeks': False,
|
75
|
+
'fetchIndexOHLCV': False,
|
76
|
+
'fetchIsolatedBorrowRate': False,
|
77
|
+
'fetchIsolatedBorrowRates': False,
|
78
|
+
'fetchIsolatedPositions': False,
|
55
79
|
'fetchLedger': True,
|
80
|
+
'fetchLeverage': False,
|
81
|
+
'fetchLeverages': False,
|
82
|
+
'fetchLeverageTiers': False,
|
83
|
+
'fetchLiquidations': False,
|
84
|
+
'fetchLongShortRatio': False,
|
85
|
+
'fetchLongShortRatioHistory': False,
|
86
|
+
'fetchMarginAdjustmentHistory': False,
|
87
|
+
'fetchMarginMode': False,
|
88
|
+
'fetchMarginModes': False,
|
89
|
+
'fetchMarketLeverageTiers': False,
|
56
90
|
'fetchMarkets': True,
|
91
|
+
'fetchMarkOHLCV': False,
|
92
|
+
'fetchMarkPrices': False,
|
93
|
+
'fetchMyLiquidations': False,
|
94
|
+
'fetchMySettlementHistory': False,
|
57
95
|
'fetchOHLCV': True,
|
96
|
+
'fetchOpenInterest': False,
|
97
|
+
'fetchOpenInterestHistory': False,
|
98
|
+
'fetchOpenInterests': False,
|
58
99
|
'fetchOpenOrder': True,
|
59
100
|
'fetchOpenOrders': True,
|
101
|
+
'fetchOption': False,
|
102
|
+
'fetchOptionChain': False,
|
60
103
|
'fetchOrderBook': True,
|
104
|
+
'fetchPosition': False,
|
105
|
+
'fetchPositionHistory': False,
|
106
|
+
'fetchPositionMode': False,
|
107
|
+
'fetchPositions': False,
|
108
|
+
'fetchPositionsForSymbol': False,
|
109
|
+
'fetchPositionsHistory': False,
|
110
|
+
'fetchPositionsRisk': False,
|
111
|
+
'fetchPremiumIndexOHLCV': False,
|
112
|
+
'fetchSettlementHistory': False,
|
61
113
|
'fetchTicker': True,
|
62
114
|
'fetchTickers': True,
|
63
115
|
'fetchTime': True,
|
64
116
|
'fetchTrades': True,
|
65
117
|
'fetchTradingFees': True,
|
118
|
+
'fetchVolatilityHistory': False,
|
119
|
+
'reduceMargin': False,
|
120
|
+
'repayCrossMargin': False,
|
121
|
+
'repayIsolatedMargin': False,
|
122
|
+
'repayMargin': False,
|
123
|
+
'setLeverage': False,
|
124
|
+
'setMargin': False,
|
125
|
+
'setMarginMode': False,
|
126
|
+
'setPositionMode': False,
|
66
127
|
'transfer': True,
|
67
128
|
},
|
68
129
|
'urls': {
|