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