ccxt 4.4.6__py2.py3-none-any.whl → 4.4.8__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 -1
- ccxt/abstract/binance.py +1 -0
- ccxt/abstract/binancecoinm.py +1 -0
- ccxt/abstract/binanceus.py +1 -0
- ccxt/abstract/binanceusdm.py +1 -0
- ccxt/abstract/bybit.py +5 -0
- ccxt/abstract/okx.py +2 -0
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +12 -3
- ccxt/async_support/binance.py +49 -12
- ccxt/async_support/bingx.py +3 -0
- ccxt/async_support/bitget.py +8 -4
- ccxt/async_support/bitmart.py +109 -1
- ccxt/async_support/bybit.py +364 -11
- ccxt/async_support/gate.py +3 -0
- ccxt/async_support/htx.py +20 -0
- ccxt/async_support/kucoin.py +2 -2
- ccxt/async_support/mexc.py +85 -13
- ccxt/async_support/okx.py +4 -0
- ccxt/base/exchange.py +16 -3
- ccxt/binance.py +49 -12
- ccxt/bingx.py +3 -0
- ccxt/bitget.py +8 -4
- ccxt/bitmart.py +109 -1
- ccxt/bybit.py +364 -11
- ccxt/gate.py +3 -0
- ccxt/htx.py +20 -0
- ccxt/kucoin.py +2 -2
- ccxt/mexc.py +85 -13
- ccxt/okx.py +4 -0
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/bitget.py +62 -0
- ccxt/pro/bitmart.py +72 -0
- ccxt/pro/bitvavo.py +87 -2
- ccxt/pro/blofin.py +59 -0
- ccxt/pro/okx.py +11 -5
- {ccxt-4.4.6.dist-info → ccxt-4.4.8.dist-info}/METADATA +4 -4
- {ccxt-4.4.6.dist-info → ccxt-4.4.8.dist-info}/RECORD +41 -41
- {ccxt-4.4.6.dist-info → ccxt-4.4.8.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.6.dist-info → ccxt-4.4.8.dist-info}/WHEEL +0 -0
- {ccxt-4.4.6.dist-info → ccxt-4.4.8.dist-info}/top_level.txt +0 -0
ccxt/async_support/bybit.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.bybit import ImplicitAPI
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
|
-
from ccxt.base.types import Balances, CrossBorrowRate, Currencies, Currency, Greeks, Int, LedgerEntry, Leverage, LeverageTier, LeverageTiers, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
|
10
|
+
from ccxt.base.types import Balances, Conversion, CrossBorrowRate, Currencies, Currency, Greeks, Int, LedgerEntry, Leverage, LeverageTier, LeverageTiers, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, 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
|
@@ -57,6 +57,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
57
57
|
'cancelOrdersForSymbols': True,
|
58
58
|
'closeAllPositions': False,
|
59
59
|
'closePosition': False,
|
60
|
+
'createConvertTrade': True,
|
60
61
|
'createMarketBuyOrderWithCost': True,
|
61
62
|
'createMarketSellOrderWithCost': True,
|
62
63
|
'createOrder': True,
|
@@ -80,6 +81,10 @@ class bybit(Exchange, ImplicitAPI):
|
|
80
81
|
'fetchCanceledOrders': True,
|
81
82
|
'fetchClosedOrder': True,
|
82
83
|
'fetchClosedOrders': True,
|
84
|
+
'fetchConvertCurrencies': True,
|
85
|
+
'fetchConvertQuote': True,
|
86
|
+
'fetchConvertTrade': True,
|
87
|
+
'fetchConvertTradeHistory': True,
|
83
88
|
'fetchCrossBorrowRate': True,
|
84
89
|
'fetchCrossBorrowRates': False,
|
85
90
|
'fetchCurrencies': True,
|
@@ -346,6 +351,9 @@ class bybit(Exchange, ImplicitAPI):
|
|
346
351
|
'v5/account/smp-group': 1,
|
347
352
|
'v5/account/mmp-state': 5,
|
348
353
|
# asset
|
354
|
+
'v5/asset/exchange/query-coin-list': 0.5, # 100/s => cost = 50 / 100 = 0.5
|
355
|
+
'v5/asset/exchange/convert-result-query': 0.5, # 100/s => cost = 50 / 100 = 0.5
|
356
|
+
'v5/asset/exchange/query-convert-history': 0.5, # 100/s => cost = 50 / 100 = 0.5
|
349
357
|
'v5/asset/exchange/order-record': 5, # 10/s => cost = 50 / 10 = 5
|
350
358
|
'v5/asset/delivery-record': 5,
|
351
359
|
'v5/asset/settlement-record': 5,
|
@@ -504,6 +512,8 @@ class bybit(Exchange, ImplicitAPI):
|
|
504
512
|
'v5/account/mmp-modify': 5,
|
505
513
|
'v5/account/mmp-reset': 5,
|
506
514
|
# asset
|
515
|
+
'v5/asset/exchange/quote-apply': 1, # 50/s
|
516
|
+
'v5/asset/exchange/convert-execute': 1, # 50/s
|
507
517
|
'v5/asset/transfer/inter-transfer': 50, # 1/s => cost = 50 / 1 = 50
|
508
518
|
'v5/asset/transfer/save-transfer-sub-member': 150, # 1/3/s => cost = 50 / 1/3 = 150
|
509
519
|
'v5/asset/transfer/universal-transfer': 10, # 5/s => cost = 50 / 5 = 10
|
@@ -5786,13 +5796,17 @@ class bybit(Exchange, ImplicitAPI):
|
|
5786
5796
|
currencyId = self.safe_string_2(item, 'coin', 'currency')
|
5787
5797
|
code = self.safe_currency_code(currencyId, currency)
|
5788
5798
|
currency = self.safe_currency(currencyId, currency)
|
5789
|
-
|
5790
|
-
|
5791
|
-
direction = 'out' if Precise.string_lt(
|
5799
|
+
amountString = self.safe_string_2(item, 'amount', 'change')
|
5800
|
+
afterString = self.safe_string_2(item, 'wallet_balance', 'cashBalance')
|
5801
|
+
direction = 'out' if Precise.string_lt(amountString, '0') else 'in'
|
5792
5802
|
before = None
|
5793
|
-
|
5794
|
-
|
5795
|
-
|
5803
|
+
after = None
|
5804
|
+
amount = None
|
5805
|
+
if afterString is not None and amountString is not None:
|
5806
|
+
difference = amountString if (direction == 'out') else Precise.string_neg(amountString)
|
5807
|
+
before = self.parse_to_numeric(Precise.string_add(afterString, difference))
|
5808
|
+
after = self.parse_to_numeric(afterString)
|
5809
|
+
amount = self.parse_to_numeric(Precise.string_abs(amountString))
|
5796
5810
|
timestamp = self.parse8601(self.safe_string(item, 'exec_time'))
|
5797
5811
|
if timestamp is None:
|
5798
5812
|
timestamp = self.safe_integer(item, 'transactionTime')
|
@@ -5805,15 +5819,15 @@ class bybit(Exchange, ImplicitAPI):
|
|
5805
5819
|
'referenceAccount': None,
|
5806
5820
|
'type': self.parse_ledger_entry_type(self.safe_string(item, 'type')),
|
5807
5821
|
'currency': code,
|
5808
|
-
'amount':
|
5822
|
+
'amount': amount,
|
5809
5823
|
'timestamp': timestamp,
|
5810
5824
|
'datetime': self.iso8601(timestamp),
|
5811
|
-
'before':
|
5812
|
-
'after':
|
5825
|
+
'before': before,
|
5826
|
+
'after': after,
|
5813
5827
|
'status': 'ok',
|
5814
5828
|
'fee': {
|
5815
5829
|
'currency': code,
|
5816
|
-
'cost': self.
|
5830
|
+
'cost': self.safe_number(item, 'fee'),
|
5817
5831
|
},
|
5818
5832
|
}, currency)
|
5819
5833
|
|
@@ -8242,6 +8256,345 @@ class bybit(Exchange, ImplicitAPI):
|
|
8242
8256
|
positions = self.parse_positions(rawPositions, symbols, params)
|
8243
8257
|
return self.filter_by_since_limit(positions, since, limit)
|
8244
8258
|
|
8259
|
+
async def fetch_convert_currencies(self, params={}) -> Currencies:
|
8260
|
+
"""
|
8261
|
+
fetches all available currencies that can be converted
|
8262
|
+
:see: https://bybit-exchange.github.io/docs/v5/asset/convert/convert-coin-list
|
8263
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
8264
|
+
:param str [params.accountType]: eb_convert_uta, eb_convert_spot, eb_convert_funding, eb_convert_inverse, or eb_convert_contract
|
8265
|
+
:returns dict: an associative dictionary of currencies
|
8266
|
+
"""
|
8267
|
+
await self.load_markets()
|
8268
|
+
accountType = None
|
8269
|
+
enableUnifiedMargin, enableUnifiedAccount = await self.is_unified_enabled()
|
8270
|
+
isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
|
8271
|
+
accountTypeDefault = 'eb_convert_uta' if isUnifiedAccount else 'eb_convert_spot'
|
8272
|
+
accountType, params = self.handle_option_and_params(params, 'fetchConvertCurrencies', 'accountType', accountTypeDefault)
|
8273
|
+
request: dict = {
|
8274
|
+
'accountType': accountType,
|
8275
|
+
}
|
8276
|
+
response = await self.privateGetV5AssetExchangeQueryCoinList(self.extend(request, params))
|
8277
|
+
#
|
8278
|
+
# {
|
8279
|
+
# "retCode": 0,
|
8280
|
+
# "retMsg": "ok",
|
8281
|
+
# "result": {
|
8282
|
+
# "coins": [
|
8283
|
+
# {
|
8284
|
+
# "coin": "MATIC",
|
8285
|
+
# "fullName": "MATIC",
|
8286
|
+
# "icon": "https://s1.bycsi.com/app/assets/token/0552ae79c535c3095fa18f7b377dd2e9.svg",
|
8287
|
+
# "iconNight": "https://t1.bycsi.com/app/assets/token/f59301aef2d6ac2165c4c4603e672fb4.svg",
|
8288
|
+
# "accuracyLength": 8,
|
8289
|
+
# "coinType": "crypto",
|
8290
|
+
# "balance": "0",
|
8291
|
+
# "uBalance": "0",
|
8292
|
+
# "timePeriod": 0,
|
8293
|
+
# "singleFromMinLimit": "1.1",
|
8294
|
+
# "singleFromMaxLimit": "20001",
|
8295
|
+
# "singleToMinLimit": "0",
|
8296
|
+
# "singleToMaxLimit": "0",
|
8297
|
+
# "dailyFromMinLimit": "0",
|
8298
|
+
# "dailyFromMaxLimit": "0",
|
8299
|
+
# "dailyToMinLimit": "0",
|
8300
|
+
# "dailyToMaxLimit": "0",
|
8301
|
+
# "disableFrom": False,
|
8302
|
+
# "disableTo": False
|
8303
|
+
# },
|
8304
|
+
# ]
|
8305
|
+
# },
|
8306
|
+
# "retExtInfo": {},
|
8307
|
+
# "time": 1727256416250
|
8308
|
+
# }
|
8309
|
+
#
|
8310
|
+
result: dict = {}
|
8311
|
+
data = self.safe_dict(response, 'result', {})
|
8312
|
+
coins = self.safe_list(data, 'coins', [])
|
8313
|
+
for i in range(0, len(coins)):
|
8314
|
+
entry = coins[i]
|
8315
|
+
id = self.safe_string(entry, 'coin')
|
8316
|
+
disableFrom = self.safe_bool(entry, 'disableFrom')
|
8317
|
+
disableTo = self.safe_bool(entry, 'disableTo')
|
8318
|
+
inactive = (disableFrom or disableTo)
|
8319
|
+
code = self.safe_currency_code(id)
|
8320
|
+
result[code] = {
|
8321
|
+
'info': entry,
|
8322
|
+
'id': id,
|
8323
|
+
'code': code,
|
8324
|
+
'networks': None,
|
8325
|
+
'type': self.safe_string(entry, 'coinType'),
|
8326
|
+
'name': self.safe_string(entry, 'fullName'),
|
8327
|
+
'active': not inactive,
|
8328
|
+
'deposit': None,
|
8329
|
+
'withdraw': self.safe_number(entry, 'balance'),
|
8330
|
+
'fee': None,
|
8331
|
+
'precision': None,
|
8332
|
+
'limits': {
|
8333
|
+
'amount': {
|
8334
|
+
'min': self.safe_number(entry, 'singleFromMinLimit'),
|
8335
|
+
'max': self.safe_number(entry, 'singleFromMaxLimit'),
|
8336
|
+
},
|
8337
|
+
'withdraw': {
|
8338
|
+
'min': None,
|
8339
|
+
'max': None,
|
8340
|
+
},
|
8341
|
+
'deposit': {
|
8342
|
+
'min': None,
|
8343
|
+
'max': None,
|
8344
|
+
},
|
8345
|
+
},
|
8346
|
+
'created': None,
|
8347
|
+
}
|
8348
|
+
return result
|
8349
|
+
|
8350
|
+
async def fetch_convert_quote(self, fromCode: str, toCode: str, amount: Num = None, params={}) -> Conversion:
|
8351
|
+
"""
|
8352
|
+
fetch a quote for converting from one currency to another
|
8353
|
+
:see: https://bybit-exchange.github.io/docs/v5/asset/convert/apply-quote
|
8354
|
+
:param str fromCode: the currency that you want to sell and convert from
|
8355
|
+
:param str toCode: the currency that you want to buy and convert into
|
8356
|
+
:param float [amount]: how much you want to trade in units of the from currency
|
8357
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
8358
|
+
:param str [params.accountType]: eb_convert_uta, eb_convert_spot, eb_convert_funding, eb_convert_inverse, or eb_convert_contract
|
8359
|
+
:returns dict: a `conversion structure <https://docs.ccxt.com/#/?id=conversion-structure>`
|
8360
|
+
"""
|
8361
|
+
await self.load_markets()
|
8362
|
+
accountType = None
|
8363
|
+
enableUnifiedMargin, enableUnifiedAccount = await self.is_unified_enabled()
|
8364
|
+
isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
|
8365
|
+
accountTypeDefault = 'eb_convert_uta' if isUnifiedAccount else 'eb_convert_spot'
|
8366
|
+
accountType, params = self.handle_option_and_params(params, 'fetchConvertQuote', 'accountType', accountTypeDefault)
|
8367
|
+
request: dict = {
|
8368
|
+
'fromCoin': fromCode,
|
8369
|
+
'toCoin': toCode,
|
8370
|
+
'requestAmount': self.number_to_string(amount),
|
8371
|
+
'requestCoin': fromCode,
|
8372
|
+
'accountType': accountType,
|
8373
|
+
}
|
8374
|
+
response = await self.privatePostV5AssetExchangeQuoteApply(self.extend(request, params))
|
8375
|
+
#
|
8376
|
+
# {
|
8377
|
+
# "retCode": 0,
|
8378
|
+
# "retMsg": "ok",
|
8379
|
+
# "result": {
|
8380
|
+
# "quoteTxId": "1010020692439481682687668224",
|
8381
|
+
# "exchangeRate": "0.000015330836780000",
|
8382
|
+
# "fromCoin": "USDT",
|
8383
|
+
# "fromCoinType": "crypto",
|
8384
|
+
# "toCoin": "BTC",
|
8385
|
+
# "toCoinType": "crypto",
|
8386
|
+
# "fromAmount": "10",
|
8387
|
+
# "toAmount": "0.000153308367800000",
|
8388
|
+
# "expiredTime": "1727257413353",
|
8389
|
+
# "requestId": ""
|
8390
|
+
# },
|
8391
|
+
# "retExtInfo": {},
|
8392
|
+
# "time": 1727257398375
|
8393
|
+
# }
|
8394
|
+
#
|
8395
|
+
data = self.safe_dict(response, 'result', {})
|
8396
|
+
fromCurrencyId = self.safe_string(data, 'fromCoin', fromCode)
|
8397
|
+
fromCurrency = self.currency(fromCurrencyId)
|
8398
|
+
toCurrencyId = self.safe_string(data, 'toCoin', toCode)
|
8399
|
+
toCurrency = self.currency(toCurrencyId)
|
8400
|
+
return self.parse_conversion(data, fromCurrency, toCurrency)
|
8401
|
+
|
8402
|
+
async def create_convert_trade(self, id: str, fromCode: str, toCode: str, amount: Num = None, params={}) -> Conversion:
|
8403
|
+
"""
|
8404
|
+
convert from one currency to another
|
8405
|
+
:see: https://bybit-exchange.github.io/docs/v5/asset/convert/confirm-quote
|
8406
|
+
:param str id: the id of the trade that you want to make
|
8407
|
+
:param str fromCode: the currency that you want to sell and convert from
|
8408
|
+
:param str toCode: the currency that you want to buy and convert into
|
8409
|
+
:param float amount: how much you want to trade in units of the from currency
|
8410
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
8411
|
+
:returns dict: a `conversion structure <https://docs.ccxt.com/#/?id=conversion-structure>`
|
8412
|
+
"""
|
8413
|
+
await self.load_markets()
|
8414
|
+
request: dict = {
|
8415
|
+
'quoteTxId': id,
|
8416
|
+
}
|
8417
|
+
response = await self.privatePostV5AssetExchangeConvertExecute(self.extend(request, params))
|
8418
|
+
#
|
8419
|
+
# {
|
8420
|
+
# "retCode": 0,
|
8421
|
+
# "retMsg": "ok",
|
8422
|
+
# "result": {
|
8423
|
+
# "exchangeStatus": "processing",
|
8424
|
+
# "quoteTxId": "1010020692439483803499737088"
|
8425
|
+
# },
|
8426
|
+
# "retExtInfo": {},
|
8427
|
+
# "time": 1727257904969
|
8428
|
+
# }
|
8429
|
+
#
|
8430
|
+
data = self.safe_dict(response, 'result', {})
|
8431
|
+
return self.parse_conversion(data)
|
8432
|
+
|
8433
|
+
async def fetch_convert_trade(self, id: str, code: Str = None, params={}) -> Conversion:
|
8434
|
+
"""
|
8435
|
+
fetch the data for a conversion trade
|
8436
|
+
:see: https://bybit-exchange.github.io/docs/v5/asset/convert/get-convert-result
|
8437
|
+
:param str id: the id of the trade that you want to fetch
|
8438
|
+
:param str [code]: the unified currency code of the conversion trade
|
8439
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
8440
|
+
:param str [params.accountType]: eb_convert_uta, eb_convert_spot, eb_convert_funding, eb_convert_inverse, or eb_convert_contract
|
8441
|
+
:returns dict: a `conversion structure <https://docs.ccxt.com/#/?id=conversion-structure>`
|
8442
|
+
"""
|
8443
|
+
await self.load_markets()
|
8444
|
+
accountType = None
|
8445
|
+
enableUnifiedMargin, enableUnifiedAccount = await self.is_unified_enabled()
|
8446
|
+
isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
|
8447
|
+
accountTypeDefault = 'eb_convert_uta' if isUnifiedAccount else 'eb_convert_spot'
|
8448
|
+
accountType, params = self.handle_option_and_params(params, 'fetchConvertQuote', 'accountType', accountTypeDefault)
|
8449
|
+
request: dict = {
|
8450
|
+
'quoteTxId': id,
|
8451
|
+
'accountType': accountType,
|
8452
|
+
}
|
8453
|
+
response = await self.privateGetV5AssetExchangeConvertResultQuery(self.extend(request, params))
|
8454
|
+
#
|
8455
|
+
# {
|
8456
|
+
# "retCode": 0,
|
8457
|
+
# "retMsg": "ok",
|
8458
|
+
# "result": {
|
8459
|
+
# "result": {
|
8460
|
+
# "accountType": "eb_convert_uta",
|
8461
|
+
# "exchangeTxId": "1010020692439483803499737088",
|
8462
|
+
# "userId": "100406395",
|
8463
|
+
# "fromCoin": "USDT",
|
8464
|
+
# "fromCoinType": "crypto",
|
8465
|
+
# "fromAmount": "10",
|
8466
|
+
# "toCoin": "BTC",
|
8467
|
+
# "toCoinType": "crypto",
|
8468
|
+
# "toAmount": "0.00015344889",
|
8469
|
+
# "exchangeStatus": "success",
|
8470
|
+
# "extInfo": {},
|
8471
|
+
# "convertRate": "0.000015344889",
|
8472
|
+
# "createdAt": "1727257904726"
|
8473
|
+
# }
|
8474
|
+
# },
|
8475
|
+
# "retExtInfo": {},
|
8476
|
+
# "time": 1727258257216
|
8477
|
+
# }
|
8478
|
+
#
|
8479
|
+
data = self.safe_dict(response, 'result', {})
|
8480
|
+
result = self.safe_dict(data, 'result', {})
|
8481
|
+
fromCurrencyId = self.safe_string(result, 'fromCoin')
|
8482
|
+
toCurrencyId = self.safe_string(result, 'toCoin')
|
8483
|
+
fromCurrency = None
|
8484
|
+
toCurrency = None
|
8485
|
+
if fromCurrencyId is not None:
|
8486
|
+
fromCurrency = self.currency(fromCurrencyId)
|
8487
|
+
if toCurrencyId is not None:
|
8488
|
+
toCurrency = self.currency(toCurrencyId)
|
8489
|
+
return self.parse_conversion(result, fromCurrency, toCurrency)
|
8490
|
+
|
8491
|
+
async def fetch_convert_trade_history(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Conversion]:
|
8492
|
+
"""
|
8493
|
+
fetch the users history of conversion trades
|
8494
|
+
:see: https://bybit-exchange.github.io/docs/v5/asset/convert/get-convert-history
|
8495
|
+
:param str [code]: the unified currency code
|
8496
|
+
:param int [since]: the earliest time in ms to fetch conversions for
|
8497
|
+
:param int [limit]: the maximum number of conversion structures to retrieve
|
8498
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
8499
|
+
:param str [params.accountType]: eb_convert_uta, eb_convert_spot, eb_convert_funding, eb_convert_inverse, or eb_convert_contract
|
8500
|
+
:returns dict[]: a list of `conversion structures <https://docs.ccxt.com/#/?id=conversion-structure>`
|
8501
|
+
"""
|
8502
|
+
await self.load_markets()
|
8503
|
+
request: dict = {}
|
8504
|
+
if limit is not None:
|
8505
|
+
request['limit'] = limit
|
8506
|
+
response = await self.privateGetV5AssetExchangeQueryConvertHistory(self.extend(request, params))
|
8507
|
+
#
|
8508
|
+
# {
|
8509
|
+
# "retCode": 0,
|
8510
|
+
# "retMsg": "ok",
|
8511
|
+
# "result": {
|
8512
|
+
# "list": [
|
8513
|
+
# {
|
8514
|
+
# "accountType": "eb_convert_uta",
|
8515
|
+
# "exchangeTxId": "1010020692439483803499737088",
|
8516
|
+
# "userId": "100406395",
|
8517
|
+
# "fromCoin": "USDT",
|
8518
|
+
# "fromCoinType": "crypto",
|
8519
|
+
# "fromAmount": "10",
|
8520
|
+
# "toCoin": "BTC",
|
8521
|
+
# "toCoinType": "crypto",
|
8522
|
+
# "toAmount": "0.00015344889",
|
8523
|
+
# "exchangeStatus": "success",
|
8524
|
+
# "extInfo": {},
|
8525
|
+
# "convertRate": "0.000015344889",
|
8526
|
+
# "createdAt": "1727257904726"
|
8527
|
+
# }
|
8528
|
+
# ]
|
8529
|
+
# },
|
8530
|
+
# "retExtInfo": {},
|
8531
|
+
# "time": 1727258761874
|
8532
|
+
# }
|
8533
|
+
#
|
8534
|
+
data = self.safe_dict(response, 'result', {})
|
8535
|
+
dataList = self.safe_list(data, 'list', [])
|
8536
|
+
return self.parse_conversions(dataList, code, 'fromCoin', 'toCoin', since, limit)
|
8537
|
+
|
8538
|
+
def parse_conversion(self, conversion: dict, fromCurrency: Currency = None, toCurrency: Currency = None) -> Conversion:
|
8539
|
+
#
|
8540
|
+
# fetchConvertQuote
|
8541
|
+
#
|
8542
|
+
# {
|
8543
|
+
# "quoteTxId": "1010020692439481682687668224",
|
8544
|
+
# "exchangeRate": "0.000015330836780000",
|
8545
|
+
# "fromCoin": "USDT",
|
8546
|
+
# "fromCoinType": "crypto",
|
8547
|
+
# "toCoin": "BTC",
|
8548
|
+
# "toCoinType": "crypto",
|
8549
|
+
# "fromAmount": "10",
|
8550
|
+
# "toAmount": "0.000153308367800000",
|
8551
|
+
# "expiredTime": "1727257413353",
|
8552
|
+
# "requestId": ""
|
8553
|
+
# }
|
8554
|
+
#
|
8555
|
+
# createConvertTrade
|
8556
|
+
#
|
8557
|
+
# {
|
8558
|
+
# "exchangeStatus": "processing",
|
8559
|
+
# "quoteTxId": "1010020692439483803499737088"
|
8560
|
+
# }
|
8561
|
+
#
|
8562
|
+
# fetchConvertTrade, fetchConvertTradeHistory
|
8563
|
+
#
|
8564
|
+
# {
|
8565
|
+
# "accountType": "eb_convert_uta",
|
8566
|
+
# "exchangeTxId": "1010020692439483803499737088",
|
8567
|
+
# "userId": "100406395",
|
8568
|
+
# "fromCoin": "USDT",
|
8569
|
+
# "fromCoinType": "crypto",
|
8570
|
+
# "fromAmount": "10",
|
8571
|
+
# "toCoin": "BTC",
|
8572
|
+
# "toCoinType": "crypto",
|
8573
|
+
# "toAmount": "0.00015344889",
|
8574
|
+
# "exchangeStatus": "success",
|
8575
|
+
# "extInfo": {},
|
8576
|
+
# "convertRate": "0.000015344889",
|
8577
|
+
# "createdAt": "1727257904726"
|
8578
|
+
# }
|
8579
|
+
#
|
8580
|
+
timestamp = self.safe_integer_2(conversion, 'expiredTime', 'createdAt')
|
8581
|
+
fromCoin = self.safe_string(conversion, 'fromCoin')
|
8582
|
+
fromCode = self.safe_currency_code(fromCoin, fromCurrency)
|
8583
|
+
to = self.safe_string(conversion, 'toCoin')
|
8584
|
+
toCode = self.safe_currency_code(to, toCurrency)
|
8585
|
+
return {
|
8586
|
+
'info': conversion,
|
8587
|
+
'timestamp': timestamp,
|
8588
|
+
'datetime': self.iso8601(timestamp),
|
8589
|
+
'id': self.safe_string_2(conversion, 'quoteTxId', 'exchangeTxId'),
|
8590
|
+
'fromCurrency': fromCode,
|
8591
|
+
'fromAmount': self.safe_number(conversion, 'fromAmount'),
|
8592
|
+
'toCurrency': toCode,
|
8593
|
+
'toAmount': self.safe_number(conversion, 'toAmount'),
|
8594
|
+
'price': None,
|
8595
|
+
'fee': None,
|
8596
|
+
}
|
8597
|
+
|
8245
8598
|
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
|
8246
8599
|
url = self.implode_hostname(self.urls['api'][api]) + '/' + path
|
8247
8600
|
if api == 'public':
|
ccxt/async_support/gate.py
CHANGED
ccxt/async_support/htx.py
CHANGED
@@ -2031,6 +2031,10 @@ class htx(Exchange, ImplicitAPI):
|
|
2031
2031
|
async def fetch_ticker(self, symbol: str, params={}) -> Ticker:
|
2032
2032
|
"""
|
2033
2033
|
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
2034
|
+
:see: https://huobiapi.github.io/docs/spot/v1/en/#get-latest-aggregated-ticker
|
2035
|
+
:see: https://huobiapi.github.io/docs/dm/v1/en/#get-market-data-overview
|
2036
|
+
:see: https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-market-data-overview
|
2037
|
+
:see: https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-get-market-data-overview
|
2034
2038
|
:param str symbol: unified symbol of the market to fetch the ticker for
|
2035
2039
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2036
2040
|
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -2324,6 +2328,10 @@ class htx(Exchange, ImplicitAPI):
|
|
2324
2328
|
async def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
|
2325
2329
|
"""
|
2326
2330
|
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
2331
|
+
:see: https://huobiapi.github.io/docs/spot/v1/en/#get-market-depth
|
2332
|
+
:see: https://huobiapi.github.io/docs/dm/v1/en/#get-market-depth
|
2333
|
+
:see: https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-market-depth
|
2334
|
+
:see: https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-get-market-depth
|
2327
2335
|
:param str symbol: unified symbol of the market to fetch the order book for
|
2328
2336
|
:param int [limit]: the maximum amount of order book entries to return
|
2329
2337
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -2535,6 +2543,7 @@ class htx(Exchange, ImplicitAPI):
|
|
2535
2543
|
async def fetch_order_trades(self, id: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
2536
2544
|
"""
|
2537
2545
|
fetch all the trades made from a single order
|
2546
|
+
:see: https://huobiapi.github.io/docs/spot/v1/en/#get-the-match-result-of-an-order
|
2538
2547
|
:param str id: order id
|
2539
2548
|
:param str symbol: unified market symbol
|
2540
2549
|
:param int [since]: the earliest time in ms to fetch trades for
|
@@ -2552,6 +2561,17 @@ class htx(Exchange, ImplicitAPI):
|
|
2552
2561
|
return await self.fetch_spot_order_trades(id, symbol, since, limit, params)
|
2553
2562
|
|
2554
2563
|
async def fetch_spot_order_trades(self, id: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
2564
|
+
"""
|
2565
|
+
* @ignore
|
2566
|
+
fetch all the trades made from a single order
|
2567
|
+
:see: https://huobiapi.github.io/docs/spot/v1/en/#get-the-match-result-of-an-order
|
2568
|
+
:param str id: order id
|
2569
|
+
:param str symbol: unified market symbol
|
2570
|
+
:param int [since]: the earliest time in ms to fetch trades for
|
2571
|
+
:param int [limit]: the maximum number of trades to retrieve
|
2572
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2573
|
+
:returns dict[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
|
2574
|
+
"""
|
2555
2575
|
await self.load_markets()
|
2556
2576
|
request: dict = {
|
2557
2577
|
'order-id': id,
|
ccxt/async_support/kucoin.py
CHANGED
@@ -778,7 +778,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
778
778
|
'hf': 'trade_hf',
|
779
779
|
},
|
780
780
|
'networks': {
|
781
|
-
'
|
781
|
+
'BRC20': 'btc',
|
782
782
|
'BTCNATIVESEGWIT': 'bech32',
|
783
783
|
'ERC20': 'eth',
|
784
784
|
'TRC20': 'trx',
|
@@ -1344,7 +1344,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1344
1344
|
for j in range(0, chainsLength):
|
1345
1345
|
chain = chains[j]
|
1346
1346
|
chainId = self.safe_string(chain, 'chainId')
|
1347
|
-
networkCode = self.network_id_to_code(chainId)
|
1347
|
+
networkCode = self.network_id_to_code(chainId, code)
|
1348
1348
|
chainWithdrawEnabled = self.safe_bool(chain, 'isWithdrawEnabled', False)
|
1349
1349
|
if isWithdrawEnabled is None:
|
1350
1350
|
isWithdrawEnabled = chainWithdrawEnabled
|