ccxt 4.4.7__py2.py3-none-any.whl → 4.4.9__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.
Files changed (47) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/bigone.py +1 -1
  3. ccxt/abstract/binance.py +1 -0
  4. ccxt/abstract/binancecoinm.py +1 -0
  5. ccxt/abstract/binanceus.py +1 -0
  6. ccxt/abstract/binanceusdm.py +1 -0
  7. ccxt/abstract/bybit.py +5 -0
  8. ccxt/abstract/kucoinfutures.py +5 -0
  9. ccxt/abstract/okx.py +2 -0
  10. ccxt/async_support/__init__.py +1 -1
  11. ccxt/async_support/base/exchange.py +1 -1
  12. ccxt/async_support/bigone.py +35 -86
  13. ccxt/async_support/binance.py +49 -12
  14. ccxt/async_support/bingx.py +7 -2
  15. ccxt/async_support/bitget.py +3 -0
  16. ccxt/async_support/bybit.py +354 -2
  17. ccxt/async_support/gate.py +30 -1
  18. ccxt/async_support/htx.py +22 -0
  19. ccxt/async_support/kucoin.py +1 -0
  20. ccxt/async_support/kucoinfutures.py +152 -3
  21. ccxt/async_support/okx.py +4 -0
  22. ccxt/base/exchange.py +1 -1
  23. ccxt/bigone.py +35 -86
  24. ccxt/binance.py +49 -12
  25. ccxt/bingx.py +7 -2
  26. ccxt/bitget.py +3 -0
  27. ccxt/bybit.py +354 -2
  28. ccxt/gate.py +30 -1
  29. ccxt/htx.py +22 -0
  30. ccxt/kucoin.py +1 -0
  31. ccxt/kucoinfutures.py +152 -3
  32. ccxt/okx.py +4 -0
  33. ccxt/pro/__init__.py +1 -1
  34. ccxt/pro/binance.py +3 -3
  35. ccxt/pro/bitmart.py +72 -0
  36. ccxt/pro/bitvavo.py +87 -2
  37. ccxt/pro/blofin.py +59 -0
  38. ccxt/pro/hitbtc.py +112 -44
  39. ccxt/pro/hollaex.py +5 -0
  40. ccxt/pro/okx.py +12 -1
  41. ccxt/pro/p2b.py +33 -2
  42. ccxt/pro/whitebit.py +29 -1
  43. {ccxt-4.4.7.dist-info → ccxt-4.4.9.dist-info}/METADATA +4 -4
  44. {ccxt-4.4.7.dist-info → ccxt-4.4.9.dist-info}/RECORD +47 -47
  45. {ccxt-4.4.7.dist-info → ccxt-4.4.9.dist-info}/LICENSE.txt +0 -0
  46. {ccxt-4.4.7.dist-info → ccxt-4.4.9.dist-info}/WHEEL +0 -0
  47. {ccxt-4.4.7.dist-info → ccxt-4.4.9.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
@@ -3506,6 +3516,7 @@ class bybit(Exchange, ImplicitAPI):
3506
3516
  # Valid for option only.
3507
3517
  # 'orderIv': '0', # Implied volatility; parameters are passed according to the real value; for example, for 10%, 0.1 is passed
3508
3518
  }
3519
+ hedged = self.safe_bool(params, 'hedged', False)
3509
3520
  triggerPrice = self.safe_value_2(params, 'triggerPrice', 'stopPrice')
3510
3521
  stopLossTriggerPrice = self.safe_value(params, 'stopLossPrice')
3511
3522
  takeProfitTriggerPrice = self.safe_value(params, 'takeProfitPrice')
@@ -3655,7 +3666,9 @@ class bybit(Exchange, ImplicitAPI):
3655
3666
  request['tpslMode'] = 'Partial'
3656
3667
  request['tpOrderType'] = 'Limit'
3657
3668
  request['tpLimitPrice'] = self.get_price(symbol, tpLimitPrice)
3658
- params = self.omit(params, ['stopPrice', 'timeInForce', 'stopLossPrice', 'takeProfitPrice', 'postOnly', 'clientOrderId', 'triggerPrice', 'stopLoss', 'takeProfit', 'trailingAmount', 'trailingTriggerPrice'])
3669
+ if not market['spot'] and hedged:
3670
+ request['positionIdx'] = 1 if (side == 'buy') else 2
3671
+ params = self.omit(params, ['stopPrice', 'timeInForce', 'stopLossPrice', 'takeProfitPrice', 'postOnly', 'clientOrderId', 'triggerPrice', 'stopLoss', 'takeProfit', 'trailingAmount', 'trailingTriggerPrice', 'hedged'])
3659
3672
  return self.extend(request, params)
3660
3673
 
3661
3674
  def create_orders(self, orders: List[OrderRequest], params={}):
@@ -8245,6 +8258,345 @@ class bybit(Exchange, ImplicitAPI):
8245
8258
  positions = self.parse_positions(rawPositions, symbols, params)
8246
8259
  return self.filter_by_since_limit(positions, since, limit)
8247
8260
 
8261
+ def fetch_convert_currencies(self, params={}) -> Currencies:
8262
+ """
8263
+ fetches all available currencies that can be converted
8264
+ :see: https://bybit-exchange.github.io/docs/v5/asset/convert/convert-coin-list
8265
+ :param dict [params]: extra parameters specific to the exchange API endpoint
8266
+ :param str [params.accountType]: eb_convert_uta, eb_convert_spot, eb_convert_funding, eb_convert_inverse, or eb_convert_contract
8267
+ :returns dict: an associative dictionary of currencies
8268
+ """
8269
+ self.load_markets()
8270
+ accountType = None
8271
+ enableUnifiedMargin, enableUnifiedAccount = self.is_unified_enabled()
8272
+ isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
8273
+ accountTypeDefault = 'eb_convert_uta' if isUnifiedAccount else 'eb_convert_spot'
8274
+ accountType, params = self.handle_option_and_params(params, 'fetchConvertCurrencies', 'accountType', accountTypeDefault)
8275
+ request: dict = {
8276
+ 'accountType': accountType,
8277
+ }
8278
+ response = self.privateGetV5AssetExchangeQueryCoinList(self.extend(request, params))
8279
+ #
8280
+ # {
8281
+ # "retCode": 0,
8282
+ # "retMsg": "ok",
8283
+ # "result": {
8284
+ # "coins": [
8285
+ # {
8286
+ # "coin": "MATIC",
8287
+ # "fullName": "MATIC",
8288
+ # "icon": "https://s1.bycsi.com/app/assets/token/0552ae79c535c3095fa18f7b377dd2e9.svg",
8289
+ # "iconNight": "https://t1.bycsi.com/app/assets/token/f59301aef2d6ac2165c4c4603e672fb4.svg",
8290
+ # "accuracyLength": 8,
8291
+ # "coinType": "crypto",
8292
+ # "balance": "0",
8293
+ # "uBalance": "0",
8294
+ # "timePeriod": 0,
8295
+ # "singleFromMinLimit": "1.1",
8296
+ # "singleFromMaxLimit": "20001",
8297
+ # "singleToMinLimit": "0",
8298
+ # "singleToMaxLimit": "0",
8299
+ # "dailyFromMinLimit": "0",
8300
+ # "dailyFromMaxLimit": "0",
8301
+ # "dailyToMinLimit": "0",
8302
+ # "dailyToMaxLimit": "0",
8303
+ # "disableFrom": False,
8304
+ # "disableTo": False
8305
+ # },
8306
+ # ]
8307
+ # },
8308
+ # "retExtInfo": {},
8309
+ # "time": 1727256416250
8310
+ # }
8311
+ #
8312
+ result: dict = {}
8313
+ data = self.safe_dict(response, 'result', {})
8314
+ coins = self.safe_list(data, 'coins', [])
8315
+ for i in range(0, len(coins)):
8316
+ entry = coins[i]
8317
+ id = self.safe_string(entry, 'coin')
8318
+ disableFrom = self.safe_bool(entry, 'disableFrom')
8319
+ disableTo = self.safe_bool(entry, 'disableTo')
8320
+ inactive = (disableFrom or disableTo)
8321
+ code = self.safe_currency_code(id)
8322
+ result[code] = {
8323
+ 'info': entry,
8324
+ 'id': id,
8325
+ 'code': code,
8326
+ 'networks': None,
8327
+ 'type': self.safe_string(entry, 'coinType'),
8328
+ 'name': self.safe_string(entry, 'fullName'),
8329
+ 'active': not inactive,
8330
+ 'deposit': None,
8331
+ 'withdraw': self.safe_number(entry, 'balance'),
8332
+ 'fee': None,
8333
+ 'precision': None,
8334
+ 'limits': {
8335
+ 'amount': {
8336
+ 'min': self.safe_number(entry, 'singleFromMinLimit'),
8337
+ 'max': self.safe_number(entry, 'singleFromMaxLimit'),
8338
+ },
8339
+ 'withdraw': {
8340
+ 'min': None,
8341
+ 'max': None,
8342
+ },
8343
+ 'deposit': {
8344
+ 'min': None,
8345
+ 'max': None,
8346
+ },
8347
+ },
8348
+ 'created': None,
8349
+ }
8350
+ return result
8351
+
8352
+ def fetch_convert_quote(self, fromCode: str, toCode: str, amount: Num = None, params={}) -> Conversion:
8353
+ """
8354
+ fetch a quote for converting from one currency to another
8355
+ :see: https://bybit-exchange.github.io/docs/v5/asset/convert/apply-quote
8356
+ :param str fromCode: the currency that you want to sell and convert from
8357
+ :param str toCode: the currency that you want to buy and convert into
8358
+ :param float [amount]: how much you want to trade in units of the from currency
8359
+ :param dict [params]: extra parameters specific to the exchange API endpoint
8360
+ :param str [params.accountType]: eb_convert_uta, eb_convert_spot, eb_convert_funding, eb_convert_inverse, or eb_convert_contract
8361
+ :returns dict: a `conversion structure <https://docs.ccxt.com/#/?id=conversion-structure>`
8362
+ """
8363
+ self.load_markets()
8364
+ accountType = None
8365
+ enableUnifiedMargin, enableUnifiedAccount = self.is_unified_enabled()
8366
+ isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
8367
+ accountTypeDefault = 'eb_convert_uta' if isUnifiedAccount else 'eb_convert_spot'
8368
+ accountType, params = self.handle_option_and_params(params, 'fetchConvertQuote', 'accountType', accountTypeDefault)
8369
+ request: dict = {
8370
+ 'fromCoin': fromCode,
8371
+ 'toCoin': toCode,
8372
+ 'requestAmount': self.number_to_string(amount),
8373
+ 'requestCoin': fromCode,
8374
+ 'accountType': accountType,
8375
+ }
8376
+ response = self.privatePostV5AssetExchangeQuoteApply(self.extend(request, params))
8377
+ #
8378
+ # {
8379
+ # "retCode": 0,
8380
+ # "retMsg": "ok",
8381
+ # "result": {
8382
+ # "quoteTxId": "1010020692439481682687668224",
8383
+ # "exchangeRate": "0.000015330836780000",
8384
+ # "fromCoin": "USDT",
8385
+ # "fromCoinType": "crypto",
8386
+ # "toCoin": "BTC",
8387
+ # "toCoinType": "crypto",
8388
+ # "fromAmount": "10",
8389
+ # "toAmount": "0.000153308367800000",
8390
+ # "expiredTime": "1727257413353",
8391
+ # "requestId": ""
8392
+ # },
8393
+ # "retExtInfo": {},
8394
+ # "time": 1727257398375
8395
+ # }
8396
+ #
8397
+ data = self.safe_dict(response, 'result', {})
8398
+ fromCurrencyId = self.safe_string(data, 'fromCoin', fromCode)
8399
+ fromCurrency = self.currency(fromCurrencyId)
8400
+ toCurrencyId = self.safe_string(data, 'toCoin', toCode)
8401
+ toCurrency = self.currency(toCurrencyId)
8402
+ return self.parse_conversion(data, fromCurrency, toCurrency)
8403
+
8404
+ def create_convert_trade(self, id: str, fromCode: str, toCode: str, amount: Num = None, params={}) -> Conversion:
8405
+ """
8406
+ convert from one currency to another
8407
+ :see: https://bybit-exchange.github.io/docs/v5/asset/convert/confirm-quote
8408
+ :param str id: the id of the trade that you want to make
8409
+ :param str fromCode: the currency that you want to sell and convert from
8410
+ :param str toCode: the currency that you want to buy and convert into
8411
+ :param float amount: how much you want to trade in units of the from currency
8412
+ :param dict [params]: extra parameters specific to the exchange API endpoint
8413
+ :returns dict: a `conversion structure <https://docs.ccxt.com/#/?id=conversion-structure>`
8414
+ """
8415
+ self.load_markets()
8416
+ request: dict = {
8417
+ 'quoteTxId': id,
8418
+ }
8419
+ response = self.privatePostV5AssetExchangeConvertExecute(self.extend(request, params))
8420
+ #
8421
+ # {
8422
+ # "retCode": 0,
8423
+ # "retMsg": "ok",
8424
+ # "result": {
8425
+ # "exchangeStatus": "processing",
8426
+ # "quoteTxId": "1010020692439483803499737088"
8427
+ # },
8428
+ # "retExtInfo": {},
8429
+ # "time": 1727257904969
8430
+ # }
8431
+ #
8432
+ data = self.safe_dict(response, 'result', {})
8433
+ return self.parse_conversion(data)
8434
+
8435
+ def fetch_convert_trade(self, id: str, code: Str = None, params={}) -> Conversion:
8436
+ """
8437
+ fetch the data for a conversion trade
8438
+ :see: https://bybit-exchange.github.io/docs/v5/asset/convert/get-convert-result
8439
+ :param str id: the id of the trade that you want to fetch
8440
+ :param str [code]: the unified currency code of the conversion trade
8441
+ :param dict [params]: extra parameters specific to the exchange API endpoint
8442
+ :param str [params.accountType]: eb_convert_uta, eb_convert_spot, eb_convert_funding, eb_convert_inverse, or eb_convert_contract
8443
+ :returns dict: a `conversion structure <https://docs.ccxt.com/#/?id=conversion-structure>`
8444
+ """
8445
+ self.load_markets()
8446
+ accountType = None
8447
+ enableUnifiedMargin, enableUnifiedAccount = self.is_unified_enabled()
8448
+ isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
8449
+ accountTypeDefault = 'eb_convert_uta' if isUnifiedAccount else 'eb_convert_spot'
8450
+ accountType, params = self.handle_option_and_params(params, 'fetchConvertQuote', 'accountType', accountTypeDefault)
8451
+ request: dict = {
8452
+ 'quoteTxId': id,
8453
+ 'accountType': accountType,
8454
+ }
8455
+ response = self.privateGetV5AssetExchangeConvertResultQuery(self.extend(request, params))
8456
+ #
8457
+ # {
8458
+ # "retCode": 0,
8459
+ # "retMsg": "ok",
8460
+ # "result": {
8461
+ # "result": {
8462
+ # "accountType": "eb_convert_uta",
8463
+ # "exchangeTxId": "1010020692439483803499737088",
8464
+ # "userId": "100406395",
8465
+ # "fromCoin": "USDT",
8466
+ # "fromCoinType": "crypto",
8467
+ # "fromAmount": "10",
8468
+ # "toCoin": "BTC",
8469
+ # "toCoinType": "crypto",
8470
+ # "toAmount": "0.00015344889",
8471
+ # "exchangeStatus": "success",
8472
+ # "extInfo": {},
8473
+ # "convertRate": "0.000015344889",
8474
+ # "createdAt": "1727257904726"
8475
+ # }
8476
+ # },
8477
+ # "retExtInfo": {},
8478
+ # "time": 1727258257216
8479
+ # }
8480
+ #
8481
+ data = self.safe_dict(response, 'result', {})
8482
+ result = self.safe_dict(data, 'result', {})
8483
+ fromCurrencyId = self.safe_string(result, 'fromCoin')
8484
+ toCurrencyId = self.safe_string(result, 'toCoin')
8485
+ fromCurrency = None
8486
+ toCurrency = None
8487
+ if fromCurrencyId is not None:
8488
+ fromCurrency = self.currency(fromCurrencyId)
8489
+ if toCurrencyId is not None:
8490
+ toCurrency = self.currency(toCurrencyId)
8491
+ return self.parse_conversion(result, fromCurrency, toCurrency)
8492
+
8493
+ def fetch_convert_trade_history(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Conversion]:
8494
+ """
8495
+ fetch the users history of conversion trades
8496
+ :see: https://bybit-exchange.github.io/docs/v5/asset/convert/get-convert-history
8497
+ :param str [code]: the unified currency code
8498
+ :param int [since]: the earliest time in ms to fetch conversions for
8499
+ :param int [limit]: the maximum number of conversion structures to retrieve
8500
+ :param dict [params]: extra parameters specific to the exchange API endpoint
8501
+ :param str [params.accountType]: eb_convert_uta, eb_convert_spot, eb_convert_funding, eb_convert_inverse, or eb_convert_contract
8502
+ :returns dict[]: a list of `conversion structures <https://docs.ccxt.com/#/?id=conversion-structure>`
8503
+ """
8504
+ self.load_markets()
8505
+ request: dict = {}
8506
+ if limit is not None:
8507
+ request['limit'] = limit
8508
+ response = self.privateGetV5AssetExchangeQueryConvertHistory(self.extend(request, params))
8509
+ #
8510
+ # {
8511
+ # "retCode": 0,
8512
+ # "retMsg": "ok",
8513
+ # "result": {
8514
+ # "list": [
8515
+ # {
8516
+ # "accountType": "eb_convert_uta",
8517
+ # "exchangeTxId": "1010020692439483803499737088",
8518
+ # "userId": "100406395",
8519
+ # "fromCoin": "USDT",
8520
+ # "fromCoinType": "crypto",
8521
+ # "fromAmount": "10",
8522
+ # "toCoin": "BTC",
8523
+ # "toCoinType": "crypto",
8524
+ # "toAmount": "0.00015344889",
8525
+ # "exchangeStatus": "success",
8526
+ # "extInfo": {},
8527
+ # "convertRate": "0.000015344889",
8528
+ # "createdAt": "1727257904726"
8529
+ # }
8530
+ # ]
8531
+ # },
8532
+ # "retExtInfo": {},
8533
+ # "time": 1727258761874
8534
+ # }
8535
+ #
8536
+ data = self.safe_dict(response, 'result', {})
8537
+ dataList = self.safe_list(data, 'list', [])
8538
+ return self.parse_conversions(dataList, code, 'fromCoin', 'toCoin', since, limit)
8539
+
8540
+ def parse_conversion(self, conversion: dict, fromCurrency: Currency = None, toCurrency: Currency = None) -> Conversion:
8541
+ #
8542
+ # fetchConvertQuote
8543
+ #
8544
+ # {
8545
+ # "quoteTxId": "1010020692439481682687668224",
8546
+ # "exchangeRate": "0.000015330836780000",
8547
+ # "fromCoin": "USDT",
8548
+ # "fromCoinType": "crypto",
8549
+ # "toCoin": "BTC",
8550
+ # "toCoinType": "crypto",
8551
+ # "fromAmount": "10",
8552
+ # "toAmount": "0.000153308367800000",
8553
+ # "expiredTime": "1727257413353",
8554
+ # "requestId": ""
8555
+ # }
8556
+ #
8557
+ # createConvertTrade
8558
+ #
8559
+ # {
8560
+ # "exchangeStatus": "processing",
8561
+ # "quoteTxId": "1010020692439483803499737088"
8562
+ # }
8563
+ #
8564
+ # fetchConvertTrade, fetchConvertTradeHistory
8565
+ #
8566
+ # {
8567
+ # "accountType": "eb_convert_uta",
8568
+ # "exchangeTxId": "1010020692439483803499737088",
8569
+ # "userId": "100406395",
8570
+ # "fromCoin": "USDT",
8571
+ # "fromCoinType": "crypto",
8572
+ # "fromAmount": "10",
8573
+ # "toCoin": "BTC",
8574
+ # "toCoinType": "crypto",
8575
+ # "toAmount": "0.00015344889",
8576
+ # "exchangeStatus": "success",
8577
+ # "extInfo": {},
8578
+ # "convertRate": "0.000015344889",
8579
+ # "createdAt": "1727257904726"
8580
+ # }
8581
+ #
8582
+ timestamp = self.safe_integer_2(conversion, 'expiredTime', 'createdAt')
8583
+ fromCoin = self.safe_string(conversion, 'fromCoin')
8584
+ fromCode = self.safe_currency_code(fromCoin, fromCurrency)
8585
+ to = self.safe_string(conversion, 'toCoin')
8586
+ toCode = self.safe_currency_code(to, toCurrency)
8587
+ return {
8588
+ 'info': conversion,
8589
+ 'timestamp': timestamp,
8590
+ 'datetime': self.iso8601(timestamp),
8591
+ 'id': self.safe_string_2(conversion, 'quoteTxId', 'exchangeTxId'),
8592
+ 'fromCurrency': fromCode,
8593
+ 'fromAmount': self.safe_number(conversion, 'fromAmount'),
8594
+ 'toCurrency': toCode,
8595
+ 'toAmount': self.safe_number(conversion, 'toAmount'),
8596
+ 'price': None,
8597
+ 'fee': None,
8598
+ }
8599
+
8248
8600
  def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
8249
8601
  url = self.implode_hostname(self.urls['api'][api]) + '/' + path
8250
8602
  if api == 'public':
ccxt/gate.py CHANGED
@@ -611,6 +611,8 @@ class gate(Exchange, ImplicitAPI):
611
611
  },
612
612
  # copied from gatev2
613
613
  'commonCurrencies': {
614
+ 'ORT': 'XREATORS',
615
+ 'ASS': 'ASSF',
614
616
  '88MPH': 'MPH',
615
617
  'AXIS': 'AXISDEFI',
616
618
  'BIFI': 'BITCOINFILE',
@@ -645,6 +647,8 @@ class gate(Exchange, ImplicitAPI):
645
647
  },
646
648
  'createMarketBuyOrderRequiresPrice': True,
647
649
  'networks': {
650
+ 'LINEA': 'LINEAETH',
651
+ 'KON': 'KONET',
648
652
  'AVAXC': 'AVAX_C',
649
653
  'BEP20': 'BSC',
650
654
  'EOS': 'EOS',
@@ -4393,6 +4397,7 @@ class gate(Exchange, ImplicitAPI):
4393
4397
  :see: https://www.gate.io/docs/developers/apiv4/en/#list-futures-orders-2
4394
4398
  :see: https://www.gate.io/docs/developers/apiv4/en/#list-all-auto-orders-2
4395
4399
  :see: https://www.gate.io/docs/developers/apiv4/en/#list-options-orders
4400
+ :see: https://www.gate.io/docs/developers/apiv4/en/#list-futures-orders-by-time-range
4396
4401
  :param str symbol: unified market symbol of the market orders were made in
4397
4402
  :param int [since]: the earliest time in ms to fetch orders for
4398
4403
  :param int [limit]: the maximum number of order structures to retrieve
@@ -4400,9 +4405,33 @@ class gate(Exchange, ImplicitAPI):
4400
4405
  :param bool [params.stop]: True for fetching stop orders
4401
4406
  :param str [params.type]: spot, swap or future, if not provided self.options['defaultType'] is used
4402
4407
  :param str [params.marginMode]: 'cross' or 'isolated' - marginMode for margin trading if not provided self.options['defaultMarginMode'] is used
4408
+ :param boolean [params.historical]: *swap only* True for using historical endpoint
4403
4409
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
4404
4410
  """
4405
- return self.fetch_orders_by_status('finished', symbol, since, limit, params)
4411
+ self.load_markets()
4412
+ until = self.safe_integer(params, 'until')
4413
+ params = self.omit(params, 'until')
4414
+ market = None
4415
+ if symbol is not None:
4416
+ market = self.market(symbol)
4417
+ symbol = market['symbol']
4418
+ res = self.handle_market_type_and_params('fetchClosedOrders', market, params)
4419
+ type = self.safe_string(res, 0)
4420
+ useHistorical = False
4421
+ useHistorical, params = self.handle_option_and_params(params, 'fetchClosedOrders', 'historical', False)
4422
+ if not useHistorical and ((since is None and until is None) or (type != 'swap')):
4423
+ return self.fetch_orders_by_status('finished', symbol, since, limit, params)
4424
+ params = self.omit(params, 'type')
4425
+ request = {}
4426
+ request, params = self.prepare_request(market, type, params)
4427
+ if since is not None:
4428
+ request['from'] = self.parse_to_int(since / 1000)
4429
+ if until is not None:
4430
+ request['to'] = self.parse_to_int(until / 1000)
4431
+ if limit is not None:
4432
+ request['limit'] = limit
4433
+ response = self.privateFuturesGetSettleOrdersTimerange(self.extend(request, params))
4434
+ return self.parse_orders(response, market, since, limit)
4406
4435
 
4407
4436
  def fetch_orders_by_status_request(self, status, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
4408
4437
  market = None
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,
@@ -2935,6 +2955,7 @@ class htx(Exchange, ImplicitAPI):
2935
2955
  def fetch_accounts(self, params={}) -> List[Account]:
2936
2956
  """
2937
2957
  fetch all the accounts associated with a profile
2958
+ :see: https://huobiapi.github.io/docs/spot/v1/en/#get-all-accounts-of-the-current-user
2938
2959
  :param dict [params]: extra parameters specific to the exchange API endpoint
2939
2960
  :returns dict: a dictionary of `account structures <https://docs.ccxt.com/#/?id=account-structure>` indexed by the account type
2940
2961
  """
@@ -2998,6 +3019,7 @@ class htx(Exchange, ImplicitAPI):
2998
3019
  def fetch_currencies(self, params={}) -> Currencies:
2999
3020
  """
3000
3021
  fetches all available currencies on an exchange
3022
+ :see: https://huobiapi.github.io/docs/spot/v1/en/#apiv2-currency-amp-chains
3001
3023
  :param dict [params]: extra parameters specific to the exchange API endpoint
3002
3024
  :returns dict: an associative dictionary of currencies
3003
3025
  """
ccxt/kucoin.py CHANGED
@@ -642,6 +642,7 @@ class kucoin(Exchange, ImplicitAPI):
642
642
  'WAX': 'WAXP',
643
643
  'ALT': 'APTOSLAUNCHTOKEN',
644
644
  'KALT': 'ALT', # ALTLAYER
645
+ 'FUD': 'FTX Users\' Debt',
645
646
  },
646
647
  'options': {
647
648
  'hf': False,