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