ccxt 4.3.58__py2.py3-none-any.whl → 4.3.59__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 +5 -5
- ccxt/abstract/bitmart.py +1 -0
- ccxt/abstract/btcbox.py +1 -0
- ccxt/abstract/upbit.py +3 -0
- ccxt/abstract/xt.py +1 -0
- ccxt/async_support/__init__.py +5 -5
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/binance.py +1 -1
- ccxt/async_support/bingx.py +47 -7
- ccxt/async_support/bitget.py +1 -1
- ccxt/async_support/bitmart.py +1 -0
- ccxt/async_support/btcbox.py +145 -8
- ccxt/async_support/bybit.py +2 -2
- ccxt/async_support/cex.py +1 -1
- ccxt/async_support/coinsph.py +1 -1
- ccxt/async_support/deribit.py +15 -1
- ccxt/async_support/digifinex.py +30 -7
- ccxt/async_support/gate.py +16 -16
- ccxt/async_support/htx.py +7 -7
- ccxt/async_support/hyperliquid.py +106 -2
- ccxt/async_support/kraken.py +1 -1
- ccxt/async_support/mexc.py +11 -11
- ccxt/async_support/novadax.py +1 -1
- ccxt/async_support/okcoin.py +1 -1
- ccxt/async_support/okx.py +1 -1
- ccxt/async_support/phemex.py +1 -1
- ccxt/async_support/probit.py +1 -1
- ccxt/async_support/tokocrypto.py +1 -1
- ccxt/async_support/upbit.py +139 -45
- ccxt/async_support/xt.py +70 -7
- ccxt/base/errors.py +23 -23
- ccxt/base/exchange.py +9 -9
- ccxt/binance.py +1 -1
- ccxt/bingx.py +47 -7
- ccxt/bitget.py +1 -1
- ccxt/bitmart.py +1 -0
- ccxt/btcbox.py +145 -8
- ccxt/bybit.py +2 -2
- ccxt/cex.py +1 -1
- ccxt/coinsph.py +1 -1
- ccxt/deribit.py +15 -1
- ccxt/digifinex.py +30 -7
- ccxt/gate.py +16 -16
- ccxt/htx.py +7 -7
- ccxt/hyperliquid.py +106 -2
- ccxt/kraken.py +1 -1
- ccxt/mexc.py +11 -11
- ccxt/novadax.py +1 -1
- ccxt/okcoin.py +1 -1
- ccxt/okx.py +1 -1
- ccxt/phemex.py +1 -1
- ccxt/pro/__init__.py +3 -1
- ccxt/pro/binance.py +11 -13
- ccxt/pro/bingx.py +11 -8
- ccxt/pro/bitmart.py +2 -2
- ccxt/pro/bitopro.py +1 -1
- ccxt/pro/coincheck.py +1 -1
- ccxt/pro/coinone.py +1 -1
- ccxt/pro/hyperliquid.py +1 -1
- ccxt/pro/xt.py +1043 -0
- ccxt/probit.py +1 -1
- ccxt/test/tests_async.py +2 -2
- ccxt/test/tests_helpers.py +1 -1
- ccxt/test/tests_sync.py +2 -2
- ccxt/tokocrypto.py +1 -1
- ccxt/upbit.py +139 -45
- ccxt/xt.py +70 -7
- {ccxt-4.3.58.dist-info → ccxt-4.3.59.dist-info}/METADATA +5 -5
- {ccxt-4.3.58.dist-info → ccxt-4.3.59.dist-info}/RECORD +72 -71
- {ccxt-4.3.58.dist-info → ccxt-4.3.59.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.3.58.dist-info → ccxt-4.3.59.dist-info}/WHEEL +0 -0
- {ccxt-4.3.58.dist-info → ccxt-4.3.59.dist-info}/top_level.txt +0 -0
ccxt/async_support/xt.py
CHANGED
@@ -40,7 +40,7 @@ class xt(Exchange, ImplicitAPI):
|
|
40
40
|
'rateLimit': 100,
|
41
41
|
'version': 'v4',
|
42
42
|
'certified': False,
|
43
|
-
'pro':
|
43
|
+
'pro': True,
|
44
44
|
'has': {
|
45
45
|
'CORS': False,
|
46
46
|
'spot': True,
|
@@ -235,6 +235,7 @@ class xt(Exchange, ImplicitAPI):
|
|
235
235
|
'withdraw': 1,
|
236
236
|
'balance/transfer': 1,
|
237
237
|
'balance/account/transfer': 1,
|
238
|
+
'ws-token': 1,
|
238
239
|
},
|
239
240
|
'delete': {
|
240
241
|
'batch-order': 1,
|
@@ -1436,8 +1437,12 @@ class xt(Exchange, ImplicitAPI):
|
|
1436
1437
|
orderBook = self.safe_value(response, 'result', {})
|
1437
1438
|
timestamp = self.safe_integer_2(orderBook, 'timestamp', 't')
|
1438
1439
|
if market['spot']:
|
1439
|
-
|
1440
|
-
|
1440
|
+
ob = self.parse_order_book(orderBook, symbol, timestamp)
|
1441
|
+
ob['nonce'] = self.safe_integer(orderBook, 'lastUpdateId')
|
1442
|
+
return ob
|
1443
|
+
swapOb = self.parse_order_book(orderBook, symbol, timestamp, 'b', 'a')
|
1444
|
+
swapOb['nonce'] = self.safe_integer_2(orderBook, 'u', 'lastUpdateId')
|
1445
|
+
return swapOb
|
1441
1446
|
|
1442
1447
|
async def fetch_ticker(self, symbol: str, params={}):
|
1443
1448
|
"""
|
@@ -1680,8 +1685,9 @@ class xt(Exchange, ImplicitAPI):
|
|
1680
1685
|
#
|
1681
1686
|
marketId = self.safe_string(ticker, 's')
|
1682
1687
|
marketType = market['type'] if (market is not None) else None
|
1688
|
+
hasSpotKeys = ('cv' in ticker) or ('aq' in ticker)
|
1683
1689
|
if marketType is None:
|
1684
|
-
marketType =
|
1690
|
+
marketType = 'spot' if hasSpotKeys else 'contract'
|
1685
1691
|
market = self.safe_market(marketId, market, '_', marketType)
|
1686
1692
|
symbol = market['symbol']
|
1687
1693
|
timestamp = self.safe_integer(ticker, 't')
|
@@ -1889,6 +1895,29 @@ class xt(Exchange, ImplicitAPI):
|
|
1889
1895
|
# "b": True
|
1890
1896
|
# }
|
1891
1897
|
#
|
1898
|
+
# spot: watchMyTrades
|
1899
|
+
#
|
1900
|
+
# {
|
1901
|
+
# "s": "btc_usdt", # symbol
|
1902
|
+
# "t": 1656043204763, # time
|
1903
|
+
# "i": "6316559590087251233", # tradeId
|
1904
|
+
# "oi": "6216559590087220004", # orderId
|
1905
|
+
# "p": "30000", # trade price
|
1906
|
+
# "q": "3", # qty quantity
|
1907
|
+
# "v": "90000" # volume trade amount
|
1908
|
+
# }
|
1909
|
+
#
|
1910
|
+
# spot: watchTrades
|
1911
|
+
#
|
1912
|
+
# {
|
1913
|
+
# s: 'btc_usdt',
|
1914
|
+
# i: '228825383103928709',
|
1915
|
+
# t: 1684258222702,
|
1916
|
+
# p: '27003.65',
|
1917
|
+
# q: '0.000796',
|
1918
|
+
# b: True
|
1919
|
+
# }
|
1920
|
+
#
|
1892
1921
|
# swap and future: fetchTrades
|
1893
1922
|
#
|
1894
1923
|
# {
|
@@ -1933,19 +1962,53 @@ class xt(Exchange, ImplicitAPI):
|
|
1933
1962
|
# "takerMaker": "TAKER"
|
1934
1963
|
# }
|
1935
1964
|
#
|
1965
|
+
# contract watchMyTrades
|
1966
|
+
#
|
1967
|
+
# {
|
1968
|
+
# "symbol": 'btc_usdt',
|
1969
|
+
# "orderSide": 'SELL',
|
1970
|
+
# "positionSide": 'LONG',
|
1971
|
+
# "orderId": '231485367663419328',
|
1972
|
+
# "price": '27152.7',
|
1973
|
+
# "quantity": '33',
|
1974
|
+
# "marginUnfrozen": '2.85318000',
|
1975
|
+
# "timestamp": 1684892412565
|
1976
|
+
# }
|
1977
|
+
#
|
1978
|
+
# watchMyTrades(ws, swap)
|
1979
|
+
#
|
1980
|
+
# {
|
1981
|
+
# 'fee': '0.04080840',
|
1982
|
+
# 'isMaker': False,
|
1983
|
+
# 'marginUnfrozen': '0.75711984',
|
1984
|
+
# 'orderId': '376172779053188416',
|
1985
|
+
# 'orderSide': 'BUY',
|
1986
|
+
# 'positionSide': 'LONG',
|
1987
|
+
# 'price': '3400.70',
|
1988
|
+
# 'quantity': '2',
|
1989
|
+
# 'symbol': 'eth_usdt',
|
1990
|
+
# 'timestamp': 1719388579622
|
1991
|
+
# }
|
1992
|
+
#
|
1936
1993
|
marketId = self.safe_string_2(trade, 's', 'symbol')
|
1937
1994
|
marketType = market['type'] if (market is not None) else None
|
1995
|
+
hasSpotKeys = ('b' in trade) or ('bizType' in trade) or ('oi' in trade)
|
1938
1996
|
if marketType is None:
|
1939
|
-
marketType =
|
1997
|
+
marketType = 'spot' if hasSpotKeys else 'contract'
|
1940
1998
|
market = self.safe_market(marketId, market, '_', marketType)
|
1941
1999
|
bidOrAsk = self.safe_string(trade, 'm')
|
1942
2000
|
side = self.safe_string_lower(trade, 'orderSide')
|
1943
2001
|
if bidOrAsk is not None:
|
1944
2002
|
side = 'buy' if (bidOrAsk == 'BID') else 'sell'
|
1945
2003
|
buyerMaker = self.safe_value(trade, 'b')
|
2004
|
+
if buyerMaker is not None:
|
2005
|
+
side = 'buy'
|
1946
2006
|
takerOrMaker = self.safe_string_lower(trade, 'takerMaker')
|
1947
2007
|
if buyerMaker is not None:
|
1948
2008
|
takerOrMaker = 'maker' if buyerMaker else 'taker'
|
2009
|
+
isMaker = self.safe_bool(trade, 'isMaker')
|
2010
|
+
if isMaker is not None:
|
2011
|
+
takerOrMaker = 'maker' if isMaker else 'taker'
|
1949
2012
|
timestamp = self.safe_integer_n(trade, ['t', 'time', 'timestamp'])
|
1950
2013
|
quantity = self.safe_string_2(trade, 'q', 'quantity')
|
1951
2014
|
amount = None
|
@@ -1962,7 +2025,7 @@ class xt(Exchange, ImplicitAPI):
|
|
1962
2025
|
'timestamp': timestamp,
|
1963
2026
|
'datetime': self.iso8601(timestamp),
|
1964
2027
|
'symbol': market['symbol'],
|
1965
|
-
'order': self.
|
2028
|
+
'order': self.safe_string_2(trade, 'orderId', 'oi'),
|
1966
2029
|
'type': self.safe_string_lower(trade, 'orderType'),
|
1967
2030
|
'side': side,
|
1968
2031
|
'takerOrMaker': takerOrMaker,
|
@@ -4419,7 +4482,7 @@ class xt(Exchange, ImplicitAPI):
|
|
4419
4482
|
body['clientMedia'] = id
|
4420
4483
|
else:
|
4421
4484
|
body['media'] = id
|
4422
|
-
isUndefinedBody = ((method == 'GET') or (path == 'order/{orderId}'))
|
4485
|
+
isUndefinedBody = ((method == 'GET') or (path == 'order/{orderId}') or (path == 'ws-token'))
|
4423
4486
|
body = None if isUndefinedBody else self.json(body)
|
4424
4487
|
payloadString = None
|
4425
4488
|
if (endpoint == 'spot') or (endpoint == 'user'):
|
ccxt/base/errors.py
CHANGED
@@ -17,9 +17,6 @@ error_hierarchy = {
|
|
17
17
|
},
|
18
18
|
'MarketClosed': {},
|
19
19
|
},
|
20
|
-
'BadResponse': {
|
21
|
-
'NullResponse': {},
|
22
|
-
},
|
23
20
|
'InsufficientFunds': {},
|
24
21
|
'InvalidAddress': {
|
25
22
|
'AddressPending': {},
|
@@ -27,14 +24,13 @@ error_hierarchy = {
|
|
27
24
|
'InvalidOrder': {
|
28
25
|
'OrderNotFound': {},
|
29
26
|
'OrderNotCached': {},
|
30
|
-
'CancelPending': {},
|
31
27
|
'OrderImmediatelyFillable': {},
|
32
28
|
'OrderNotFillable': {},
|
33
29
|
'DuplicateOrderId': {},
|
34
30
|
'ContractUnavailable': {},
|
35
31
|
},
|
36
32
|
'NotSupported': {},
|
37
|
-
'
|
33
|
+
'InvalidProxySettings': {},
|
38
34
|
'ExchangeClosedByUser': {},
|
39
35
|
},
|
40
36
|
'OperationFailed': {
|
@@ -47,6 +43,10 @@ error_hierarchy = {
|
|
47
43
|
'InvalidNonce': {},
|
48
44
|
'RequestTimeout': {},
|
49
45
|
},
|
46
|
+
'BadResponse': {
|
47
|
+
'NullResponse': {},
|
48
|
+
},
|
49
|
+
'CancelPending': {},
|
50
50
|
},
|
51
51
|
},
|
52
52
|
}
|
@@ -104,14 +104,6 @@ class MarketClosed(OperationRejected):
|
|
104
104
|
pass
|
105
105
|
|
106
106
|
|
107
|
-
class BadResponse(ExchangeError):
|
108
|
-
pass
|
109
|
-
|
110
|
-
|
111
|
-
class NullResponse(BadResponse):
|
112
|
-
pass
|
113
|
-
|
114
|
-
|
115
107
|
class InsufficientFunds(ExchangeError):
|
116
108
|
pass
|
117
109
|
|
@@ -136,10 +128,6 @@ class OrderNotCached(InvalidOrder):
|
|
136
128
|
pass
|
137
129
|
|
138
130
|
|
139
|
-
class CancelPending(InvalidOrder):
|
140
|
-
pass
|
141
|
-
|
142
|
-
|
143
131
|
class OrderImmediatelyFillable(InvalidOrder):
|
144
132
|
pass
|
145
133
|
|
@@ -160,7 +148,7 @@ class NotSupported(ExchangeError):
|
|
160
148
|
pass
|
161
149
|
|
162
150
|
|
163
|
-
class
|
151
|
+
class InvalidProxySettings(ExchangeError):
|
164
152
|
pass
|
165
153
|
|
166
154
|
|
@@ -200,6 +188,18 @@ class RequestTimeout(NetworkError):
|
|
200
188
|
pass
|
201
189
|
|
202
190
|
|
191
|
+
class BadResponse(OperationFailed):
|
192
|
+
pass
|
193
|
+
|
194
|
+
|
195
|
+
class NullResponse(BadResponse):
|
196
|
+
pass
|
197
|
+
|
198
|
+
|
199
|
+
class CancelPending(OperationFailed):
|
200
|
+
pass
|
201
|
+
|
202
|
+
|
203
203
|
__all__ = [
|
204
204
|
'error_hierarchy',
|
205
205
|
'BaseError',
|
@@ -215,21 +215,18 @@ __all__ = [
|
|
215
215
|
'NoChange',
|
216
216
|
'MarginModeAlreadySet',
|
217
217
|
'MarketClosed',
|
218
|
-
'BadResponse',
|
219
|
-
'NullResponse',
|
220
218
|
'InsufficientFunds',
|
221
219
|
'InvalidAddress',
|
222
220
|
'AddressPending',
|
223
221
|
'InvalidOrder',
|
224
222
|
'OrderNotFound',
|
225
223
|
'OrderNotCached',
|
226
|
-
'CancelPending',
|
227
224
|
'OrderImmediatelyFillable',
|
228
225
|
'OrderNotFillable',
|
229
226
|
'DuplicateOrderId',
|
230
227
|
'ContractUnavailable',
|
231
228
|
'NotSupported',
|
232
|
-
'
|
229
|
+
'InvalidProxySettings',
|
233
230
|
'ExchangeClosedByUser',
|
234
231
|
'OperationFailed',
|
235
232
|
'NetworkError',
|
@@ -238,5 +235,8 @@ __all__ = [
|
|
238
235
|
'ExchangeNotAvailable',
|
239
236
|
'OnMaintenance',
|
240
237
|
'InvalidNonce',
|
241
|
-
'RequestTimeout'
|
238
|
+
'RequestTimeout',
|
239
|
+
'BadResponse',
|
240
|
+
'NullResponse',
|
241
|
+
'CancelPending'
|
242
242
|
]
|
ccxt/base/exchange.py
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
# -----------------------------------------------------------------------------
|
6
6
|
|
7
|
-
__version__ = '4.3.
|
7
|
+
__version__ = '4.3.59'
|
8
8
|
|
9
9
|
# -----------------------------------------------------------------------------
|
10
10
|
|
@@ -23,7 +23,7 @@ from ccxt.base.errors import NullResponse
|
|
23
23
|
from ccxt.base.errors import RateLimitExceeded
|
24
24
|
from ccxt.base.errors import BadRequest
|
25
25
|
from ccxt.base.errors import BadResponse
|
26
|
-
from ccxt.base.errors import
|
26
|
+
from ccxt.base.errors import InvalidProxySettings
|
27
27
|
|
28
28
|
# -----------------------------------------------------------------------------
|
29
29
|
|
@@ -1943,7 +1943,7 @@ class Exchange(object):
|
|
1943
1943
|
length = len(usedProxies)
|
1944
1944
|
if length > 1:
|
1945
1945
|
joinedProxyNames = ','.join(usedProxies)
|
1946
|
-
raise
|
1946
|
+
raise InvalidProxySettings(self.id + ' you have multiple conflicting proxy settings(' + joinedProxyNames + '), please use only one from : proxyUrl, proxy_url, proxyUrlCallback, proxy_url_callback')
|
1947
1947
|
return proxyUrl
|
1948
1948
|
|
1949
1949
|
def check_proxy_settings(self, url: Str = None, method: Str = None, headers=None, body=None):
|
@@ -1994,7 +1994,7 @@ class Exchange(object):
|
|
1994
1994
|
length = len(usedProxies)
|
1995
1995
|
if length > 1:
|
1996
1996
|
joinedProxyNames = ','.join(usedProxies)
|
1997
|
-
raise
|
1997
|
+
raise InvalidProxySettings(self.id + ' you have multiple conflicting proxy settings(' + joinedProxyNames + '), please use only one from: httpProxy, httpsProxy, httpProxyCallback, httpsProxyCallback, socksProxy, socksProxyCallback')
|
1998
1998
|
return [httpProxy, httpsProxy, socksProxy]
|
1999
1999
|
|
2000
2000
|
def check_ws_proxy_settings(self):
|
@@ -2027,12 +2027,12 @@ class Exchange(object):
|
|
2027
2027
|
length = len(usedProxies)
|
2028
2028
|
if length > 1:
|
2029
2029
|
joinedProxyNames = ','.join(usedProxies)
|
2030
|
-
raise
|
2030
|
+
raise InvalidProxySettings(self.id + ' you have multiple conflicting proxy settings(' + joinedProxyNames + '), please use only one from: wsProxy, wssProxy, wsSocksProxy')
|
2031
2031
|
return [wsProxy, wssProxy, wsSocksProxy]
|
2032
2032
|
|
2033
2033
|
def check_conflicting_proxies(self, proxyAgentSet, proxyUrlSet):
|
2034
2034
|
if proxyAgentSet and proxyUrlSet:
|
2035
|
-
raise
|
2035
|
+
raise InvalidProxySettings(self.id + ' you have multiple conflicting proxy settings, please use only one from : proxyUrl, httpProxy, httpsProxy, socksProxy')
|
2036
2036
|
|
2037
2037
|
def find_message_hashes(self, client, element: str):
|
2038
2038
|
result = []
|
@@ -2258,13 +2258,13 @@ class Exchange(object):
|
|
2258
2258
|
def parse_isolated_borrow_rate(self, info: dict, market: Market = None):
|
2259
2259
|
raise NotSupported(self.id + ' parseIsolatedBorrowRate() is not supported yet')
|
2260
2260
|
|
2261
|
-
def parse_ws_trade(self, trade, market: Market = None):
|
2261
|
+
def parse_ws_trade(self, trade: dict, market: Market = None):
|
2262
2262
|
raise NotSupported(self.id + ' parseWsTrade() is not supported yet')
|
2263
2263
|
|
2264
|
-
def parse_ws_order(self, order, market: Market = None):
|
2264
|
+
def parse_ws_order(self, order: dict, market: Market = None):
|
2265
2265
|
raise NotSupported(self.id + ' parseWsOrder() is not supported yet')
|
2266
2266
|
|
2267
|
-
def parse_ws_order_trade(self, trade, market: Market = None):
|
2267
|
+
def parse_ws_order_trade(self, trade: dict, market: Market = None):
|
2268
2268
|
raise NotSupported(self.id + ' parseWsOrderTrade() is not supported yet')
|
2269
2269
|
|
2270
2270
|
def parse_ws_ohlcv(self, ohlcv, market: Market = None):
|
ccxt/binance.py
CHANGED
@@ -19,7 +19,6 @@ from ccxt.base.errors import BadSymbol
|
|
19
19
|
from ccxt.base.errors import OperationRejected
|
20
20
|
from ccxt.base.errors import MarginModeAlreadySet
|
21
21
|
from ccxt.base.errors import MarketClosed
|
22
|
-
from ccxt.base.errors import BadResponse
|
23
22
|
from ccxt.base.errors import InsufficientFunds
|
24
23
|
from ccxt.base.errors import InvalidOrder
|
25
24
|
from ccxt.base.errors import OrderNotFound
|
@@ -32,6 +31,7 @@ from ccxt.base.errors import RateLimitExceeded
|
|
32
31
|
from ccxt.base.errors import OnMaintenance
|
33
32
|
from ccxt.base.errors import InvalidNonce
|
34
33
|
from ccxt.base.errors import RequestTimeout
|
34
|
+
from ccxt.base.errors import BadResponse
|
35
35
|
from ccxt.base.decimal_to_precision import TRUNCATE
|
36
36
|
from ccxt.base.decimal_to_precision import TICK_SIZE
|
37
37
|
from ccxt.base.precise import Precise
|
ccxt/bingx.py
CHANGED
@@ -1919,7 +1919,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1919
1919
|
elif timeInForce == 'GTC':
|
1920
1920
|
request['timeInForce'] = 'GTC'
|
1921
1921
|
if isSpot:
|
1922
|
-
cost = self.
|
1922
|
+
cost = self.safe_string_2(params, 'cost', 'quoteOrderQty')
|
1923
1923
|
params = self.omit(params, 'cost')
|
1924
1924
|
if cost is not None:
|
1925
1925
|
request['quoteOrderQty'] = self.parse_to_numeric(self.cost_to_precision(symbol, cost))
|
@@ -2029,7 +2029,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
2029
2029
|
else:
|
2030
2030
|
positionSide = 'LONG' if (side == 'buy') else 'SHORT'
|
2031
2031
|
request['positionSide'] = positionSide
|
2032
|
-
request['quantity'] = self.parse_to_numeric(self.amount_to_precision(symbol, amount))
|
2032
|
+
request['quantity'] = amount if (market['inverse']) else self.parse_to_numeric(self.amount_to_precision(symbol, amount)) # precision not available for inverse contracts
|
2033
2033
|
params = self.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'trailingType', 'takeProfit', 'stopLoss', 'clientOrderId'])
|
2034
2034
|
return self.extend(request, params)
|
2035
2035
|
|
@@ -2038,6 +2038,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
2038
2038
|
create a trade order
|
2039
2039
|
:see: https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Trade%20order
|
2040
2040
|
:see: https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Create%20an%20Order
|
2041
|
+
:see: https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Trade%20order
|
2041
2042
|
:param str symbol: unified symbol of the market to create an order in
|
2042
2043
|
:param str type: 'market' or 'limit'
|
2043
2044
|
:param str side: 'buy' or 'sell'
|
@@ -2070,6 +2071,8 @@ class bingx(Exchange, ImplicitAPI):
|
|
2070
2071
|
if market['swap']:
|
2071
2072
|
if test:
|
2072
2073
|
response = self.swapV2PrivatePostTradeOrderTest(request)
|
2074
|
+
elif market['inverse']:
|
2075
|
+
response = self.cswapV1PrivatePostTradeOrder(request)
|
2073
2076
|
else:
|
2074
2077
|
response = self.swapV2PrivatePostTradeOrder(request)
|
2075
2078
|
else:
|
@@ -2094,7 +2097,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
2094
2097
|
# }
|
2095
2098
|
# }
|
2096
2099
|
#
|
2097
|
-
# swap
|
2100
|
+
# linear swap
|
2098
2101
|
#
|
2099
2102
|
# {
|
2100
2103
|
# "code": 0,
|
@@ -2112,15 +2115,37 @@ class bingx(Exchange, ImplicitAPI):
|
|
2112
2115
|
# }
|
2113
2116
|
# }
|
2114
2117
|
#
|
2118
|
+
# inverse swap
|
2119
|
+
#
|
2120
|
+
# {
|
2121
|
+
# "orderId": 1809841379603398656,
|
2122
|
+
# "symbol": "SOL-USD",
|
2123
|
+
# "positionSide": "LONG",
|
2124
|
+
# "side": "BUY",
|
2125
|
+
# "type": "LIMIT",
|
2126
|
+
# "price": 100,
|
2127
|
+
# "quantity": 1,
|
2128
|
+
# "stopPrice": 0,
|
2129
|
+
# "workingType": "",
|
2130
|
+
# "timeInForce": ""
|
2131
|
+
# }
|
2132
|
+
#
|
2115
2133
|
if isinstance(response, str):
|
2116
2134
|
# broken api engine : order-ids are too long numbers(i.e. 1742930526912864656)
|
2117
2135
|
# and json.loadscan not handle them in JS, so we have to use .parseJson
|
2118
2136
|
# however, when order has an attached SL/TP, their value types need extra parsing
|
2119
2137
|
response = self.fix_stringified_json_members(response)
|
2120
2138
|
response = self.parse_json(response)
|
2121
|
-
data = self.
|
2122
|
-
|
2123
|
-
|
2139
|
+
data = self.safe_dict(response, 'data', {})
|
2140
|
+
result: dict = {}
|
2141
|
+
if market['swap']:
|
2142
|
+
if market['inverse']:
|
2143
|
+
result = response
|
2144
|
+
else:
|
2145
|
+
result = self.safe_dict(data, 'order', {})
|
2146
|
+
else:
|
2147
|
+
result = data
|
2148
|
+
return self.parse_order(result, market)
|
2124
2149
|
|
2125
2150
|
def create_orders(self, orders: List[OrderRequest], params={}):
|
2126
2151
|
"""
|
@@ -2286,7 +2311,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
2286
2311
|
# }
|
2287
2312
|
#
|
2288
2313
|
#
|
2289
|
-
# swap
|
2314
|
+
# linear swap
|
2290
2315
|
# createOrder, createOrders
|
2291
2316
|
#
|
2292
2317
|
# {
|
@@ -2297,6 +2322,21 @@ class bingx(Exchange, ImplicitAPI):
|
|
2297
2322
|
# "type": "LIMIT"
|
2298
2323
|
# }
|
2299
2324
|
#
|
2325
|
+
# inverse swap createOrder
|
2326
|
+
#
|
2327
|
+
# {
|
2328
|
+
# "orderId": 1809841379603398656,
|
2329
|
+
# "symbol": "SOL-USD",
|
2330
|
+
# "positionSide": "LONG",
|
2331
|
+
# "side": "BUY",
|
2332
|
+
# "type": "LIMIT",
|
2333
|
+
# "price": 100,
|
2334
|
+
# "quantity": 1,
|
2335
|
+
# "stopPrice": 0,
|
2336
|
+
# "workingType": "",
|
2337
|
+
# "timeInForce": ""
|
2338
|
+
# }
|
2339
|
+
#
|
2300
2340
|
# fetchOrder, fetchOpenOrders, fetchClosedOrders
|
2301
2341
|
#
|
2302
2342
|
# {
|
ccxt/bitget.py
CHANGED
@@ -20,7 +20,6 @@ from ccxt.base.errors import InsufficientFunds
|
|
20
20
|
from ccxt.base.errors import InvalidAddress
|
21
21
|
from ccxt.base.errors import InvalidOrder
|
22
22
|
from ccxt.base.errors import OrderNotFound
|
23
|
-
from ccxt.base.errors import CancelPending
|
24
23
|
from ccxt.base.errors import NotSupported
|
25
24
|
from ccxt.base.errors import DDoSProtection
|
26
25
|
from ccxt.base.errors import RateLimitExceeded
|
@@ -28,6 +27,7 @@ from ccxt.base.errors import ExchangeNotAvailable
|
|
28
27
|
from ccxt.base.errors import OnMaintenance
|
29
28
|
from ccxt.base.errors import InvalidNonce
|
30
29
|
from ccxt.base.errors import RequestTimeout
|
30
|
+
from ccxt.base.errors import CancelPending
|
31
31
|
from ccxt.base.decimal_to_precision import TICK_SIZE
|
32
32
|
from ccxt.base.precise import Precise
|
33
33
|
|
ccxt/bitmart.py
CHANGED
@@ -219,6 +219,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
219
219
|
'contract/private/get-open-orders': 1.2,
|
220
220
|
'contract/private/current-plan-order': 1.2,
|
221
221
|
'contract/private/trades': 10,
|
222
|
+
'contract/private/position-risk': 10,
|
222
223
|
},
|
223
224
|
'post': {
|
224
225
|
# sub-account endpoints
|