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/lbank.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.lbank import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
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
|
9
|
+
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
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -61,6 +61,7 @@ class lbank(Exchange, ImplicitAPI):
|
|
61
61
|
'fetchClosedOrders': False,
|
62
62
|
'fetchCrossBorrowRate': False,
|
63
63
|
'fetchCrossBorrowRates': False,
|
64
|
+
'fetchCurrencies': True,
|
64
65
|
'fetchDepositAddress': True,
|
65
66
|
'fetchDepositAddresses': False,
|
66
67
|
'fetchDepositAddressesByNetwork': False,
|
@@ -135,6 +136,7 @@ class lbank(Exchange, ImplicitAPI):
|
|
135
136
|
'currencyPairs': 2.5,
|
136
137
|
'accuracy': 2.5,
|
137
138
|
'usdToCny': 2.5,
|
139
|
+
'assetConfigs': 2.5,
|
138
140
|
'withdrawConfigs': 2.5,
|
139
141
|
'timestamp': 2.5,
|
140
142
|
'ticker/24hr': 2.5,
|
@@ -221,6 +223,7 @@ class lbank(Exchange, ImplicitAPI):
|
|
221
223
|
},
|
222
224
|
},
|
223
225
|
'commonCurrencies': {
|
226
|
+
'XBT': 'XBT', # not BTC!
|
224
227
|
'HIT': 'Hiver',
|
225
228
|
'VET_ERC20': 'VEN',
|
226
229
|
'PNT': 'Penta',
|
@@ -288,21 +291,12 @@ class lbank(Exchange, ImplicitAPI):
|
|
288
291
|
# ptx: 1
|
289
292
|
# }
|
290
293
|
},
|
291
|
-
'
|
294
|
+
'networksById': {
|
292
295
|
'erc20': 'ERC20',
|
293
296
|
'trc20': 'TRC20',
|
294
|
-
'
|
295
|
-
'
|
296
|
-
'bep20
|
297
|
-
'bep20': 'BSC',
|
298
|
-
'heco': 'HT',
|
299
|
-
'bep2': 'BNB',
|
300
|
-
'btc': 'BTC',
|
301
|
-
'dogecoin': 'DOGE',
|
302
|
-
'matic': 'MATIC',
|
303
|
-
'oec': 'OEC',
|
304
|
-
'btctron': 'BTCTRON',
|
305
|
-
'xrp': 'XRP',
|
297
|
+
'TRX': 'TRC20',
|
298
|
+
'bep20(bsc)': 'BEP20',
|
299
|
+
'bep20': 'BEP20',
|
306
300
|
},
|
307
301
|
'defaultNetworks': {
|
308
302
|
'USDT': 'TRC20',
|
@@ -423,6 +417,104 @@ class lbank(Exchange, ImplicitAPI):
|
|
423
417
|
#
|
424
418
|
return self.safe_integer(response, 'data')
|
425
419
|
|
420
|
+
def fetch_currencies(self, params={}) -> Currencies:
|
421
|
+
"""
|
422
|
+
fetches all available currencies on an exchange
|
423
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
424
|
+
:returns dict: an associative dictionary of currencies
|
425
|
+
"""
|
426
|
+
response = self.spotPublicGetWithdrawConfigs(params)
|
427
|
+
#
|
428
|
+
# {
|
429
|
+
# "msg": "Success",
|
430
|
+
# "result": "true",
|
431
|
+
# "data": [
|
432
|
+
# {
|
433
|
+
# "amountScale": "4",
|
434
|
+
# "chain": "bep20(bsc)",
|
435
|
+
# "assetCode": "usdt",
|
436
|
+
# "min": "10",
|
437
|
+
# "transferAmtScale": "4",
|
438
|
+
# "canWithDraw": True,
|
439
|
+
# "fee": "0.0000",
|
440
|
+
# "minTransfer": "0.0001",
|
441
|
+
# "type": "1"
|
442
|
+
# },
|
443
|
+
# {
|
444
|
+
# "amountScale": "4",
|
445
|
+
# "chain": "trc20",
|
446
|
+
# "assetCode": "usdt",
|
447
|
+
# "min": "1",
|
448
|
+
# "transferAmtScale": "4",
|
449
|
+
# "canWithDraw": True,
|
450
|
+
# "fee": "1.0000",
|
451
|
+
# "minTransfer": "0.0001",
|
452
|
+
# "type": "1"
|
453
|
+
# },
|
454
|
+
# ...
|
455
|
+
# ],
|
456
|
+
# "error_code": "0",
|
457
|
+
# "ts": "1747973911431"
|
458
|
+
# }
|
459
|
+
#
|
460
|
+
currenciesData = self.safe_list(response, 'data', [])
|
461
|
+
grouped = self.group_by(currenciesData, 'assetCode')
|
462
|
+
groupedKeys = list(grouped.keys())
|
463
|
+
result: dict = {}
|
464
|
+
for i in range(0, len(groupedKeys)):
|
465
|
+
id = str((groupedKeys[i])) # some currencies are numeric
|
466
|
+
code = self.safe_currency_code(id)
|
467
|
+
networksRaw = grouped[id]
|
468
|
+
networks = {}
|
469
|
+
for j in range(0, len(networksRaw)):
|
470
|
+
networkEntry = networksRaw[j]
|
471
|
+
networkId = self.safe_string(networkEntry, 'chain')
|
472
|
+
networkCode = self.network_id_to_code(networkId)
|
473
|
+
networks[networkCode] = {
|
474
|
+
'id': networkId,
|
475
|
+
'network': networkCode,
|
476
|
+
'limits': {
|
477
|
+
'withdraw': {
|
478
|
+
'min': self.safe_number(networkEntry, 'min'),
|
479
|
+
'max': None,
|
480
|
+
},
|
481
|
+
'deposit': {
|
482
|
+
'min': self.safe_number(networkEntry, 'minTransfer'),
|
483
|
+
'max': None,
|
484
|
+
},
|
485
|
+
},
|
486
|
+
'active': None,
|
487
|
+
'deposit': None,
|
488
|
+
'withdraw': self.safe_bool(networkEntry, 'canWithDraw'),
|
489
|
+
'fee': self.safe_number(networkEntry, 'fee'),
|
490
|
+
'precision': self.parse_number(self.parse_precision(self.safe_string(networkEntry, 'transferAmtScale'))),
|
491
|
+
'info': networkEntry,
|
492
|
+
}
|
493
|
+
result[code] = self.safe_currency_structure({
|
494
|
+
'id': id,
|
495
|
+
'code': code,
|
496
|
+
'precision': None,
|
497
|
+
'type': None,
|
498
|
+
'name': None,
|
499
|
+
'active': None,
|
500
|
+
'deposit': None,
|
501
|
+
'withdraw': None,
|
502
|
+
'fee': None,
|
503
|
+
'limits': {
|
504
|
+
'withdraw': {
|
505
|
+
'min': None,
|
506
|
+
'max': None,
|
507
|
+
},
|
508
|
+
'deposit': {
|
509
|
+
'min': None,
|
510
|
+
'max': None,
|
511
|
+
},
|
512
|
+
},
|
513
|
+
'networks': networks,
|
514
|
+
'info': networksRaw,
|
515
|
+
})
|
516
|
+
return result
|
517
|
+
|
426
518
|
def fetch_markets(self, params={}) -> List[Market]:
|
427
519
|
"""
|
428
520
|
retrieves data on all markets for lbank
|
@@ -2097,13 +2189,10 @@ class lbank(Exchange, ImplicitAPI):
|
|
2097
2189
|
result = self.safe_value(response, 'data')
|
2098
2190
|
address = self.safe_string(result, 'address')
|
2099
2191
|
tag = self.safe_string(result, 'memo')
|
2100
|
-
networkId = self.safe_string(result, 'netWork')
|
2101
|
-
inverseNetworks = self.safe_value(self.options, 'inverse-networks', {})
|
2102
|
-
networkCode = self.safe_string_upper(inverseNetworks, networkId, networkId)
|
2103
2192
|
return {
|
2104
2193
|
'info': response,
|
2105
2194
|
'currency': code,
|
2106
|
-
'network':
|
2195
|
+
'network': self.network_id_to_code(self.safe_string(result, 'netWork')),
|
2107
2196
|
'address': address,
|
2108
2197
|
'tag': tag,
|
2109
2198
|
}
|
@@ -2137,12 +2226,10 @@ class lbank(Exchange, ImplicitAPI):
|
|
2137
2226
|
result = self.safe_value(response, 'data')
|
2138
2227
|
address = self.safe_string(result, 'address')
|
2139
2228
|
tag = self.safe_string(result, 'memo')
|
2140
|
-
inverseNetworks = self.safe_value(self.options, 'inverse-networks', {})
|
2141
|
-
networkCode = self.safe_string_upper(inverseNetworks, network, network)
|
2142
2229
|
return {
|
2143
2230
|
'info': response,
|
2144
2231
|
'currency': code,
|
2145
|
-
'network':
|
2232
|
+
'network': None,
|
2146
2233
|
'address': address,
|
2147
2234
|
'tag': tag,
|
2148
2235
|
}
|
@@ -2262,9 +2349,6 @@ class lbank(Exchange, ImplicitAPI):
|
|
2262
2349
|
type = 'withdrawal'
|
2263
2350
|
txid = self.safe_string(transaction, 'txId')
|
2264
2351
|
timestamp = self.safe_integer_2(transaction, 'insertTime', 'applyTime')
|
2265
|
-
networks = self.safe_value(self.options, 'inverse-networks', {})
|
2266
|
-
networkId = self.safe_string(transaction, 'networkName')
|
2267
|
-
network = self.safe_string(networks, networkId, networkId)
|
2268
2352
|
address = self.safe_string(transaction, 'address')
|
2269
2353
|
addressFrom = None
|
2270
2354
|
addressTo = None
|
@@ -2289,7 +2373,7 @@ class lbank(Exchange, ImplicitAPI):
|
|
2289
2373
|
'txid': txid,
|
2290
2374
|
'timestamp': timestamp,
|
2291
2375
|
'datetime': self.iso8601(timestamp),
|
2292
|
-
'network':
|
2376
|
+
'network': self.network_id_to_code(self.safe_string(transaction, 'networkName')),
|
2293
2377
|
'address': address,
|
2294
2378
|
'addressTo': addressTo,
|
2295
2379
|
'addressFrom': addressFrom,
|
@@ -2482,10 +2566,9 @@ class lbank(Exchange, ImplicitAPI):
|
|
2482
2566
|
withdrawFees[code] = {}
|
2483
2567
|
for j in range(0, len(networkList)):
|
2484
2568
|
networkEntry = networkList[j]
|
2485
|
-
networkId = self.safe_string(networkEntry, 'name')
|
2486
|
-
networkCode = self.safe_string(self.options['inverse-networks'], networkId, networkId)
|
2487
2569
|
fee = self.safe_number(networkEntry, 'withdrawFee')
|
2488
2570
|
if fee is not None:
|
2571
|
+
networkCode = self.network_id_to_code(self.safe_string(networkEntry, 'name'))
|
2489
2572
|
withdrawFees[code][networkCode] = fee
|
2490
2573
|
return {
|
2491
2574
|
'withdraw': withdrawFees,
|
@@ -2533,8 +2616,7 @@ class lbank(Exchange, ImplicitAPI):
|
|
2533
2616
|
if canWithdraw == 'true':
|
2534
2617
|
currencyId = self.safe_string(item, 'assetCode')
|
2535
2618
|
codeInner = self.safe_currency_code(currencyId)
|
2536
|
-
|
2537
|
-
network = self.safe_string(self.options['inverse-networks'], chain, chain)
|
2619
|
+
network = self.network_id_to_code(self.safe_string(item, 'chain'))
|
2538
2620
|
if network is None:
|
2539
2621
|
network = codeInner
|
2540
2622
|
fee = self.safe_string(item, 'fee')
|
@@ -2675,8 +2757,7 @@ class lbank(Exchange, ImplicitAPI):
|
|
2675
2757
|
else:
|
2676
2758
|
resultCodeInfo = result[code]['info']
|
2677
2759
|
resultCodeInfo.append(fee)
|
2678
|
-
|
2679
|
-
networkCode = self.safe_string(self.options['inverse-networks'], chain, chain)
|
2760
|
+
networkCode = self.network_id_to_code(self.safe_string(fee, 'chain'))
|
2680
2761
|
if networkCode is not None:
|
2681
2762
|
result[code]['networks'][networkCode] = {
|
2682
2763
|
'withdraw': {
|
@@ -2726,8 +2807,7 @@ class lbank(Exchange, ImplicitAPI):
|
|
2726
2807
|
networkList = self.safe_value(fee, 'networkList', [])
|
2727
2808
|
for j in range(0, len(networkList)):
|
2728
2809
|
networkEntry = networkList[j]
|
2729
|
-
|
2730
|
-
networkCode = self.safe_string_upper(self.options['inverse-networks'], networkId, networkId)
|
2810
|
+
networkCode = self.network_id_to_code(self.safe_string(networkEntry, 'name'))
|
2731
2811
|
withdrawFee = self.safe_number(networkEntry, 'withdrawFee')
|
2732
2812
|
isDefault = self.safe_value(networkEntry, 'isDefault')
|
2733
2813
|
if withdrawFee is not None:
|
ccxt/mexc.py
CHANGED
ccxt/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/okx.py
CHANGED
@@ -4893,7 +4893,7 @@ class okx(Exchange, ImplicitAPI):
|
|
4893
4893
|
fee = self.safe_string(params, 'fee')
|
4894
4894
|
if fee is None:
|
4895
4895
|
currencies = self.fetch_currencies()
|
4896
|
-
self.currencies = self.deep_extend(self.currencies, currencies)
|
4896
|
+
self.currencies = self.map_to_safe_map(self.deep_extend(self.currencies, currencies))
|
4897
4897
|
targetNetwork = self.safe_dict(currency['networks'], self.network_id_to_code(network), {})
|
4898
4898
|
fee = self.safe_string(targetNetwork, 'fee')
|
4899
4899
|
if fee is None:
|
@@ -6843,7 +6843,7 @@ class okx(Exchange, ImplicitAPI):
|
|
6843
6843
|
|
6844
6844
|
def fetch_borrow_interest(self, code: Str = None, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[BorrowInterest]:
|
6845
6845
|
"""
|
6846
|
-
fetch the interest owed
|
6846
|
+
fetch the interest owed b the user for borrowing currency for margin trading
|
6847
6847
|
|
6848
6848
|
https://www.okx.com/docs-v5/en/#rest-api-account-get-interest-accrued-data
|
6849
6849
|
|
ccxt/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/pro/__init__.py
CHANGED
ccxt/pro/bitstamp.py
CHANGED
@@ -502,7 +502,7 @@ class bitstamp(ccxt.async_support.bitstamp):
|
|
502
502
|
#
|
503
503
|
sessionToken = self.safe_string(response, 'token')
|
504
504
|
if sessionToken is not None:
|
505
|
-
userId = self.
|
505
|
+
userId = self.safe_string(response, 'user_id')
|
506
506
|
validity = self.safe_integer_product(response, 'valid_sec', 1000)
|
507
507
|
self.options['expiresIn'] = self.sum(time, validity)
|
508
508
|
self.options['userId'] = userId
|
ccxt/pro/bybit.py
CHANGED
@@ -14,6 +14,7 @@ from ccxt.base.errors import ExchangeError
|
|
14
14
|
from ccxt.base.errors import AuthenticationError
|
15
15
|
from ccxt.base.errors import ArgumentsRequired
|
16
16
|
from ccxt.base.errors import BadRequest
|
17
|
+
from ccxt.base.errors import NotSupported
|
17
18
|
|
18
19
|
|
19
20
|
class bybit(ccxt.async_support.bybit):
|
@@ -1235,8 +1236,7 @@ class bybit(ccxt.async_support.bybit):
|
|
1235
1236
|
subHash = 'myTrades'
|
1236
1237
|
await self.load_markets()
|
1237
1238
|
if symbol is not None:
|
1238
|
-
|
1239
|
-
subHash += ':' + symbol
|
1239
|
+
raise NotSupported(self.id + ' unWatchMyTrades() does not support a symbol parameter, you must unwatch all my trades')
|
1240
1240
|
url = await self.get_url_by_market_type(symbol, True, method, params)
|
1241
1241
|
await self.authenticate(url)
|
1242
1242
|
topicByMarket: dict = {
|
@@ -1652,8 +1652,7 @@ class bybit(ccxt.async_support.bybit):
|
|
1652
1652
|
messageHash = 'unsubscribe:orders'
|
1653
1653
|
subHash = 'orders'
|
1654
1654
|
if symbol is not None:
|
1655
|
-
|
1656
|
-
subHash += ':' + symbol
|
1655
|
+
raise NotSupported(self.id + ' unWatchOrders() does not support a symbol parameter, you must unwatch all orders')
|
1657
1656
|
url = await self.get_url_by_market_type(symbol, True, method, params)
|
1658
1657
|
await self.authenticate(url)
|
1659
1658
|
topicsByMarket: dict = {
|
@@ -1786,11 +1785,12 @@ class bybit(ccxt.async_support.bybit):
|
|
1786
1785
|
rawOrders = self.safe_value(rawOrders, 'result', rawOrders)
|
1787
1786
|
symbols: dict = {}
|
1788
1787
|
for i in range(0, len(rawOrders)):
|
1789
|
-
parsed =
|
1790
|
-
if isSpot:
|
1791
|
-
|
1792
|
-
else:
|
1793
|
-
|
1788
|
+
parsed = self.parse_order(rawOrders[i])
|
1789
|
+
# if isSpot:
|
1790
|
+
# parsed = self.parseWsSpotOrder(rawOrders[i])
|
1791
|
+
# else:
|
1792
|
+
# parsed = self.parse_order(rawOrders[i])
|
1793
|
+
# }
|
1794
1794
|
symbol = parsed['symbol']
|
1795
1795
|
symbols[symbol] = True
|
1796
1796
|
orders.append(parsed)
|
@@ -1801,137 +1801,6 @@ class bybit(ccxt.async_support.bybit):
|
|
1801
1801
|
messageHash = 'orders'
|
1802
1802
|
client.resolve(orders, messageHash)
|
1803
1803
|
|
1804
|
-
def parse_ws_spot_order(self, order, market=None):
|
1805
|
-
#
|
1806
|
-
# {
|
1807
|
-
# "e": "executionReport",
|
1808
|
-
# "E": "1653297251061", # timestamp
|
1809
|
-
# "s": "LTCUSDT", # symbol
|
1810
|
-
# "c": "1653297250740", # user id
|
1811
|
-
# "S": "SELL", # side
|
1812
|
-
# "o": "MARKET_OF_BASE", # order type
|
1813
|
-
# "f": "GTC", # time in force
|
1814
|
-
# "q": "0.16233", # quantity
|
1815
|
-
# "p": "0", # price
|
1816
|
-
# "X": "NEW", # status
|
1817
|
-
# "i": "1162336018974750208", # order id
|
1818
|
-
# "M": "0",
|
1819
|
-
# "l": "0", # last filled
|
1820
|
-
# "z": "0", # total filled
|
1821
|
-
# "L": "0", # last traded price
|
1822
|
-
# "n": "0", # trading fee
|
1823
|
-
# "N": '', # fee asset
|
1824
|
-
# "u": True,
|
1825
|
-
# "w": True,
|
1826
|
-
# "m": False, # is limit_maker
|
1827
|
-
# "O": "1653297251042", # order creation
|
1828
|
-
# "Z": "0", # total filled
|
1829
|
-
# "A": "0", # account id
|
1830
|
-
# "C": False, # is close
|
1831
|
-
# "v": "0", # leverage
|
1832
|
-
# "d": "NO_LIQ"
|
1833
|
-
# }
|
1834
|
-
# v5
|
1835
|
-
# {
|
1836
|
-
# "category":"spot",
|
1837
|
-
# "symbol":"LTCUSDT",
|
1838
|
-
# "orderId":"1474764674982492160",
|
1839
|
-
# "orderLinkId":"1690541649154749",
|
1840
|
-
# "blockTradeId":"",
|
1841
|
-
# "side":"Buy",
|
1842
|
-
# "positionIdx":0,
|
1843
|
-
# "orderStatus":"Cancelled",
|
1844
|
-
# "cancelType":"UNKNOWN",
|
1845
|
-
# "rejectReason":"EC_NoError",
|
1846
|
-
# "timeInForce":"GTC",
|
1847
|
-
# "isLeverage":"0",
|
1848
|
-
# "price":"0",
|
1849
|
-
# "qty":"5.00000",
|
1850
|
-
# "avgPrice":"0",
|
1851
|
-
# "leavesQty":"0.00000",
|
1852
|
-
# "leavesValue":"5.0000000",
|
1853
|
-
# "cumExecQty":"0.00000",
|
1854
|
-
# "cumExecValue":"0.0000000",
|
1855
|
-
# "cumExecFee":"",
|
1856
|
-
# "orderType":"Market",
|
1857
|
-
# "stopOrderType":"",
|
1858
|
-
# "orderIv":"",
|
1859
|
-
# "triggerPrice":"0.000",
|
1860
|
-
# "takeProfit":"",
|
1861
|
-
# "stopLoss":"",
|
1862
|
-
# "triggerBy":"",
|
1863
|
-
# "tpTriggerBy":"",
|
1864
|
-
# "slTriggerBy":"",
|
1865
|
-
# "triggerDirection":0,
|
1866
|
-
# "placeType":"",
|
1867
|
-
# "lastPriceOnCreated":"0.000",
|
1868
|
-
# "closeOnTrigger":false,
|
1869
|
-
# "reduceOnly":false,
|
1870
|
-
# "smpGroup":0,
|
1871
|
-
# "smpType":"None",
|
1872
|
-
# "smpOrderId":"",
|
1873
|
-
# "createdTime":"1690541649160",
|
1874
|
-
# "updatedTime":"1690541649168"
|
1875
|
-
# }
|
1876
|
-
#
|
1877
|
-
id = self.safe_string_2(order, 'i', 'orderId')
|
1878
|
-
marketId = self.safe_string_2(order, 's', 'symbol')
|
1879
|
-
symbol = self.safe_symbol(marketId, market, None, 'spot')
|
1880
|
-
timestamp = self.safe_integer_2(order, 'O', 'createdTime')
|
1881
|
-
price = self.safe_string_2(order, 'p', 'price')
|
1882
|
-
if price == '0':
|
1883
|
-
price = None # market orders
|
1884
|
-
filled = self.safe_string_2(order, 'z', 'cumExecQty')
|
1885
|
-
status = self.parse_order_status(self.safe_string_2(order, 'X', 'orderStatus'))
|
1886
|
-
side = self.safe_string_lower_2(order, 'S', 'side')
|
1887
|
-
lastTradeTimestamp = self.safe_string_2(order, 'E', 'updatedTime')
|
1888
|
-
timeInForce = self.safe_string_2(order, 'f', 'timeInForce')
|
1889
|
-
amount = None
|
1890
|
-
cost = self.safe_string_2(order, 'Z', 'cumExecValue')
|
1891
|
-
type = self.safe_string_lower_2(order, 'o', 'orderType')
|
1892
|
-
if (type is not None) and (type.find('market') >= 0):
|
1893
|
-
type = 'market'
|
1894
|
-
if type == 'market' and side == 'buy':
|
1895
|
-
amount = filled
|
1896
|
-
else:
|
1897
|
-
amount = self.safe_string_2(order, 'orderQty', 'qty')
|
1898
|
-
fee = None
|
1899
|
-
feeCost = self.safe_string_2(order, 'n', 'cumExecFee')
|
1900
|
-
if feeCost is not None and feeCost != '0':
|
1901
|
-
feeCurrencyId = self.safe_string(order, 'N')
|
1902
|
-
feeCurrencyCode = self.safe_currency_code(feeCurrencyId)
|
1903
|
-
fee = {
|
1904
|
-
'cost': feeCost,
|
1905
|
-
'currency': feeCurrencyCode,
|
1906
|
-
}
|
1907
|
-
triggerPrice = self.omit_zero(self.safe_string(order, 'triggerPrice'))
|
1908
|
-
return self.safe_order({
|
1909
|
-
'info': order,
|
1910
|
-
'id': id,
|
1911
|
-
'clientOrderId': self.safe_string_2(order, 'c', 'orderLinkId'),
|
1912
|
-
'timestamp': timestamp,
|
1913
|
-
'datetime': self.iso8601(timestamp),
|
1914
|
-
'lastTradeTimestamp': lastTradeTimestamp,
|
1915
|
-
'symbol': symbol,
|
1916
|
-
'type': type,
|
1917
|
-
'timeInForce': timeInForce,
|
1918
|
-
'postOnly': None,
|
1919
|
-
'side': side,
|
1920
|
-
'price': price,
|
1921
|
-
'stopPrice': triggerPrice,
|
1922
|
-
'triggerPrice': triggerPrice,
|
1923
|
-
'takeProfitPrice': self.safe_string(order, 'takeProfit'),
|
1924
|
-
'stopLossPrice': self.safe_string(order, 'stopLoss'),
|
1925
|
-
'reduceOnly': self.safe_value(order, 'reduceOnly'),
|
1926
|
-
'amount': amount,
|
1927
|
-
'cost': cost,
|
1928
|
-
'average': self.safe_string(order, 'avgPrice'),
|
1929
|
-
'filled': filled,
|
1930
|
-
'remaining': None,
|
1931
|
-
'status': status,
|
1932
|
-
'fee': fee,
|
1933
|
-
}, market)
|
1934
|
-
|
1935
1804
|
async def watch_balance(self, params={}) -> Balances:
|
1936
1805
|
"""
|
1937
1806
|
watch balance and get the amount of funds available for trading or funds locked in orders
|