ccxt 4.4.34__py2.py3-none-any.whl → 4.4.35__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/bingx.py +1 -0
- ccxt/abstract/bitpanda.py +0 -12
- ccxt/abstract/bitrue.py +3 -3
- ccxt/abstract/okx.py +1 -0
- ccxt/abstract/onetrading.py +0 -12
- ccxt/abstract/xt.py +5 -5
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/bingx.py +324 -138
- ccxt/async_support/bitmex.py +1 -1
- ccxt/async_support/bitrue.py +2 -2
- ccxt/async_support/btcmarkets.py +3 -3
- ccxt/async_support/btcturk.py +19 -19
- ccxt/async_support/gate.py +142 -39
- ccxt/async_support/hyperliquid.py +68 -11
- ccxt/async_support/idex.py +3 -4
- ccxt/async_support/kraken.py +58 -49
- ccxt/async_support/kucoin.py +1 -1
- ccxt/async_support/okx.py +1 -0
- ccxt/async_support/onetrading.py +47 -369
- ccxt/async_support/xt.py +10 -10
- ccxt/base/exchange.py +2 -1
- ccxt/bingx.py +324 -138
- ccxt/bitmex.py +1 -1
- ccxt/bitrue.py +2 -2
- ccxt/btcmarkets.py +3 -3
- ccxt/btcturk.py +19 -19
- ccxt/gate.py +142 -39
- ccxt/hyperliquid.py +68 -11
- ccxt/idex.py +3 -4
- ccxt/kraken.py +58 -49
- ccxt/kucoin.py +1 -1
- ccxt/okx.py +1 -0
- ccxt/onetrading.py +47 -369
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/bitrue.py +13 -11
- ccxt/pro/probit.py +54 -66
- ccxt/test/tests_async.py +29 -2
- ccxt/test/tests_sync.py +29 -2
- ccxt/xt.py +10 -10
- {ccxt-4.4.34.dist-info → ccxt-4.4.35.dist-info}/METADATA +4 -4
- {ccxt-4.4.34.dist-info → ccxt-4.4.35.dist-info}/RECORD +46 -46
- {ccxt-4.4.34.dist-info → ccxt-4.4.35.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.34.dist-info → ccxt-4.4.35.dist-info}/WHEEL +0 -0
- {ccxt-4.4.34.dist-info → ccxt-4.4.35.dist-info}/top_level.txt +0 -0
ccxt/idex.py
CHANGED
@@ -19,7 +19,6 @@ from ccxt.base.errors import DDoSProtection
|
|
19
19
|
from ccxt.base.errors import ExchangeNotAvailable
|
20
20
|
from ccxt.base.decimal_to_precision import ROUND
|
21
21
|
from ccxt.base.decimal_to_precision import TRUNCATE
|
22
|
-
from ccxt.base.decimal_to_precision import DECIMAL_PLACES
|
23
22
|
from ccxt.base.decimal_to_precision import TICK_SIZE
|
24
23
|
from ccxt.base.decimal_to_precision import PAD_WITH_ZERO
|
25
24
|
from ccxt.base.precise import Precise
|
@@ -206,10 +205,8 @@ class idex(Exchange, ImplicitAPI):
|
|
206
205
|
# {"code":"INVALID_PARAMETER","message":"invalid value provided for request parameter \"price\": all quantities and prices must be below 100 billion, above 0, need to be provided, and always require 4 decimals ending with 4 zeroes"}
|
207
206
|
#
|
208
207
|
market = self.market(symbol)
|
209
|
-
info = self.safe_value(market, 'info', {})
|
210
|
-
quoteAssetPrecision = self.safe_integer(info, 'quoteAssetPrecision')
|
211
208
|
price = self.decimal_to_precision(price, ROUND, market['precision']['price'], self.precisionMode)
|
212
|
-
return self.decimal_to_precision(price, TRUNCATE,
|
209
|
+
return self.decimal_to_precision(price, TRUNCATE, market['precision']['quote'], TICK_SIZE, PAD_WITH_ZERO)
|
213
210
|
|
214
211
|
def fetch_markets(self, params={}) -> List[Market]:
|
215
212
|
"""
|
@@ -316,6 +313,8 @@ class idex(Exchange, ImplicitAPI):
|
|
316
313
|
'precision': {
|
317
314
|
'amount': basePrecision,
|
318
315
|
'price': self.safe_number(entry, 'tickSize'),
|
316
|
+
'base': basePrecision,
|
317
|
+
'quote': quotePrecision,
|
319
318
|
},
|
320
319
|
'limits': {
|
321
320
|
'leverage': {
|
ccxt/kraken.py
CHANGED
@@ -1553,18 +1553,9 @@ class kraken(Exchange, ImplicitAPI):
|
|
1553
1553
|
# editOrder
|
1554
1554
|
#
|
1555
1555
|
# {
|
1556
|
-
# "
|
1557
|
-
# "txid": "OAW2BO-7RWEK-PZY5UO",
|
1558
|
-
# "originaltxid": "OXL6SS-UPNMC-26WBE7",
|
1559
|
-
# "newuserref": 1234,
|
1560
|
-
# "olduserref": 123,
|
1561
|
-
# "volume": "0.00075000",
|
1562
|
-
# "price": "13500.0",
|
1563
|
-
# "orders_cancelled": 1,
|
1564
|
-
# "descr": {
|
1565
|
-
# "order": "buy 0.00075000 XBTUSDT @ limit 13500.0"
|
1566
|
-
# }
|
1556
|
+
# "amend_id": "TJSMEH-AA67V-YUSQ6O"
|
1567
1557
|
# }
|
1558
|
+
#
|
1568
1559
|
# ws - createOrder
|
1569
1560
|
# {
|
1570
1561
|
# "descr": 'sell 0.00010000 XBTUSDT @ market',
|
@@ -1687,11 +1678,11 @@ class kraken(Exchange, ImplicitAPI):
|
|
1687
1678
|
elif flags.find('fcib') >= 0:
|
1688
1679
|
fee['currency'] = market['base']
|
1689
1680
|
status = self.parse_order_status(self.safe_string(order, 'status'))
|
1690
|
-
id = self.
|
1681
|
+
id = self.safe_string_n(order, ['id', 'txid', 'amend_id'])
|
1691
1682
|
if (id is None) or (id.startswith('[')):
|
1692
1683
|
txid = self.safe_list(order, 'txid')
|
1693
1684
|
id = self.safe_string(txid, 0)
|
1694
|
-
clientOrderId = self.
|
1685
|
+
clientOrderId = self.safe_string(order, 'userref')
|
1695
1686
|
rawTrades = self.safe_value(order, 'trades', [])
|
1696
1687
|
trades = []
|
1697
1688
|
for i in range(0, len(rawTrades)):
|
@@ -1706,22 +1697,26 @@ class kraken(Exchange, ImplicitAPI):
|
|
1706
1697
|
takeProfitPrice = None
|
1707
1698
|
# the dashed strings are not provided from fields(eg. fetch order)
|
1708
1699
|
# while spaced strings from "order" sentence(when other fields not available)
|
1709
|
-
if rawType
|
1710
|
-
|
1711
|
-
|
1712
|
-
|
1713
|
-
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1718
|
-
|
1700
|
+
if rawType is not None:
|
1701
|
+
if rawType.startswith('take-profit'):
|
1702
|
+
takeProfitPrice = self.safe_string(description, 'price')
|
1703
|
+
price = self.omit_zero(self.safe_string(description, 'price2'))
|
1704
|
+
elif rawType.startswith('stop-loss'):
|
1705
|
+
stopLossPrice = self.safe_string(description, 'price')
|
1706
|
+
price = self.omit_zero(self.safe_string(description, 'price2'))
|
1707
|
+
elif rawType == 'take profit':
|
1708
|
+
takeProfitPrice = triggerPrice
|
1709
|
+
elif rawType == 'stop loss':
|
1710
|
+
stopLossPrice = triggerPrice
|
1719
1711
|
finalType = self.parse_order_type(rawType)
|
1720
1712
|
# unlike from endpoints which provide eg: "take-profit-limit"
|
1721
1713
|
# for "space-delimited" orders we dont have market/limit suffixes, their format is
|
1722
1714
|
# eg: `stop loss > limit 123`, so we need to parse them manually
|
1723
1715
|
if self.in_array(finalType, ['stop loss', 'take profit']):
|
1724
1716
|
finalType = 'market' if (price is None) else 'limit'
|
1717
|
+
amendId = self.safe_string(order, 'amend_id')
|
1718
|
+
if amendId is not None:
|
1719
|
+
isPostOnly = None
|
1725
1720
|
return self.safe_order({
|
1726
1721
|
'id': id,
|
1727
1722
|
'clientOrderId': clientOrderId,
|
@@ -1751,10 +1746,10 @@ class kraken(Exchange, ImplicitAPI):
|
|
1751
1746
|
}, market)
|
1752
1747
|
|
1753
1748
|
def order_request(self, method: str, symbol: str, type: str, request: dict, amount: Num, price: Num = None, params={}):
|
1754
|
-
clientOrderId = self.
|
1755
|
-
params = self.omit(params, ['
|
1749
|
+
clientOrderId = self.safe_string(params, 'clientOrderId')
|
1750
|
+
params = self.omit(params, ['clientOrderId'])
|
1756
1751
|
if clientOrderId is not None:
|
1757
|
-
request['
|
1752
|
+
request['cl_ord_id'] = clientOrderId
|
1758
1753
|
stopLossTriggerPrice = self.safe_string(params, 'stopLossPrice')
|
1759
1754
|
takeProfitTriggerPrice = self.safe_string(params, 'takeProfitPrice')
|
1760
1755
|
isStopLossTriggerOrder = stopLossTriggerPrice is not None
|
@@ -1854,21 +1849,24 @@ class kraken(Exchange, ImplicitAPI):
|
|
1854
1849
|
"""
|
1855
1850
|
edit a trade order
|
1856
1851
|
|
1857
|
-
https://docs.kraken.com/rest
|
1852
|
+
https://docs.kraken.com/api/docs/rest-api/amend-order
|
1858
1853
|
|
1859
1854
|
:param str id: order id
|
1860
1855
|
:param str symbol: unified symbol of the market to create an order in
|
1861
1856
|
:param str type: 'market' or 'limit'
|
1862
1857
|
:param str side: 'buy' or 'sell'
|
1863
|
-
:param float amount: how much of the currency you want to trade in units of the base currency
|
1858
|
+
:param float [amount]: how much of the currency you want to trade in units of the base currency
|
1864
1859
|
:param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
1865
1860
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1866
|
-
:param float [params.stopLossPrice]:
|
1867
|
-
:param float [params.takeProfitPrice]:
|
1868
|
-
:param str [params.trailingAmount]:
|
1869
|
-
:param str [params.
|
1870
|
-
:param str [params.
|
1871
|
-
:param str [params.
|
1861
|
+
:param float [params.stopLossPrice]: the price that a stop loss order is triggered at
|
1862
|
+
:param float [params.takeProfitPrice]: the price that a take profit order is triggered at
|
1863
|
+
:param str [params.trailingAmount]: the quote amount to trail away from the current market price
|
1864
|
+
:param str [params.trailingPercent]: the percent to trail away from the current market price
|
1865
|
+
:param str [params.trailingLimitAmount]: the quote amount away from the trailingAmount
|
1866
|
+
:param str [params.trailingLimitPercent]: the percent away from the trailingAmount
|
1867
|
+
:param str [params.offset]: '+' or '-' whether you want the trailingLimitAmount value to be positive or negative
|
1868
|
+
:param boolean [params.postOnly]: if True, the order will only be posted to the order book and not executed immediately
|
1869
|
+
:param str [params.clientOrderId]: the orders client order id
|
1872
1870
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1873
1871
|
"""
|
1874
1872
|
self.load_markets()
|
@@ -1877,30 +1875,41 @@ class kraken(Exchange, ImplicitAPI):
|
|
1877
1875
|
raise NotSupported(self.id + ' editOrder() does not support ' + market['type'] + ' orders, only spot orders are accepted')
|
1878
1876
|
request: dict = {
|
1879
1877
|
'txid': id,
|
1880
|
-
'pair': market['id'],
|
1881
1878
|
}
|
1879
|
+
clientOrderId = self.safe_string(params, 'clientOrderId')
|
1880
|
+
if clientOrderId is not None:
|
1881
|
+
request['cl_ord_id'] = clientOrderId
|
1882
|
+
params = self.omit(params, 'clientOrderId')
|
1883
|
+
request = self.omit(request, 'txid')
|
1884
|
+
isMarket = (type == 'market')
|
1885
|
+
postOnly = None
|
1886
|
+
postOnly, params = self.handle_post_only(isMarket, False, params)
|
1887
|
+
if postOnly:
|
1888
|
+
request['post_only'] = 'true' # not using hasattr(self, boolean) case, because the urlencodedNested transforms it into 'True' string
|
1882
1889
|
if amount is not None:
|
1883
|
-
request['
|
1884
|
-
|
1885
|
-
|
1890
|
+
request['order_qty'] = self.amount_to_precision(symbol, amount)
|
1891
|
+
if price is not None:
|
1892
|
+
request['limit_price'] = self.price_to_precision(symbol, price)
|
1893
|
+
allTriggerPrices = self.safe_string_n(params, ['stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'trailingLimitAmount', 'trailingLimitPercent'])
|
1894
|
+
if allTriggerPrices is not None:
|
1895
|
+
offset = self.safe_string(params, 'offset')
|
1896
|
+
params = self.omit(params, ['stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'trailingLimitAmount', 'trailingLimitPercent', 'offset'])
|
1897
|
+
if offset is not None:
|
1898
|
+
allTriggerPrices = offset + allTriggerPrices
|
1899
|
+
request['trigger_price'] = allTriggerPrices
|
1900
|
+
else:
|
1901
|
+
request['trigger_price'] = self.price_to_precision(symbol, allTriggerPrices)
|
1902
|
+
response = self.privatePostAmendOrder(self.extend(request, params))
|
1886
1903
|
#
|
1887
1904
|
# {
|
1888
1905
|
# "error": [],
|
1889
1906
|
# "result": {
|
1890
|
-
# "
|
1891
|
-
# "txid": "OAW2BO-7RWEK-PZY5UO",
|
1892
|
-
# "originaltxid": "OXL6SS-UPNMC-26WBE7",
|
1893
|
-
# "volume": "0.00075000",
|
1894
|
-
# "price": "13500.0",
|
1895
|
-
# "orders_cancelled": 1,
|
1896
|
-
# "descr": {
|
1897
|
-
# "order": "buy 0.00075000 XBTUSDT @ limit 13500.0"
|
1898
|
-
# }
|
1907
|
+
# "amend_id": "TJSMEH-AA67V-YUSQ6O"
|
1899
1908
|
# }
|
1900
1909
|
# }
|
1901
1910
|
#
|
1902
|
-
|
1903
|
-
return self.parse_order(
|
1911
|
+
result = self.safe_dict(response, 'result', {})
|
1912
|
+
return self.parse_order(result, market)
|
1904
1913
|
|
1905
1914
|
def fetch_order(self, id: str, symbol: Str = None, params={}):
|
1906
1915
|
"""
|
ccxt/kucoin.py
CHANGED
ccxt/okx.py
CHANGED