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/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
|
+
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
|
+
self.load_markets()
|
1371
|
+
params = self.extend(params, {'cost': cost})
|
1372
|
+
return self.create_order(symbol, 'market', side, cost, None, params)
|
1373
|
+
|
1374
|
+
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
|
+
self.load_markets()
|
1386
|
+
params = self.extend(params, {'cost': cost})
|
1387
|
+
return self.create_order(symbol, 'market', 'buy', cost, None, params)
|
1388
|
+
|
1389
|
+
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
|
+
self.load_markets()
|
1401
|
+
params = self.extend(params, {'cost': cost})
|
1402
|
+
return self.create_order(symbol, 'market', 'sell', cost, None, params)
|
1403
|
+
|
1355
1404
|
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
|
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/gate.py
CHANGED
@@ -6487,7 +6487,7 @@ class gate(Exchange, ImplicitAPI):
|
|
6487
6487
|
# ...
|
6488
6488
|
# ]
|
6489
6489
|
#
|
6490
|
-
return self.
|
6490
|
+
return self.parse_open_interests_history(response, market, since, limit)
|
6491
6491
|
|
6492
6492
|
def parse_open_interest(self, interest, market: Market = None):
|
6493
6493
|
#
|
ccxt/htx.py
CHANGED
@@ -8003,7 +8003,7 @@ class htx(Exchange, ImplicitAPI):
|
|
8003
8003
|
#
|
8004
8004
|
data = self.safe_value(response, 'data')
|
8005
8005
|
tick = self.safe_list(data, 'tick')
|
8006
|
-
return self.
|
8006
|
+
return self.parse_open_interests_history(tick, market, since, limit)
|
8007
8007
|
|
8008
8008
|
def fetch_open_interest(self, symbol: str, params={}):
|
8009
8009
|
"""
|
ccxt/hyperliquid.py
CHANGED
@@ -94,8 +94,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
94
94
|
'fetchMyLiquidations': False,
|
95
95
|
'fetchMyTrades': True,
|
96
96
|
'fetchOHLCV': True,
|
97
|
-
'fetchOpenInterest':
|
97
|
+
'fetchOpenInterest': True,
|
98
98
|
'fetchOpenInterestHistory': False,
|
99
|
+
'fetchOpenInterests': True,
|
99
100
|
'fetchOpenOrders': True,
|
100
101
|
'fetchOrder': True,
|
101
102
|
'fetchOrderBook': True,
|
@@ -3131,6 +3132,64 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
3131
3132
|
withdrawals = self.filter_by_array(records, 'type', ['withdraw'], False)
|
3132
3133
|
return self.parse_transactions(withdrawals, None, since, limit)
|
3133
3134
|
|
3135
|
+
def fetch_open_interests(self, symbols: Strings = None, params={}):
|
3136
|
+
"""
|
3137
|
+
Retrieves the open interest for a list of symbols
|
3138
|
+
:param str[] [symbols]: Unified CCXT market symbol
|
3139
|
+
:param dict [params]: exchange specific parameters
|
3140
|
+
:returns dict} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure:
|
3141
|
+
"""
|
3142
|
+
self.load_markets()
|
3143
|
+
symbols = self.market_symbols(symbols)
|
3144
|
+
swapMarkets = self.fetch_swap_markets()
|
3145
|
+
result = self.parse_open_interests(swapMarkets)
|
3146
|
+
return self.filter_by_array(result, 'symbol', symbols)
|
3147
|
+
|
3148
|
+
def fetch_open_interest(self, symbol: str, params={}):
|
3149
|
+
"""
|
3150
|
+
retrieves the open interest of a contract trading pair
|
3151
|
+
:param str symbol: unified CCXT market symbol
|
3152
|
+
:param dict [params]: exchange specific parameters
|
3153
|
+
:returns dict: an `open interest structure <https://docs.ccxt.com/#/?id=open-interest-structure>`
|
3154
|
+
"""
|
3155
|
+
symbol = self.symbol(symbol)
|
3156
|
+
self.load_markets()
|
3157
|
+
ois = self.fetch_open_interests([symbol], params)
|
3158
|
+
return ois[symbol]
|
3159
|
+
|
3160
|
+
def parse_open_interest(self, interest, market: Market = None):
|
3161
|
+
#
|
3162
|
+
# {
|
3163
|
+
# szDecimals: '2',
|
3164
|
+
# name: 'HYPE',
|
3165
|
+
# maxLeverage: '3',
|
3166
|
+
# funding: '0.00014735',
|
3167
|
+
# openInterest: '14677900.74',
|
3168
|
+
# prevDayPx: '26.145',
|
3169
|
+
# dayNtlVlm: '299643445.12560016',
|
3170
|
+
# premium: '0.00081613',
|
3171
|
+
# oraclePx: '27.569',
|
3172
|
+
# markPx: '27.63',
|
3173
|
+
# midPx: '27.599',
|
3174
|
+
# impactPxs: ['27.5915', '27.6319'],
|
3175
|
+
# dayBaseVlm: '10790652.83',
|
3176
|
+
# baseId: 159
|
3177
|
+
# }
|
3178
|
+
#
|
3179
|
+
interest = self.safe_dict(interest, 'info', {})
|
3180
|
+
coin = self.safe_string(interest, 'name')
|
3181
|
+
marketId = None
|
3182
|
+
if coin is not None:
|
3183
|
+
marketId = self.coin_to_market_id(coin)
|
3184
|
+
return self.safe_open_interest({
|
3185
|
+
'symbol': self.safe_symbol(marketId),
|
3186
|
+
'openInterestAmount': self.safe_number(interest, 'openInterest'),
|
3187
|
+
'openInterestValue': None,
|
3188
|
+
'timestamp': None,
|
3189
|
+
'datetime': None,
|
3190
|
+
'info': interest,
|
3191
|
+
}, market)
|
3192
|
+
|
3134
3193
|
def extract_type_from_delta(self, data=[]):
|
3135
3194
|
records = []
|
3136
3195
|
for i in range(0, len(data)):
|
ccxt/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
|
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 = 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
|
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 = self.privatePostOpenOrders(self.extend(request,
|
2340
|
+
request['cl_ord_id'] = clientOrderId
|
2341
|
+
params = self.omit(params, 'clientOrderId')
|
2342
|
+
response = 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
|
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
|
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 = self.privatePostClosedOrders(self.extend(request,
|
2421
|
+
response = 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/kucoin.py
CHANGED
@@ -659,6 +659,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
659
659
|
'version': 'v1',
|
660
660
|
'symbolSeparator': '-',
|
661
661
|
'fetchMyTradesMethod': 'private_get_fills',
|
662
|
+
'timeDifference': 0, # the difference between system clock and Binance clock
|
663
|
+
'adjustForTimeDifference': False, # controls the adjustment logic upon instantiation
|
662
664
|
'fetchCurrencies': {
|
663
665
|
'webApiEnable': True, # fetches from WEB
|
664
666
|
'webApiRetries': 1,
|
@@ -1075,7 +1077,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1075
1077
|
})
|
1076
1078
|
|
1077
1079
|
def nonce(self):
|
1078
|
-
return self.milliseconds()
|
1080
|
+
return self.milliseconds() - self.options['timeDifference']
|
1079
1081
|
|
1080
1082
|
def fetch_time(self, params={}):
|
1081
1083
|
"""
|
@@ -1312,6 +1314,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1312
1314
|
'created': None,
|
1313
1315
|
'info': market,
|
1314
1316
|
})
|
1317
|
+
if self.options['adjustForTimeDifference']:
|
1318
|
+
self.load_time_difference()
|
1315
1319
|
return result
|
1316
1320
|
|
1317
1321
|
def load_migration_status(self, force: bool = False):
|
ccxt/mexc.py
CHANGED
@@ -689,7 +689,7 @@ class mexc(Exchange, ImplicitAPI):
|
|
689
689
|
'broker': 'CCXT',
|
690
690
|
},
|
691
691
|
'features': {
|
692
|
-
'
|
692
|
+
'default': {
|
693
693
|
'sandbox': False,
|
694
694
|
'createOrder': {
|
695
695
|
'marginMode': True,
|
@@ -757,10 +757,10 @@ class mexc(Exchange, ImplicitAPI):
|
|
757
757
|
},
|
758
758
|
},
|
759
759
|
'spot': {
|
760
|
-
'extends': '
|
760
|
+
'extends': 'default',
|
761
761
|
},
|
762
762
|
'forDerivs': {
|
763
|
-
'extends': '
|
763
|
+
'extends': 'default',
|
764
764
|
'createOrder': {
|
765
765
|
'triggerPrice': True,
|
766
766
|
'triggerPriceType': {
|
ccxt/okx.py
CHANGED
@@ -285,6 +285,7 @@ class okx(Exchange, ImplicitAPI):
|
|
285
285
|
'tradingBot/public/rsi-back-testing': 1,
|
286
286
|
'asset/exchange-list': 5 / 3,
|
287
287
|
'finance/staking-defi/eth/apy-history': 5 / 3,
|
288
|
+
'finance/staking-defi/sol/apy-history': 5 / 3,
|
288
289
|
'finance/savings/lending-rate-summary': 5 / 3,
|
289
290
|
'finance/savings/lending-rate-history': 5 / 3,
|
290
291
|
'finance/fixed-loan/lending-offers': 10 / 3,
|
@@ -423,6 +424,8 @@ class okx(Exchange, ImplicitAPI):
|
|
423
424
|
'finance/staking-defi/eth/balance': 5 / 3,
|
424
425
|
'finance/staking-defi/eth/purchase-redeem-history': 5 / 3,
|
425
426
|
'finance/staking-defi/eth/product-info': 3,
|
427
|
+
'finance/staking-defi/sol/balance': 5 / 3,
|
428
|
+
'finance/staking-defi/sol/purchase-redeem-history': 5 / 3,
|
426
429
|
# copytrading
|
427
430
|
'copytrading/current-subpositions': 1,
|
428
431
|
'copytrading/subpositions-history': 1,
|
@@ -557,6 +560,8 @@ class okx(Exchange, ImplicitAPI):
|
|
557
560
|
# eth staking
|
558
561
|
'finance/staking-defi/eth/purchase': 5,
|
559
562
|
'finance/staking-defi/eth/redeem': 5,
|
563
|
+
'finance/staking-defi/sol/purchase': 5,
|
564
|
+
'finance/staking-defi/sol/redeem': 5,
|
560
565
|
# copytrading
|
561
566
|
'copytrading/algo-order': 1,
|
562
567
|
'copytrading/close-subposition': 1,
|
@@ -7033,7 +7038,7 @@ class okx(Exchange, ImplicitAPI):
|
|
7033
7038
|
# }
|
7034
7039
|
#
|
7035
7040
|
data = self.safe_list(response, 'data', [])
|
7036
|
-
return self.
|
7041
|
+
return self.parse_open_interests_history(data, None, since, limit)
|
7037
7042
|
|
7038
7043
|
def parse_open_interest(self, interest, market: Market = None):
|
7039
7044
|
#
|
ccxt/pro/__init__.py
CHANGED
ccxt/xt.py
CHANGED
@@ -4174,6 +4174,8 @@ class xt(Exchange, ImplicitAPI):
|
|
4174
4174
|
symbol = self.safe_symbol(marketId, market, '_', 'swap')
|
4175
4175
|
timestamp = self.safe_integer(contract, 'nextCollectionTime')
|
4176
4176
|
interval = self.safe_string(contract, 'collectionInternal')
|
4177
|
+
if interval is not None:
|
4178
|
+
interval = interval + 'h'
|
4177
4179
|
return {
|
4178
4180
|
'info': contract,
|
4179
4181
|
'symbol': symbol,
|
@@ -4192,7 +4194,7 @@ class xt(Exchange, ImplicitAPI):
|
|
4192
4194
|
'previousFundingRate': None,
|
4193
4195
|
'previousFundingTimestamp': None,
|
4194
4196
|
'previousFundingDatetime': None,
|
4195
|
-
'interval': interval
|
4197
|
+
'interval': interval,
|
4196
4198
|
}
|
4197
4199
|
|
4198
4200
|
def fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ccxt
|
3
|
-
Version: 4.4.
|
3
|
+
Version: 4.4.41
|
4
4
|
Summary: A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges
|
5
5
|
Home-page: https://ccxt.com
|
6
6
|
Author: Igor Kroitor
|
@@ -275,13 +275,13 @@ console.log(version, Object.keys(exchanges));
|
|
275
275
|
|
276
276
|
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
277
277
|
|
278
|
-
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.4.
|
279
|
-
* unpkg: https://unpkg.com/ccxt@4.4.
|
278
|
+
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.4.41/dist/ccxt.browser.min.js
|
279
|
+
* unpkg: https://unpkg.com/ccxt@4.4.41/dist/ccxt.browser.min.js
|
280
280
|
|
281
281
|
CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
|
282
282
|
|
283
283
|
```HTML
|
284
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.4.
|
284
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.4.41/dist/ccxt.browser.min.js"></script>
|
285
285
|
```
|
286
286
|
|
287
287
|
Creates a global `ccxt` object:
|