ccxt 4.4.40__py2.py3-none-any.whl → 4.4.41__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/bitmart.py +2 -0
- ccxt/abstract/okx.py +5 -0
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +10 -3
- ccxt/async_support/binance.py +24 -24
- ccxt/async_support/bingx.py +3 -1
- ccxt/async_support/bitfinex.py +1 -1
- ccxt/async_support/bitget.py +1 -0
- ccxt/async_support/bitmart.py +243 -2
- ccxt/async_support/bybit.py +8 -8
- ccxt/async_support/exmo.py +60 -4
- ccxt/async_support/gate.py +1 -1
- ccxt/async_support/htx.py +1 -1
- ccxt/async_support/hyperliquid.py +60 -1
- ccxt/async_support/kraken.py +123 -25
- ccxt/async_support/kucoin.py +5 -1
- ccxt/async_support/mexc.py +3 -3
- ccxt/async_support/okx.py +6 -1
- ccxt/async_support/xt.py +3 -1
- ccxt/base/exchange.py +19 -4
- ccxt/base/types.py +10 -0
- ccxt/binance.py +24 -24
- ccxt/bingx.py +3 -1
- ccxt/bitfinex.py +1 -1
- ccxt/bitget.py +1 -0
- ccxt/bitmart.py +243 -2
- ccxt/bybit.py +8 -8
- ccxt/exmo.py +60 -4
- ccxt/gate.py +1 -1
- ccxt/htx.py +1 -1
- ccxt/hyperliquid.py +60 -1
- ccxt/kraken.py +123 -25
- ccxt/kucoin.py +5 -1
- ccxt/mexc.py +3 -3
- ccxt/okx.py +6 -1
- ccxt/pro/__init__.py +1 -1
- ccxt/xt.py +3 -1
- {ccxt-4.4.40.dist-info → ccxt-4.4.41.dist-info}/METADATA +4 -4
- {ccxt-4.4.40.dist-info → ccxt-4.4.41.dist-info}/RECORD +43 -43
- {ccxt-4.4.40.dist-info → ccxt-4.4.41.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.40.dist-info → ccxt-4.4.41.dist-info}/WHEEL +0 -0
- {ccxt-4.4.40.dist-info → ccxt-4.4.41.dist-info}/top_level.txt +0 -0
ccxt/async_support/bybit.py
CHANGED
@@ -3531,29 +3531,29 @@ class bybit(Exchange, ImplicitAPI):
|
|
3531
3531
|
avgPrice = self.omit_zero(self.safe_string(order, 'avgPrice'))
|
3532
3532
|
rawTimeInForce = self.safe_string(order, 'timeInForce')
|
3533
3533
|
timeInForce = self.parse_time_in_force(rawTimeInForce)
|
3534
|
-
|
3534
|
+
triggerPrice = self.omit_zero(self.safe_string(order, 'triggerPrice'))
|
3535
3535
|
reduceOnly = self.safe_bool(order, 'reduceOnly')
|
3536
3536
|
takeProfitPrice = self.omit_zero(self.safe_string(order, 'takeProfit'))
|
3537
3537
|
stopLossPrice = self.omit_zero(self.safe_string(order, 'stopLoss'))
|
3538
3538
|
triggerDirection = self.safe_string(order, 'triggerDirection')
|
3539
3539
|
isAscending = (triggerDirection == '1')
|
3540
|
-
isStopOrderType2 = (
|
3540
|
+
isStopOrderType2 = (triggerPrice is not None) and reduceOnly
|
3541
3541
|
if (stopLossPrice is None) and isStopOrderType2:
|
3542
3542
|
# check if order is stop order type 2 - stopLossPrice
|
3543
3543
|
if isAscending and (side == 'buy'):
|
3544
3544
|
# stopLoss order against short position
|
3545
|
-
stopLossPrice =
|
3545
|
+
stopLossPrice = triggerPrice
|
3546
3546
|
if not isAscending and (side == 'sell'):
|
3547
3547
|
# stopLoss order against a long position
|
3548
|
-
stopLossPrice =
|
3548
|
+
stopLossPrice = triggerPrice
|
3549
3549
|
if (takeProfitPrice is None) and isStopOrderType2:
|
3550
3550
|
# check if order is stop order type 2 - takeProfitPrice
|
3551
3551
|
if isAscending and (side == 'sell'):
|
3552
3552
|
# takeprofit order against a long position
|
3553
|
-
takeProfitPrice =
|
3553
|
+
takeProfitPrice = triggerPrice
|
3554
3554
|
if not isAscending and (side == 'buy'):
|
3555
3555
|
# takeprofit order against a short position
|
3556
|
-
takeProfitPrice =
|
3556
|
+
takeProfitPrice = triggerPrice
|
3557
3557
|
return self.safe_order({
|
3558
3558
|
'info': order,
|
3559
3559
|
'id': id,
|
@@ -3569,7 +3569,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
3569
3569
|
'reduceOnly': self.safe_bool(order, 'reduceOnly'),
|
3570
3570
|
'side': side,
|
3571
3571
|
'price': price,
|
3572
|
-
'triggerPrice':
|
3572
|
+
'triggerPrice': triggerPrice,
|
3573
3573
|
'takeProfitPrice': takeProfitPrice,
|
3574
3574
|
'stopLossPrice': stopLossPrice,
|
3575
3575
|
'amount': amount,
|
@@ -6370,7 +6370,7 @@ classic accounts only/ spot not supported* fetches information on an order made
|
|
6370
6370
|
data = self.add_pagination_cursor_to_result(response)
|
6371
6371
|
id = self.safe_string(result, 'symbol')
|
6372
6372
|
market = self.safe_market(id, market, None, 'contract')
|
6373
|
-
return self.
|
6373
|
+
return self.parse_open_interests_history(data, market, since, limit)
|
6374
6374
|
|
6375
6375
|
async def fetch_open_interest(self, symbol: str, params={}):
|
6376
6376
|
"""
|
ccxt/async_support/exmo.py
CHANGED
@@ -43,6 +43,9 @@ class exmo(Exchange, ImplicitAPI):
|
|
43
43
|
'cancelOrder': True,
|
44
44
|
'cancelOrders': False,
|
45
45
|
'createDepositAddress': False,
|
46
|
+
'createMarketBuyOrder': True,
|
47
|
+
'createMarketBuyOrderWithCost': True,
|
48
|
+
'createMarketOrderWithCost': True,
|
46
49
|
'createOrder': True,
|
47
50
|
'createStopLimitOrder': True,
|
48
51
|
'createStopMarketOrder': True,
|
@@ -1352,6 +1355,52 @@ class exmo(Exchange, ImplicitAPI):
|
|
1352
1355
|
result = self.array_concat(result, trades)
|
1353
1356
|
return self.filter_by_since_limit(result, since, limit)
|
1354
1357
|
|
1358
|
+
async def create_market_order_with_cost(self, symbol: str, side: OrderSide, cost: float, params={}):
|
1359
|
+
"""
|
1360
|
+
create a market order by providing the symbol, side and cost
|
1361
|
+
|
1362
|
+
https://documenter.getpostman.com/view/10287440/SzYXWKPi#80daa469-ec59-4d0a-b229-6a311d8dd1cd
|
1363
|
+
|
1364
|
+
:param str symbol: unified symbol of the market to create an order in
|
1365
|
+
:param str side: 'buy' or 'sell'
|
1366
|
+
:param float cost: how much you want to trade in units of the quote currency
|
1367
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1368
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1369
|
+
"""
|
1370
|
+
await self.load_markets()
|
1371
|
+
params = self.extend(params, {'cost': cost})
|
1372
|
+
return await self.create_order(symbol, 'market', side, cost, None, params)
|
1373
|
+
|
1374
|
+
async def create_market_buy_order_with_cost(self, symbol: str, cost: float, params={}):
|
1375
|
+
"""
|
1376
|
+
create a market buy order by providing the symbol and cost
|
1377
|
+
|
1378
|
+
https://documenter.getpostman.com/view/10287440/SzYXWKPi#80daa469-ec59-4d0a-b229-6a311d8dd1cd
|
1379
|
+
|
1380
|
+
:param str symbol: unified symbol of the market to create an order in
|
1381
|
+
:param float cost: how much you want to trade in units of the quote currency
|
1382
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1383
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1384
|
+
"""
|
1385
|
+
await self.load_markets()
|
1386
|
+
params = self.extend(params, {'cost': cost})
|
1387
|
+
return await self.create_order(symbol, 'market', 'buy', cost, None, params)
|
1388
|
+
|
1389
|
+
async def create_market_sell_order_with_cost(self, symbol: str, cost: float, params={}):
|
1390
|
+
"""
|
1391
|
+
create a market sell order by providing the symbol and cost
|
1392
|
+
|
1393
|
+
https://documenter.getpostman.com/view/10287440/SzYXWKPi#80daa469-ec59-4d0a-b229-6a311d8dd1cd
|
1394
|
+
|
1395
|
+
:param str symbol: unified symbol of the market to create an order in
|
1396
|
+
:param float cost: how much you want to trade in units of the quote currency
|
1397
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1398
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1399
|
+
"""
|
1400
|
+
await self.load_markets()
|
1401
|
+
params = self.extend(params, {'cost': cost})
|
1402
|
+
return await self.create_order(symbol, 'market', 'sell', cost, None, params)
|
1403
|
+
|
1355
1404
|
async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
1356
1405
|
"""
|
1357
1406
|
create a trade order
|
@@ -1369,6 +1418,7 @@ class exmo(Exchange, ImplicitAPI):
|
|
1369
1418
|
:param float [params.stopPrice]: the price at which a trigger order is triggered at
|
1370
1419
|
:param str [params.timeInForce]: *spot only* 'fok', 'ioc' or 'post_only'
|
1371
1420
|
:param boolean [params.postOnly]: *spot only* True for post only orders
|
1421
|
+
:param float [params.cost]: *spot only* *market orders only* the cost of the order in the quote currency for market orders
|
1372
1422
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1373
1423
|
"""
|
1374
1424
|
await self.load_markets()
|
@@ -1379,11 +1429,12 @@ class exmo(Exchange, ImplicitAPI):
|
|
1379
1429
|
if marginMode == 'cross':
|
1380
1430
|
raise BadRequest(self.id + ' only supports isolated margin')
|
1381
1431
|
isSpot = (marginMode != 'isolated')
|
1382
|
-
triggerPrice = self.
|
1432
|
+
triggerPrice = self.safe_string_n(params, ['triggerPrice', 'stopPrice', 'stop_price'])
|
1433
|
+
cost = self.safe_string(params, 'cost')
|
1383
1434
|
request: dict = {
|
1384
1435
|
'pair': market['id'],
|
1385
1436
|
# 'leverage': 2,
|
1386
|
-
'quantity': self.amount_to_precision(market['symbol'], amount),
|
1437
|
+
# 'quantity': self.amount_to_precision(market['symbol'], amount),
|
1387
1438
|
# spot - buy, sell, market_buy, market_sell, market_buy_total, market_sell_total
|
1388
1439
|
# margin - limit_buy, limit_sell, market_buy, market_sell, stop_buy, stop_sell, stop_limit_buy, stop_limit_sell, trailing_stop_buy, trailing_stop_sell
|
1389
1440
|
# 'stop_price': self.price_to_precision(symbol, stopPrice),
|
@@ -1392,6 +1443,10 @@ class exmo(Exchange, ImplicitAPI):
|
|
1392
1443
|
# 'client_id': 123, # optional, must be a positive integer
|
1393
1444
|
# 'comment': '', # up to 50 latin symbols, whitespaces, underscores
|
1394
1445
|
}
|
1446
|
+
if cost is None:
|
1447
|
+
request['quantity'] = self.amount_to_precision(market['symbol'], amount)
|
1448
|
+
else:
|
1449
|
+
request['quantity'] = self.cost_to_precision(market['symbol'], cost)
|
1395
1450
|
clientOrderId = self.safe_value_2(params, 'client_id', 'clientOrderId')
|
1396
1451
|
if clientOrderId is not None:
|
1397
1452
|
clientOrderId = self.safe_integer_2(params, 'client_id', 'clientOrderId')
|
@@ -1402,7 +1457,7 @@ class exmo(Exchange, ImplicitAPI):
|
|
1402
1457
|
leverage = self.safe_number(params, 'leverage')
|
1403
1458
|
if not isSpot and (leverage is None):
|
1404
1459
|
raise ArgumentsRequired(self.id + ' createOrder requires an extra param params["leverage"] for margin orders')
|
1405
|
-
params = self.omit(params, ['stopPrice', 'stop_price', 'triggerPrice', 'timeInForce', 'client_id', 'clientOrderId'])
|
1460
|
+
params = self.omit(params, ['stopPrice', 'stop_price', 'triggerPrice', 'timeInForce', 'client_id', 'clientOrderId', 'cost'])
|
1406
1461
|
if price is not None:
|
1407
1462
|
request['price'] = self.price_to_precision(market['symbol'], price)
|
1408
1463
|
response = None
|
@@ -1423,7 +1478,8 @@ class exmo(Exchange, ImplicitAPI):
|
|
1423
1478
|
if type == 'limit':
|
1424
1479
|
request['type'] = side
|
1425
1480
|
elif type == 'market':
|
1426
|
-
|
1481
|
+
marketSuffix = '_total' if (cost is not None) else ''
|
1482
|
+
request['type'] = 'market_' + side + marketSuffix
|
1427
1483
|
if isPostOnly:
|
1428
1484
|
request['exec_type'] = 'post_only'
|
1429
1485
|
elif timeInForce is not None:
|
ccxt/async_support/gate.py
CHANGED
@@ -6488,7 +6488,7 @@ class gate(Exchange, ImplicitAPI):
|
|
6488
6488
|
# ...
|
6489
6489
|
# ]
|
6490
6490
|
#
|
6491
|
-
return self.
|
6491
|
+
return self.parse_open_interests_history(response, market, since, limit)
|
6492
6492
|
|
6493
6493
|
def parse_open_interest(self, interest, market: Market = None):
|
6494
6494
|
#
|
ccxt/async_support/htx.py
CHANGED
@@ -8004,7 +8004,7 @@ class htx(Exchange, ImplicitAPI):
|
|
8004
8004
|
#
|
8005
8005
|
data = self.safe_value(response, 'data')
|
8006
8006
|
tick = self.safe_list(data, 'tick')
|
8007
|
-
return self.
|
8007
|
+
return self.parse_open_interests_history(tick, market, since, limit)
|
8008
8008
|
|
8009
8009
|
async def fetch_open_interest(self, symbol: str, params={}):
|
8010
8010
|
"""
|
@@ -95,8 +95,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
95
95
|
'fetchMyLiquidations': False,
|
96
96
|
'fetchMyTrades': True,
|
97
97
|
'fetchOHLCV': True,
|
98
|
-
'fetchOpenInterest':
|
98
|
+
'fetchOpenInterest': True,
|
99
99
|
'fetchOpenInterestHistory': False,
|
100
|
+
'fetchOpenInterests': True,
|
100
101
|
'fetchOpenOrders': True,
|
101
102
|
'fetchOrder': True,
|
102
103
|
'fetchOrderBook': True,
|
@@ -3132,6 +3133,64 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
3132
3133
|
withdrawals = self.filter_by_array(records, 'type', ['withdraw'], False)
|
3133
3134
|
return self.parse_transactions(withdrawals, None, since, limit)
|
3134
3135
|
|
3136
|
+
async def fetch_open_interests(self, symbols: Strings = None, params={}):
|
3137
|
+
"""
|
3138
|
+
Retrieves the open interest for a list of symbols
|
3139
|
+
:param str[] [symbols]: Unified CCXT market symbol
|
3140
|
+
:param dict [params]: exchange specific parameters
|
3141
|
+
:returns dict} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure:
|
3142
|
+
"""
|
3143
|
+
await self.load_markets()
|
3144
|
+
symbols = self.market_symbols(symbols)
|
3145
|
+
swapMarkets = await self.fetch_swap_markets()
|
3146
|
+
result = self.parse_open_interests(swapMarkets)
|
3147
|
+
return self.filter_by_array(result, 'symbol', symbols)
|
3148
|
+
|
3149
|
+
async def fetch_open_interest(self, symbol: str, params={}):
|
3150
|
+
"""
|
3151
|
+
retrieves the open interest of a contract trading pair
|
3152
|
+
:param str symbol: unified CCXT market symbol
|
3153
|
+
:param dict [params]: exchange specific parameters
|
3154
|
+
:returns dict: an `open interest structure <https://docs.ccxt.com/#/?id=open-interest-structure>`
|
3155
|
+
"""
|
3156
|
+
symbol = self.symbol(symbol)
|
3157
|
+
await self.load_markets()
|
3158
|
+
ois = await self.fetch_open_interests([symbol], params)
|
3159
|
+
return ois[symbol]
|
3160
|
+
|
3161
|
+
def parse_open_interest(self, interest, market: Market = None):
|
3162
|
+
#
|
3163
|
+
# {
|
3164
|
+
# szDecimals: '2',
|
3165
|
+
# name: 'HYPE',
|
3166
|
+
# maxLeverage: '3',
|
3167
|
+
# funding: '0.00014735',
|
3168
|
+
# openInterest: '14677900.74',
|
3169
|
+
# prevDayPx: '26.145',
|
3170
|
+
# dayNtlVlm: '299643445.12560016',
|
3171
|
+
# premium: '0.00081613',
|
3172
|
+
# oraclePx: '27.569',
|
3173
|
+
# markPx: '27.63',
|
3174
|
+
# midPx: '27.599',
|
3175
|
+
# impactPxs: ['27.5915', '27.6319'],
|
3176
|
+
# dayBaseVlm: '10790652.83',
|
3177
|
+
# baseId: 159
|
3178
|
+
# }
|
3179
|
+
#
|
3180
|
+
interest = self.safe_dict(interest, 'info', {})
|
3181
|
+
coin = self.safe_string(interest, 'name')
|
3182
|
+
marketId = None
|
3183
|
+
if coin is not None:
|
3184
|
+
marketId = self.coin_to_market_id(coin)
|
3185
|
+
return self.safe_open_interest({
|
3186
|
+
'symbol': self.safe_symbol(marketId),
|
3187
|
+
'openInterestAmount': self.safe_number(interest, 'openInterest'),
|
3188
|
+
'openInterestValue': None,
|
3189
|
+
'timestamp': None,
|
3190
|
+
'datetime': None,
|
3191
|
+
'info': interest,
|
3192
|
+
}, market)
|
3193
|
+
|
3135
3194
|
def extract_type_from_delta(self, data=[]):
|
3136
3195
|
records = []
|
3137
3196
|
for i in range(0, len(data)):
|
ccxt/async_support/kraken.py
CHANGED
@@ -1621,6 +1621,37 @@ class kraken(Exchange, ImplicitAPI):
|
|
1621
1621
|
# }
|
1622
1622
|
# }
|
1623
1623
|
#
|
1624
|
+
# fetchOpenOrders
|
1625
|
+
#
|
1626
|
+
# {
|
1627
|
+
# "refid": null,
|
1628
|
+
# "userref": null,
|
1629
|
+
# "cl_ord_id": "1234",
|
1630
|
+
# "status": "open",
|
1631
|
+
# "opentm": 1733815269.370054,
|
1632
|
+
# "starttm": 0,
|
1633
|
+
# "expiretm": 0,
|
1634
|
+
# "descr": {
|
1635
|
+
# "pair": "XBTUSD",
|
1636
|
+
# "type": "buy",
|
1637
|
+
# "ordertype": "limit",
|
1638
|
+
# "price": "70000.0",
|
1639
|
+
# "price2": "0",
|
1640
|
+
# "leverage": "none",
|
1641
|
+
# "order": "buy 0.00010000 XBTUSD @ limit 70000.0",
|
1642
|
+
# "close": ""
|
1643
|
+
# },
|
1644
|
+
# "vol": "0.00010000",
|
1645
|
+
# "vol_exec": "0.00000000",
|
1646
|
+
# "cost": "0.00000",
|
1647
|
+
# "fee": "0.00000",
|
1648
|
+
# "price": "0.00000",
|
1649
|
+
# "stopprice": "0.00000",
|
1650
|
+
# "limitprice": "0.00000",
|
1651
|
+
# "misc": "",
|
1652
|
+
# "oflags": "fciq"
|
1653
|
+
# }
|
1654
|
+
#
|
1624
1655
|
description = self.safe_dict(order, 'descr', {})
|
1625
1656
|
orderDescriptionObj = self.safe_dict(order, 'descr') # can be null
|
1626
1657
|
orderDescription = None
|
@@ -1694,7 +1725,8 @@ class kraken(Exchange, ImplicitAPI):
|
|
1694
1725
|
if (id is None) or (id.startswith('[')):
|
1695
1726
|
txid = self.safe_list(order, 'txid')
|
1696
1727
|
id = self.safe_string(txid, 0)
|
1697
|
-
|
1728
|
+
userref = self.safe_string(order, 'userref')
|
1729
|
+
clientOrderId = self.safe_string(order, 'cl_ord_id', userref)
|
1698
1730
|
rawTrades = self.safe_value(order, 'trades', [])
|
1699
1731
|
trades = []
|
1700
1732
|
for i in range(0, len(rawTrades)):
|
@@ -1888,10 +1920,10 @@ class kraken(Exchange, ImplicitAPI):
|
|
1888
1920
|
request: dict = {
|
1889
1921
|
'txid': id,
|
1890
1922
|
}
|
1891
|
-
clientOrderId = self.
|
1923
|
+
clientOrderId = self.safe_string_2(params, 'clientOrderId', 'cl_ord_id')
|
1892
1924
|
if clientOrderId is not None:
|
1893
1925
|
request['cl_ord_id'] = clientOrderId
|
1894
|
-
params = self.omit(params, 'clientOrderId')
|
1926
|
+
params = self.omit(params, ['clientOrderId', 'cl_ord_id'])
|
1895
1927
|
request = self.omit(request, 'txid')
|
1896
1928
|
isMarket = (type == 'market')
|
1897
1929
|
postOnly = None
|
@@ -2158,20 +2190,27 @@ class kraken(Exchange, ImplicitAPI):
|
|
2158
2190
|
"""
|
2159
2191
|
cancels an open order
|
2160
2192
|
|
2161
|
-
https://docs.kraken.com/rest
|
2193
|
+
https://docs.kraken.com/api/docs/rest-api/cancel-order
|
2162
2194
|
|
2163
2195
|
:param str id: order id
|
2164
|
-
:param str symbol: unified symbol of the market the order was made in
|
2196
|
+
:param str [symbol]: unified symbol of the market the order was made in
|
2165
2197
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2166
|
-
:
|
2198
|
+
:param str [params.clientOrderId]: the orders client order id
|
2199
|
+
:param int [params.userref]: the orders user reference id
|
2200
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
2167
2201
|
"""
|
2168
2202
|
await self.load_markets()
|
2169
2203
|
response = None
|
2170
|
-
|
2204
|
+
requestId = self.safe_value(params, 'userref', id) # string or integer
|
2205
|
+
params = self.omit(params, 'userref')
|
2171
2206
|
request: dict = {
|
2172
|
-
'txid':
|
2207
|
+
'txid': requestId, # order id or userref
|
2173
2208
|
}
|
2174
|
-
|
2209
|
+
clientOrderId = self.safe_string_2(params, 'clientOrderId', 'cl_ord_id')
|
2210
|
+
if clientOrderId is not None:
|
2211
|
+
request['cl_ord_id'] = clientOrderId
|
2212
|
+
params = self.omit(params, ['clientOrderId', 'cl_ord_id'])
|
2213
|
+
request = self.omit(request, 'txid')
|
2175
2214
|
try:
|
2176
2215
|
response = await self.privatePostCancelOrder(self.extend(request, params))
|
2177
2216
|
#
|
@@ -2278,55 +2317,108 @@ class kraken(Exchange, ImplicitAPI):
|
|
2278
2317
|
"""
|
2279
2318
|
fetch all unfilled currently open orders
|
2280
2319
|
|
2281
|
-
https://docs.kraken.com/rest
|
2320
|
+
https://docs.kraken.com/api/docs/rest-api/get-open-orders
|
2282
2321
|
|
2283
|
-
:param str symbol: unified market symbol
|
2322
|
+
:param str [symbol]: unified market symbol
|
2284
2323
|
:param int [since]: the earliest time in ms to fetch open orders for
|
2285
2324
|
:param int [limit]: the maximum number of open orders structures to retrieve
|
2286
2325
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2326
|
+
:param str [params.clientOrderId]: the orders client order id
|
2327
|
+
:param int [params.userref]: the orders user reference id
|
2287
2328
|
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
2288
2329
|
"""
|
2289
2330
|
await self.load_markets()
|
2290
2331
|
request: dict = {}
|
2291
2332
|
if since is not None:
|
2292
2333
|
request['start'] = self.parse_to_int(since / 1000)
|
2293
|
-
|
2294
|
-
|
2334
|
+
userref = self.safe_integer(params, 'userref')
|
2335
|
+
if userref is not None:
|
2336
|
+
request['userref'] = userref
|
2337
|
+
params = self.omit(params, 'userref')
|
2338
|
+
clientOrderId = self.safe_string(params, 'clientOrderId')
|
2295
2339
|
if clientOrderId is not None:
|
2296
|
-
request['
|
2297
|
-
|
2298
|
-
response = await self.privatePostOpenOrders(self.extend(request,
|
2340
|
+
request['cl_ord_id'] = clientOrderId
|
2341
|
+
params = self.omit(params, 'clientOrderId')
|
2342
|
+
response = await self.privatePostOpenOrders(self.extend(request, params))
|
2343
|
+
#
|
2344
|
+
# {
|
2345
|
+
# "error": [],
|
2346
|
+
# "result": {
|
2347
|
+
# "open": {
|
2348
|
+
# "O45M52-BFD5S-YXKQOU": {
|
2349
|
+
# "refid": null,
|
2350
|
+
# "userref": null,
|
2351
|
+
# "cl_ord_id": "1234",
|
2352
|
+
# "status": "open",
|
2353
|
+
# "opentm": 1733815269.370054,
|
2354
|
+
# "starttm": 0,
|
2355
|
+
# "expiretm": 0,
|
2356
|
+
# "descr": {
|
2357
|
+
# "pair": "XBTUSD",
|
2358
|
+
# "type": "buy",
|
2359
|
+
# "ordertype": "limit",
|
2360
|
+
# "price": "70000.0",
|
2361
|
+
# "price2": "0",
|
2362
|
+
# "leverage": "none",
|
2363
|
+
# "order": "buy 0.00010000 XBTUSD @ limit 70000.0",
|
2364
|
+
# "close": ""
|
2365
|
+
# },
|
2366
|
+
# "vol": "0.00010000",
|
2367
|
+
# "vol_exec": "0.00000000",
|
2368
|
+
# "cost": "0.00000",
|
2369
|
+
# "fee": "0.00000",
|
2370
|
+
# "price": "0.00000",
|
2371
|
+
# "stopprice": "0.00000",
|
2372
|
+
# "limitprice": "0.00000",
|
2373
|
+
# "misc": "",
|
2374
|
+
# "oflags": "fciq"
|
2375
|
+
# }
|
2376
|
+
# }
|
2377
|
+
# }
|
2378
|
+
# }
|
2379
|
+
#
|
2299
2380
|
market = None
|
2300
2381
|
if symbol is not None:
|
2301
2382
|
market = self.market(symbol)
|
2302
2383
|
result = self.safe_dict(response, 'result', {})
|
2303
|
-
|
2384
|
+
open = self.safe_dict(result, 'open', {})
|
2385
|
+
orders = []
|
2386
|
+
orderIds = list(open.keys())
|
2387
|
+
for i in range(0, len(orderIds)):
|
2388
|
+
id = orderIds[i]
|
2389
|
+
item = open[id]
|
2390
|
+
orders.append(self.extend({'id': id}, item))
|
2304
2391
|
return self.parse_orders(orders, market, since, limit)
|
2305
2392
|
|
2306
2393
|
async def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
2307
2394
|
"""
|
2308
2395
|
fetches information on multiple closed orders made by the user
|
2309
2396
|
|
2310
|
-
https://docs.kraken.com/rest
|
2397
|
+
https://docs.kraken.com/api/docs/rest-api/get-closed-orders
|
2311
2398
|
|
2312
|
-
:param str symbol: unified market symbol of the market orders were made in
|
2399
|
+
:param str [symbol]: unified market symbol of the market orders were made in
|
2313
2400
|
:param int [since]: the earliest time in ms to fetch orders for
|
2314
2401
|
:param int [limit]: the maximum number of order structures to retrieve
|
2315
2402
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2316
2403
|
:param int [params.until]: timestamp in ms of the latest entry
|
2404
|
+
:param str [params.clientOrderId]: the orders client order id
|
2405
|
+
:param int [params.userref]: the orders user reference id
|
2317
2406
|
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
2318
2407
|
"""
|
2319
2408
|
await self.load_markets()
|
2320
2409
|
request: dict = {}
|
2321
2410
|
if since is not None:
|
2322
2411
|
request['start'] = self.parse_to_int(since / 1000)
|
2323
|
-
|
2324
|
-
|
2412
|
+
userref = self.safe_integer(params, 'userref')
|
2413
|
+
if userref is not None:
|
2414
|
+
request['userref'] = userref
|
2415
|
+
params = self.omit(params, 'userref')
|
2416
|
+
clientOrderId = self.safe_string(params, 'clientOrderId')
|
2325
2417
|
if clientOrderId is not None:
|
2326
|
-
request['
|
2327
|
-
|
2418
|
+
request['cl_ord_id'] = clientOrderId
|
2419
|
+
params = self.omit(params, 'clientOrderId')
|
2328
2420
|
request, params = self.handle_until_option('end', request, params)
|
2329
|
-
response = await self.privatePostClosedOrders(self.extend(request,
|
2421
|
+
response = await self.privatePostClosedOrders(self.extend(request, params))
|
2330
2422
|
#
|
2331
2423
|
# {
|
2332
2424
|
# "error":[],
|
@@ -2370,7 +2462,13 @@ class kraken(Exchange, ImplicitAPI):
|
|
2370
2462
|
if symbol is not None:
|
2371
2463
|
market = self.market(symbol)
|
2372
2464
|
result = self.safe_dict(response, 'result', {})
|
2373
|
-
|
2465
|
+
closed = self.safe_dict(result, 'closed', {})
|
2466
|
+
orders = []
|
2467
|
+
orderIds = list(closed.keys())
|
2468
|
+
for i in range(0, len(orderIds)):
|
2469
|
+
id = orderIds[i]
|
2470
|
+
item = closed[id]
|
2471
|
+
orders.append(self.extend({'id': id}, item))
|
2374
2472
|
return self.parse_orders(orders, market, since, limit)
|
2375
2473
|
|
2376
2474
|
def parse_transaction_status(self, status: Str):
|
ccxt/async_support/kucoin.py
CHANGED
@@ -660,6 +660,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
660
660
|
'version': 'v1',
|
661
661
|
'symbolSeparator': '-',
|
662
662
|
'fetchMyTradesMethod': 'private_get_fills',
|
663
|
+
'timeDifference': 0, # the difference between system clock and Binance clock
|
664
|
+
'adjustForTimeDifference': False, # controls the adjustment logic upon instantiation
|
663
665
|
'fetchCurrencies': {
|
664
666
|
'webApiEnable': True, # fetches from WEB
|
665
667
|
'webApiRetries': 1,
|
@@ -1076,7 +1078,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1076
1078
|
})
|
1077
1079
|
|
1078
1080
|
def nonce(self):
|
1079
|
-
return self.milliseconds()
|
1081
|
+
return self.milliseconds() - self.options['timeDifference']
|
1080
1082
|
|
1081
1083
|
async def fetch_time(self, params={}):
|
1082
1084
|
"""
|
@@ -1313,6 +1315,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1313
1315
|
'created': None,
|
1314
1316
|
'info': market,
|
1315
1317
|
})
|
1318
|
+
if self.options['adjustForTimeDifference']:
|
1319
|
+
await self.load_time_difference()
|
1316
1320
|
return result
|
1317
1321
|
|
1318
1322
|
async def load_migration_status(self, force: bool = False):
|
ccxt/async_support/mexc.py
CHANGED
@@ -690,7 +690,7 @@ class mexc(Exchange, ImplicitAPI):
|
|
690
690
|
'broker': 'CCXT',
|
691
691
|
},
|
692
692
|
'features': {
|
693
|
-
'
|
693
|
+
'default': {
|
694
694
|
'sandbox': False,
|
695
695
|
'createOrder': {
|
696
696
|
'marginMode': True,
|
@@ -758,10 +758,10 @@ class mexc(Exchange, ImplicitAPI):
|
|
758
758
|
},
|
759
759
|
},
|
760
760
|
'spot': {
|
761
|
-
'extends': '
|
761
|
+
'extends': 'default',
|
762
762
|
},
|
763
763
|
'forDerivs': {
|
764
|
-
'extends': '
|
764
|
+
'extends': 'default',
|
765
765
|
'createOrder': {
|
766
766
|
'triggerPrice': True,
|
767
767
|
'triggerPriceType': {
|
ccxt/async_support/okx.py
CHANGED
@@ -286,6 +286,7 @@ class okx(Exchange, ImplicitAPI):
|
|
286
286
|
'tradingBot/public/rsi-back-testing': 1,
|
287
287
|
'asset/exchange-list': 5 / 3,
|
288
288
|
'finance/staking-defi/eth/apy-history': 5 / 3,
|
289
|
+
'finance/staking-defi/sol/apy-history': 5 / 3,
|
289
290
|
'finance/savings/lending-rate-summary': 5 / 3,
|
290
291
|
'finance/savings/lending-rate-history': 5 / 3,
|
291
292
|
'finance/fixed-loan/lending-offers': 10 / 3,
|
@@ -424,6 +425,8 @@ class okx(Exchange, ImplicitAPI):
|
|
424
425
|
'finance/staking-defi/eth/balance': 5 / 3,
|
425
426
|
'finance/staking-defi/eth/purchase-redeem-history': 5 / 3,
|
426
427
|
'finance/staking-defi/eth/product-info': 3,
|
428
|
+
'finance/staking-defi/sol/balance': 5 / 3,
|
429
|
+
'finance/staking-defi/sol/purchase-redeem-history': 5 / 3,
|
427
430
|
# copytrading
|
428
431
|
'copytrading/current-subpositions': 1,
|
429
432
|
'copytrading/subpositions-history': 1,
|
@@ -558,6 +561,8 @@ class okx(Exchange, ImplicitAPI):
|
|
558
561
|
# eth staking
|
559
562
|
'finance/staking-defi/eth/purchase': 5,
|
560
563
|
'finance/staking-defi/eth/redeem': 5,
|
564
|
+
'finance/staking-defi/sol/purchase': 5,
|
565
|
+
'finance/staking-defi/sol/redeem': 5,
|
561
566
|
# copytrading
|
562
567
|
'copytrading/algo-order': 1,
|
563
568
|
'copytrading/close-subposition': 1,
|
@@ -7034,7 +7039,7 @@ class okx(Exchange, ImplicitAPI):
|
|
7034
7039
|
# }
|
7035
7040
|
#
|
7036
7041
|
data = self.safe_list(response, 'data', [])
|
7037
|
-
return self.
|
7042
|
+
return self.parse_open_interests_history(data, None, since, limit)
|
7038
7043
|
|
7039
7044
|
def parse_open_interest(self, interest, market: Market = None):
|
7040
7045
|
#
|
ccxt/async_support/xt.py
CHANGED
@@ -4175,6 +4175,8 @@ class xt(Exchange, ImplicitAPI):
|
|
4175
4175
|
symbol = self.safe_symbol(marketId, market, '_', 'swap')
|
4176
4176
|
timestamp = self.safe_integer(contract, 'nextCollectionTime')
|
4177
4177
|
interval = self.safe_string(contract, 'collectionInternal')
|
4178
|
+
if interval is not None:
|
4179
|
+
interval = interval + 'h'
|
4178
4180
|
return {
|
4179
4181
|
'info': contract,
|
4180
4182
|
'symbol': symbol,
|
@@ -4193,7 +4195,7 @@ class xt(Exchange, ImplicitAPI):
|
|
4193
4195
|
'previousFundingRate': None,
|
4194
4196
|
'previousFundingTimestamp': None,
|
4195
4197
|
'previousFundingDatetime': None,
|
4196
|
-
'interval': interval
|
4198
|
+
'interval': interval,
|
4197
4199
|
}
|
4198
4200
|
|
4199
4201
|
async def fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|