ccxt 4.3.57__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/kucoin.py +1 -0
- ccxt/abstract/kucoinfutures.py +1 -0
- ccxt/abstract/upbit.py +3 -0
- ccxt/abstract/xt.py +1 -0
- ccxt/alpaca.py +5 -1
- ccxt/async_support/__init__.py +5 -5
- ccxt/async_support/alpaca.py +5 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/base/ws/client.py +1 -0
- ccxt/async_support/bigone.py +19 -1
- ccxt/async_support/binance.py +1 -1
- ccxt/async_support/bingx.py +116 -26
- 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/coinmate.py +28 -32
- ccxt/async_support/coinone.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 +22 -18
- ccxt/async_support/htx.py +10 -8
- ccxt/async_support/hyperliquid.py +106 -2
- ccxt/async_support/kraken.py +1 -1
- ccxt/async_support/kucoin.py +3 -0
- ccxt/async_support/latoken.py +5 -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 +3 -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/woo.py +2 -1
- ccxt/async_support/xt.py +70 -7
- ccxt/base/errors.py +23 -23
- ccxt/base/exchange.py +9 -9
- ccxt/bigone.py +19 -1
- ccxt/binance.py +1 -1
- ccxt/bingx.py +116 -26
- 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/coinmate.py +28 -32
- ccxt/coinone.py +1 -1
- ccxt/coinsph.py +1 -1
- ccxt/deribit.py +15 -1
- ccxt/digifinex.py +30 -7
- ccxt/gate.py +22 -18
- ccxt/htx.py +10 -8
- ccxt/hyperliquid.py +106 -2
- ccxt/kraken.py +1 -1
- ccxt/kucoin.py +3 -0
- ccxt/latoken.py +5 -1
- ccxt/mexc.py +11 -11
- ccxt/novadax.py +1 -1
- ccxt/okcoin.py +1 -1
- ccxt/okx.py +3 -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/htx.py +1 -1
- ccxt/pro/hyperliquid.py +1 -1
- ccxt/pro/okx.py +3 -3
- 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/woo.py +2 -1
- ccxt/xt.py +70 -7
- {ccxt-4.3.57.dist-info → ccxt-4.3.59.dist-info}/METADATA +5 -5
- {ccxt-4.3.57.dist-info → ccxt-4.3.59.dist-info}/RECORD +91 -90
- {ccxt-4.3.57.dist-info → ccxt-4.3.59.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.3.57.dist-info → ccxt-4.3.59.dist-info}/WHEEL +0 -0
- {ccxt-4.3.57.dist-info → ccxt-4.3.59.dist-info}/top_level.txt +0 -0
ccxt/__init__.py
CHANGED
@@ -22,7 +22,7 @@
|
|
22
22
|
|
23
23
|
# ----------------------------------------------------------------------------
|
24
24
|
|
25
|
-
__version__ = '4.3.
|
25
|
+
__version__ = '4.3.59'
|
26
26
|
|
27
27
|
# ----------------------------------------------------------------------------
|
28
28
|
|
@@ -54,21 +54,18 @@ from ccxt.base.errors import OperationRejected # noqa: F4
|
|
54
54
|
from ccxt.base.errors import NoChange # noqa: F401
|
55
55
|
from ccxt.base.errors import MarginModeAlreadySet # noqa: F401
|
56
56
|
from ccxt.base.errors import MarketClosed # noqa: F401
|
57
|
-
from ccxt.base.errors import BadResponse # noqa: F401
|
58
|
-
from ccxt.base.errors import NullResponse # noqa: F401
|
59
57
|
from ccxt.base.errors import InsufficientFunds # noqa: F401
|
60
58
|
from ccxt.base.errors import InvalidAddress # noqa: F401
|
61
59
|
from ccxt.base.errors import AddressPending # noqa: F401
|
62
60
|
from ccxt.base.errors import InvalidOrder # noqa: F401
|
63
61
|
from ccxt.base.errors import OrderNotFound # noqa: F401
|
64
62
|
from ccxt.base.errors import OrderNotCached # noqa: F401
|
65
|
-
from ccxt.base.errors import CancelPending # noqa: F401
|
66
63
|
from ccxt.base.errors import OrderImmediatelyFillable # noqa: F401
|
67
64
|
from ccxt.base.errors import OrderNotFillable # noqa: F401
|
68
65
|
from ccxt.base.errors import DuplicateOrderId # noqa: F401
|
69
66
|
from ccxt.base.errors import ContractUnavailable # noqa: F401
|
70
67
|
from ccxt.base.errors import NotSupported # noqa: F401
|
71
|
-
from ccxt.base.errors import
|
68
|
+
from ccxt.base.errors import InvalidProxySettings # noqa: F401
|
72
69
|
from ccxt.base.errors import ExchangeClosedByUser # noqa: F401
|
73
70
|
from ccxt.base.errors import OperationFailed # noqa: F401
|
74
71
|
from ccxt.base.errors import NetworkError # noqa: F401
|
@@ -78,6 +75,9 @@ from ccxt.base.errors import ExchangeNotAvailable # noqa: F4
|
|
78
75
|
from ccxt.base.errors import OnMaintenance # noqa: F401
|
79
76
|
from ccxt.base.errors import InvalidNonce # noqa: F401
|
80
77
|
from ccxt.base.errors import RequestTimeout # noqa: F401
|
78
|
+
from ccxt.base.errors import BadResponse # noqa: F401
|
79
|
+
from ccxt.base.errors import NullResponse # noqa: F401
|
80
|
+
from ccxt.base.errors import CancelPending # noqa: F401
|
81
81
|
from ccxt.base.errors import error_hierarchy # noqa: F401
|
82
82
|
|
83
83
|
from ccxt.ace import ace # noqa: F401
|
ccxt/abstract/bitmart.py
CHANGED
@@ -61,6 +61,7 @@ class ImplicitAPI:
|
|
61
61
|
private_get_contract_private_get_open_orders = privateGetContractPrivateGetOpenOrders = Entry('contract/private/get-open-orders', 'private', 'GET', {'cost': 1.2})
|
62
62
|
private_get_contract_private_current_plan_order = privateGetContractPrivateCurrentPlanOrder = Entry('contract/private/current-plan-order', 'private', 'GET', {'cost': 1.2})
|
63
63
|
private_get_contract_private_trades = privateGetContractPrivateTrades = Entry('contract/private/trades', 'private', 'GET', {'cost': 10})
|
64
|
+
private_get_contract_private_position_risk = privateGetContractPrivatePositionRisk = Entry('contract/private/position-risk', 'private', 'GET', {'cost': 10})
|
64
65
|
private_post_account_sub_account_main_v1_sub_to_main = privatePostAccountSubAccountMainV1SubToMain = Entry('account/sub-account/main/v1/sub-to-main', 'private', 'POST', {'cost': 30})
|
65
66
|
private_post_account_sub_account_sub_v1_sub_to_main = privatePostAccountSubAccountSubV1SubToMain = Entry('account/sub-account/sub/v1/sub-to-main', 'private', 'POST', {'cost': 30})
|
66
67
|
private_post_account_sub_account_main_v1_main_to_sub = privatePostAccountSubAccountMainV1MainToSub = Entry('account/sub-account/main/v1/main-to-sub', 'private', 'POST', {'cost': 30})
|
ccxt/abstract/btcbox.py
CHANGED
@@ -5,6 +5,7 @@ class ImplicitAPI:
|
|
5
5
|
public_get_depth = publicGetDepth = Entry('depth', 'public', 'GET', {})
|
6
6
|
public_get_orders = publicGetOrders = Entry('orders', 'public', 'GET', {})
|
7
7
|
public_get_ticker = publicGetTicker = Entry('ticker', 'public', 'GET', {})
|
8
|
+
public_get_tickers = publicGetTickers = Entry('tickers', 'public', 'GET', {})
|
8
9
|
private_post_balance = privatePostBalance = Entry('balance', 'private', 'POST', {})
|
9
10
|
private_post_trade_add = privatePostTradeAdd = Entry('trade_add', 'private', 'POST', {})
|
10
11
|
private_post_trade_cancel = privatePostTradeCancel = Entry('trade_cancel', 'private', 'POST', {})
|
ccxt/abstract/kucoin.py
CHANGED
@@ -87,6 +87,7 @@ class ImplicitAPI:
|
|
87
87
|
private_get_redeem_orders = privateGetRedeemOrders = Entry('redeem/orders', 'private', 'GET', {'cost': 10})
|
88
88
|
private_get_purchase_orders = privateGetPurchaseOrders = Entry('purchase/orders', 'private', 'GET', {'cost': 10})
|
89
89
|
private_get_broker_api_rebase_download = privateGetBrokerApiRebaseDownload = Entry('broker/api/rebase/download', 'private', 'GET', {'cost': 3})
|
90
|
+
private_get_affiliate_inviter_statistics = privateGetAffiliateInviterStatistics = Entry('affiliate/inviter/statistics', 'private', 'GET', {'cost': 30})
|
90
91
|
private_post_sub_user_created = privatePostSubUserCreated = Entry('sub/user/created', 'private', 'POST', {'cost': 22.5})
|
91
92
|
private_post_sub_api_key = privatePostSubApiKey = Entry('sub/api-key', 'private', 'POST', {'cost': 30})
|
92
93
|
private_post_sub_api_key_update = privatePostSubApiKeyUpdate = Entry('sub/api-key/update', 'private', 'POST', {'cost': 45})
|
ccxt/abstract/kucoinfutures.py
CHANGED
@@ -87,6 +87,7 @@ class ImplicitAPI:
|
|
87
87
|
private_get_redeem_orders = privateGetRedeemOrders = Entry('redeem/orders', 'private', 'GET', {'cost': 10})
|
88
88
|
private_get_purchase_orders = privateGetPurchaseOrders = Entry('purchase/orders', 'private', 'GET', {'cost': 10})
|
89
89
|
private_get_broker_api_rebase_download = privateGetBrokerApiRebaseDownload = Entry('broker/api/rebase/download', 'private', 'GET', {'cost': 3})
|
90
|
+
private_get_affiliate_inviter_statistics = privateGetAffiliateInviterStatistics = Entry('affiliate/inviter/statistics', 'private', 'GET', {'cost': 30})
|
90
91
|
private_post_sub_user_created = privatePostSubUserCreated = Entry('sub/user/created', 'private', 'POST', {'cost': 22.5})
|
91
92
|
private_post_sub_api_key = privatePostSubApiKey = Entry('sub/api-key', 'private', 'POST', {'cost': 30})
|
92
93
|
private_post_sub_api_key_update = privatePostSubApiKeyUpdate = Entry('sub/api-key/update', 'private', 'POST', {'cost': 45})
|
ccxt/abstract/upbit.py
CHANGED
@@ -24,6 +24,9 @@ class ImplicitAPI:
|
|
24
24
|
private_get_orders_chance = privateGetOrdersChance = Entry('orders/chance', 'private', 'GET', {})
|
25
25
|
private_get_order = privateGetOrder = Entry('order', 'private', 'GET', {})
|
26
26
|
private_get_orders = privateGetOrders = Entry('orders', 'private', 'GET', {})
|
27
|
+
private_get_orders_closed = privateGetOrdersClosed = Entry('orders/closed', 'private', 'GET', {})
|
28
|
+
private_get_orders_open = privateGetOrdersOpen = Entry('orders/open', 'private', 'GET', {})
|
29
|
+
private_get_orders_uuids = privateGetOrdersUuids = Entry('orders/uuids', 'private', 'GET', {})
|
27
30
|
private_get_withdraws = privateGetWithdraws = Entry('withdraws', 'private', 'GET', {})
|
28
31
|
private_get_withdraw = privateGetWithdraw = Entry('withdraw', 'private', 'GET', {})
|
29
32
|
private_get_withdraws_chance = privateGetWithdrawsChance = Entry('withdraws/chance', 'private', 'GET', {})
|
ccxt/abstract/xt.py
CHANGED
@@ -69,6 +69,7 @@ class ImplicitAPI:
|
|
69
69
|
private_spot_post_withdraw = privateSpotPostWithdraw = Entry('withdraw', ['private', 'spot'], 'POST', {'cost': 1})
|
70
70
|
private_spot_post_balance_transfer = privateSpotPostBalanceTransfer = Entry('balance/transfer', ['private', 'spot'], 'POST', {'cost': 1})
|
71
71
|
private_spot_post_balance_account_transfer = privateSpotPostBalanceAccountTransfer = Entry('balance/account/transfer', ['private', 'spot'], 'POST', {'cost': 1})
|
72
|
+
private_spot_post_ws_token = privateSpotPostWsToken = Entry('ws-token', ['private', 'spot'], 'POST', {'cost': 1})
|
72
73
|
private_spot_delete_batch_order = privateSpotDeleteBatchOrder = Entry('batch-order', ['private', 'spot'], 'DELETE', {'cost': 1})
|
73
74
|
private_spot_delete_open_order = privateSpotDeleteOpenOrder = Entry('open-order', ['private', 'spot'], 'DELETE', {'cost': 1})
|
74
75
|
private_spot_delete_order_orderid = privateSpotDeleteOrderOrderId = Entry('order/{orderId}', ['private', 'spot'], 'DELETE', {'cost': 1})
|
ccxt/alpaca.py
CHANGED
@@ -787,7 +787,11 @@ class alpaca(Exchange, ImplicitAPI):
|
|
787
787
|
if isinstance(response, list):
|
788
788
|
return self.parse_orders(response, None)
|
789
789
|
else:
|
790
|
-
return
|
790
|
+
return [
|
791
|
+
self.safe_order({
|
792
|
+
'info': response,
|
793
|
+
}),
|
794
|
+
]
|
791
795
|
|
792
796
|
def fetch_order(self, id: str, symbol: Str = None, params={}):
|
793
797
|
"""
|
ccxt/async_support/__init__.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
|
|
@@ -33,21 +33,18 @@ from ccxt.base.errors import OperationRejected # noqa: F4
|
|
33
33
|
from ccxt.base.errors import NoChange # noqa: F401
|
34
34
|
from ccxt.base.errors import MarginModeAlreadySet # noqa: F401
|
35
35
|
from ccxt.base.errors import MarketClosed # noqa: F401
|
36
|
-
from ccxt.base.errors import BadResponse # noqa: F401
|
37
|
-
from ccxt.base.errors import NullResponse # noqa: F401
|
38
36
|
from ccxt.base.errors import InsufficientFunds # noqa: F401
|
39
37
|
from ccxt.base.errors import InvalidAddress # noqa: F401
|
40
38
|
from ccxt.base.errors import AddressPending # noqa: F401
|
41
39
|
from ccxt.base.errors import InvalidOrder # noqa: F401
|
42
40
|
from ccxt.base.errors import OrderNotFound # noqa: F401
|
43
41
|
from ccxt.base.errors import OrderNotCached # noqa: F401
|
44
|
-
from ccxt.base.errors import CancelPending # noqa: F401
|
45
42
|
from ccxt.base.errors import OrderImmediatelyFillable # noqa: F401
|
46
43
|
from ccxt.base.errors import OrderNotFillable # noqa: F401
|
47
44
|
from ccxt.base.errors import DuplicateOrderId # noqa: F401
|
48
45
|
from ccxt.base.errors import ContractUnavailable # noqa: F401
|
49
46
|
from ccxt.base.errors import NotSupported # noqa: F401
|
50
|
-
from ccxt.base.errors import
|
47
|
+
from ccxt.base.errors import InvalidProxySettings # noqa: F401
|
51
48
|
from ccxt.base.errors import ExchangeClosedByUser # noqa: F401
|
52
49
|
from ccxt.base.errors import OperationFailed # noqa: F401
|
53
50
|
from ccxt.base.errors import NetworkError # noqa: F401
|
@@ -57,6 +54,9 @@ from ccxt.base.errors import ExchangeNotAvailable # noqa: F4
|
|
57
54
|
from ccxt.base.errors import OnMaintenance # noqa: F401
|
58
55
|
from ccxt.base.errors import InvalidNonce # noqa: F401
|
59
56
|
from ccxt.base.errors import RequestTimeout # noqa: F401
|
57
|
+
from ccxt.base.errors import BadResponse # noqa: F401
|
58
|
+
from ccxt.base.errors import NullResponse # noqa: F401
|
59
|
+
from ccxt.base.errors import CancelPending # noqa: F401
|
60
60
|
from ccxt.base.errors import error_hierarchy # noqa: F401
|
61
61
|
|
62
62
|
|
ccxt/async_support/alpaca.py
CHANGED
@@ -787,7 +787,11 @@ class alpaca(Exchange, ImplicitAPI):
|
|
787
787
|
if isinstance(response, list):
|
788
788
|
return self.parse_orders(response, None)
|
789
789
|
else:
|
790
|
-
return
|
790
|
+
return [
|
791
|
+
self.safe_order({
|
792
|
+
'info': response,
|
793
|
+
}),
|
794
|
+
]
|
791
795
|
|
792
796
|
async def fetch_order(self, id: str, symbol: Str = None, params={}):
|
793
797
|
"""
|
ccxt/async_support/bigone.py
CHANGED
@@ -1540,7 +1540,25 @@ class bigone(Exchange, ImplicitAPI):
|
|
1540
1540
|
# }
|
1541
1541
|
# }
|
1542
1542
|
#
|
1543
|
-
|
1543
|
+
data = self.safe_dict(response, 'data', {})
|
1544
|
+
cancelled = self.safe_list(data, 'cancelled', [])
|
1545
|
+
failed = self.safe_list(data, 'failed', [])
|
1546
|
+
result = []
|
1547
|
+
for i in range(0, len(cancelled)):
|
1548
|
+
orderId = cancelled[i]
|
1549
|
+
result.append(self.safe_order({
|
1550
|
+
'info': orderId,
|
1551
|
+
'id': orderId,
|
1552
|
+
'status': 'canceled',
|
1553
|
+
}))
|
1554
|
+
for i in range(0, len(failed)):
|
1555
|
+
orderId = failed[i]
|
1556
|
+
result.append(self.safe_order({
|
1557
|
+
'info': orderId,
|
1558
|
+
'id': orderId,
|
1559
|
+
'status': 'failed',
|
1560
|
+
}))
|
1561
|
+
return result
|
1544
1562
|
|
1545
1563
|
async def fetch_order(self, id: str, symbol: Str = None, params={}):
|
1546
1564
|
"""
|
ccxt/async_support/binance.py
CHANGED
@@ -20,7 +20,6 @@ from ccxt.base.errors import BadSymbol
|
|
20
20
|
from ccxt.base.errors import OperationRejected
|
21
21
|
from ccxt.base.errors import MarginModeAlreadySet
|
22
22
|
from ccxt.base.errors import MarketClosed
|
23
|
-
from ccxt.base.errors import BadResponse
|
24
23
|
from ccxt.base.errors import InsufficientFunds
|
25
24
|
from ccxt.base.errors import InvalidOrder
|
26
25
|
from ccxt.base.errors import OrderNotFound
|
@@ -33,6 +32,7 @@ from ccxt.base.errors import RateLimitExceeded
|
|
33
32
|
from ccxt.base.errors import OnMaintenance
|
34
33
|
from ccxt.base.errors import InvalidNonce
|
35
34
|
from ccxt.base.errors import RequestTimeout
|
35
|
+
from ccxt.base.errors import BadResponse
|
36
36
|
from ccxt.base.decimal_to_precision import TRUNCATE
|
37
37
|
from ccxt.base.decimal_to_precision import TICK_SIZE
|
38
38
|
from ccxt.base.precise import Precise
|
ccxt/async_support/bingx.py
CHANGED
@@ -816,13 +816,14 @@ class bingx(Exchange, ImplicitAPI):
|
|
816
816
|
:see: https://bingx-api.github.io/docs/#/spot/market-api.html#Candlestick%20chart%20data
|
817
817
|
:see: https://bingx-api.github.io/docs/#/swapV2/market-api.html#%20K-Line%20Data
|
818
818
|
:see: https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#K-Line%20Data%20-%20Mark%20Price
|
819
|
+
:see: https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Get%20K-line%20Data
|
819
820
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
820
821
|
:param str timeframe: the length of time each candle represents
|
821
822
|
:param int [since]: timestamp in ms of the earliest candle to fetch
|
822
823
|
:param int [limit]: the maximum amount of candles to fetch
|
823
824
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
824
825
|
:param int [params.until]: timestamp in ms of the latest candle to fetch
|
825
|
-
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [
|
826
|
+
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
826
827
|
:returns int[][]: A list of candles ordered, open, high, low, close, volume
|
827
828
|
"""
|
828
829
|
await self.load_markets()
|
@@ -847,12 +848,15 @@ class bingx(Exchange, ImplicitAPI):
|
|
847
848
|
if market['spot']:
|
848
849
|
response = await self.spotV1PublicGetMarketKline(self.extend(request, params))
|
849
850
|
else:
|
850
|
-
|
851
|
-
|
852
|
-
if price == 'mark':
|
853
|
-
response = await self.swapV1PrivateGetMarketMarkPriceKlines(self.extend(request, params))
|
851
|
+
if market['inverse']:
|
852
|
+
response = await self.cswapV1PublicGetMarketKlines(self.extend(request, params))
|
854
853
|
else:
|
855
|
-
|
854
|
+
price = self.safe_string(params, 'price')
|
855
|
+
params = self.omit(params, 'price')
|
856
|
+
if price == 'mark':
|
857
|
+
response = await self.swapV1PrivateGetMarketMarkPriceKlines(self.extend(request, params))
|
858
|
+
else:
|
859
|
+
response = await self.swapV3PublicGetQuoteKlines(self.extend(request, params))
|
856
860
|
#
|
857
861
|
# {
|
858
862
|
# "code": 0,
|
@@ -1145,6 +1149,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1145
1149
|
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
1146
1150
|
:see: https://bingx-api.github.io/docs/#/spot/market-api.html#Query%20depth%20information
|
1147
1151
|
:see: https://bingx-api.github.io/docs/#/swapV2/market-api.html#Get%20Market%20Depth
|
1152
|
+
:see: https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Query%20Depth%20Data
|
1148
1153
|
:param str symbol: unified symbol of the market to fetch the order book for
|
1149
1154
|
:param int [limit]: the maximum amount of order book entries to return
|
1150
1155
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -1163,7 +1168,10 @@ class bingx(Exchange, ImplicitAPI):
|
|
1163
1168
|
if marketType == 'spot':
|
1164
1169
|
response = await self.spotV1PublicGetMarketDepth(self.extend(request, params))
|
1165
1170
|
else:
|
1166
|
-
|
1171
|
+
if market['inverse']:
|
1172
|
+
response = await self.cswapV1PublicGetMarketDepth(self.extend(request, params))
|
1173
|
+
else:
|
1174
|
+
response = await self.swapV2PublicGetQuoteDepth(self.extend(request, params))
|
1167
1175
|
#
|
1168
1176
|
# spot
|
1169
1177
|
#
|
@@ -1229,6 +1237,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1229
1237
|
"""
|
1230
1238
|
fetch the current funding rate
|
1231
1239
|
:see: https://bingx-api.github.io/docs/#/swapV2/market-api.html#Current%20Funding%20Rate
|
1240
|
+
:see: https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Price%20&%20Current%20Funding%20Rate
|
1232
1241
|
:param str symbol: unified market symbol
|
1233
1242
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1234
1243
|
:returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
@@ -1238,7 +1247,11 @@ class bingx(Exchange, ImplicitAPI):
|
|
1238
1247
|
request: dict = {
|
1239
1248
|
'symbol': market['id'],
|
1240
1249
|
}
|
1241
|
-
response =
|
1250
|
+
response = None
|
1251
|
+
if market['inverse']:
|
1252
|
+
response = await self.cswapV1PublicGetMarketPremiumIndex(self.extend(request, params))
|
1253
|
+
else:
|
1254
|
+
response = await self.swapV2PublicGetQuotePremiumIndex(self.extend(request, params))
|
1242
1255
|
#
|
1243
1256
|
# {
|
1244
1257
|
# "code":0,
|
@@ -1376,9 +1389,10 @@ class bingx(Exchange, ImplicitAPI):
|
|
1376
1389
|
|
1377
1390
|
async def fetch_open_interest(self, symbol: str, params={}):
|
1378
1391
|
"""
|
1379
|
-
|
1392
|
+
retrieves the open interest of a trading pair
|
1380
1393
|
:see: https://bingx-api.github.io/docs/#/swapV2/market-api.html#Get%20Swap%20Open%20Positions
|
1381
|
-
:
|
1394
|
+
:see: https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Get%20Swap%20Open%20Positions
|
1395
|
+
:param str symbol: unified CCXT market symbol
|
1382
1396
|
:param dict [params]: exchange specific parameters
|
1383
1397
|
:returns dict} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure:
|
1384
1398
|
"""
|
@@ -1387,7 +1401,13 @@ class bingx(Exchange, ImplicitAPI):
|
|
1387
1401
|
request: dict = {
|
1388
1402
|
'symbol': market['id'],
|
1389
1403
|
}
|
1390
|
-
response =
|
1404
|
+
response = None
|
1405
|
+
if market['inverse']:
|
1406
|
+
response = await self.cswapV1PublicGetMarketOpenInterest(self.extend(request, params))
|
1407
|
+
else:
|
1408
|
+
response = await self.swapV2PublicGetQuoteOpenInterest(self.extend(request, params))
|
1409
|
+
#
|
1410
|
+
# linear swap
|
1391
1411
|
#
|
1392
1412
|
# {
|
1393
1413
|
# "code": 0,
|
@@ -1399,18 +1419,48 @@ class bingx(Exchange, ImplicitAPI):
|
|
1399
1419
|
# }
|
1400
1420
|
# }
|
1401
1421
|
#
|
1402
|
-
|
1403
|
-
|
1422
|
+
# inverse swap
|
1423
|
+
#
|
1424
|
+
# {
|
1425
|
+
# "code": 0,
|
1426
|
+
# "msg": "",
|
1427
|
+
# "timestamp": 1720328247986,
|
1428
|
+
# "data": [
|
1429
|
+
# {
|
1430
|
+
# "symbol": "BTC-USD",
|
1431
|
+
# "openInterest": "749.1160",
|
1432
|
+
# "timestamp": 1720310400000
|
1433
|
+
# }
|
1434
|
+
# ]
|
1435
|
+
# }
|
1436
|
+
#
|
1437
|
+
result: dict = {}
|
1438
|
+
if market['inverse']:
|
1439
|
+
data = self.safe_list(response, 'data', [])
|
1440
|
+
result = self.safe_dict(data, 0, {})
|
1441
|
+
else:
|
1442
|
+
result = self.safe_dict(response, 'data', {})
|
1443
|
+
return self.parse_open_interest(result, market)
|
1404
1444
|
|
1405
1445
|
def parse_open_interest(self, interest, market: Market = None):
|
1406
1446
|
#
|
1407
|
-
#
|
1408
|
-
#
|
1409
|
-
#
|
1410
|
-
#
|
1411
|
-
#
|
1447
|
+
# linear swap
|
1448
|
+
#
|
1449
|
+
# {
|
1450
|
+
# "openInterest": "3289641547.10",
|
1451
|
+
# "symbol": "BTC-USDT",
|
1452
|
+
# "time": 1672026617364
|
1453
|
+
# }
|
1454
|
+
#
|
1455
|
+
# inverse swap
|
1456
|
+
#
|
1457
|
+
# {
|
1458
|
+
# "symbol": "BTC-USD",
|
1459
|
+
# "openInterest": "749.1160",
|
1460
|
+
# "timestamp": 1720310400000
|
1461
|
+
# }
|
1412
1462
|
#
|
1413
|
-
timestamp = self.
|
1463
|
+
timestamp = self.safe_integer_2(interest, 'time', 'timestamp')
|
1414
1464
|
id = self.safe_string(interest, 'symbol')
|
1415
1465
|
symbol = self.safe_symbol(id, market, '-', 'swap')
|
1416
1466
|
openInterest = self.safe_number(interest, 'openInterest')
|
@@ -1870,7 +1920,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1870
1920
|
elif timeInForce == 'GTC':
|
1871
1921
|
request['timeInForce'] = 'GTC'
|
1872
1922
|
if isSpot:
|
1873
|
-
cost = self.
|
1923
|
+
cost = self.safe_string_2(params, 'cost', 'quoteOrderQty')
|
1874
1924
|
params = self.omit(params, 'cost')
|
1875
1925
|
if cost is not None:
|
1876
1926
|
request['quoteOrderQty'] = self.parse_to_numeric(self.cost_to_precision(symbol, cost))
|
@@ -1980,7 +2030,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1980
2030
|
else:
|
1981
2031
|
positionSide = 'LONG' if (side == 'buy') else 'SHORT'
|
1982
2032
|
request['positionSide'] = positionSide
|
1983
|
-
request['quantity'] = self.parse_to_numeric(self.amount_to_precision(symbol, amount))
|
2033
|
+
request['quantity'] = amount if (market['inverse']) else self.parse_to_numeric(self.amount_to_precision(symbol, amount)) # precision not available for inverse contracts
|
1984
2034
|
params = self.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'trailingType', 'takeProfit', 'stopLoss', 'clientOrderId'])
|
1985
2035
|
return self.extend(request, params)
|
1986
2036
|
|
@@ -1989,6 +2039,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1989
2039
|
create a trade order
|
1990
2040
|
:see: https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Trade%20order
|
1991
2041
|
:see: https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Create%20an%20Order
|
2042
|
+
:see: https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Trade%20order
|
1992
2043
|
:param str symbol: unified symbol of the market to create an order in
|
1993
2044
|
:param str type: 'market' or 'limit'
|
1994
2045
|
:param str side: 'buy' or 'sell'
|
@@ -2021,6 +2072,8 @@ class bingx(Exchange, ImplicitAPI):
|
|
2021
2072
|
if market['swap']:
|
2022
2073
|
if test:
|
2023
2074
|
response = await self.swapV2PrivatePostTradeOrderTest(request)
|
2075
|
+
elif market['inverse']:
|
2076
|
+
response = await self.cswapV1PrivatePostTradeOrder(request)
|
2024
2077
|
else:
|
2025
2078
|
response = await self.swapV2PrivatePostTradeOrder(request)
|
2026
2079
|
else:
|
@@ -2045,7 +2098,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
2045
2098
|
# }
|
2046
2099
|
# }
|
2047
2100
|
#
|
2048
|
-
# swap
|
2101
|
+
# linear swap
|
2049
2102
|
#
|
2050
2103
|
# {
|
2051
2104
|
# "code": 0,
|
@@ -2063,15 +2116,37 @@ class bingx(Exchange, ImplicitAPI):
|
|
2063
2116
|
# }
|
2064
2117
|
# }
|
2065
2118
|
#
|
2119
|
+
# inverse swap
|
2120
|
+
#
|
2121
|
+
# {
|
2122
|
+
# "orderId": 1809841379603398656,
|
2123
|
+
# "symbol": "SOL-USD",
|
2124
|
+
# "positionSide": "LONG",
|
2125
|
+
# "side": "BUY",
|
2126
|
+
# "type": "LIMIT",
|
2127
|
+
# "price": 100,
|
2128
|
+
# "quantity": 1,
|
2129
|
+
# "stopPrice": 0,
|
2130
|
+
# "workingType": "",
|
2131
|
+
# "timeInForce": ""
|
2132
|
+
# }
|
2133
|
+
#
|
2066
2134
|
if isinstance(response, str):
|
2067
2135
|
# broken api engine : order-ids are too long numbers(i.e. 1742930526912864656)
|
2068
2136
|
# and json.loadscan not handle them in JS, so we have to use .parseJson
|
2069
2137
|
# however, when order has an attached SL/TP, their value types need extra parsing
|
2070
2138
|
response = self.fix_stringified_json_members(response)
|
2071
2139
|
response = self.parse_json(response)
|
2072
|
-
data = self.
|
2073
|
-
|
2074
|
-
|
2140
|
+
data = self.safe_dict(response, 'data', {})
|
2141
|
+
result: dict = {}
|
2142
|
+
if market['swap']:
|
2143
|
+
if market['inverse']:
|
2144
|
+
result = response
|
2145
|
+
else:
|
2146
|
+
result = self.safe_dict(data, 'order', {})
|
2147
|
+
else:
|
2148
|
+
result = data
|
2149
|
+
return self.parse_order(result, market)
|
2075
2150
|
|
2076
2151
|
async def create_orders(self, orders: List[OrderRequest], params={}):
|
2077
2152
|
"""
|
@@ -2237,7 +2312,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
2237
2312
|
# }
|
2238
2313
|
#
|
2239
2314
|
#
|
2240
|
-
# swap
|
2315
|
+
# linear swap
|
2241
2316
|
# createOrder, createOrders
|
2242
2317
|
#
|
2243
2318
|
# {
|
@@ -2248,6 +2323,21 @@ class bingx(Exchange, ImplicitAPI):
|
|
2248
2323
|
# "type": "LIMIT"
|
2249
2324
|
# }
|
2250
2325
|
#
|
2326
|
+
# inverse swap createOrder
|
2327
|
+
#
|
2328
|
+
# {
|
2329
|
+
# "orderId": 1809841379603398656,
|
2330
|
+
# "symbol": "SOL-USD",
|
2331
|
+
# "positionSide": "LONG",
|
2332
|
+
# "side": "BUY",
|
2333
|
+
# "type": "LIMIT",
|
2334
|
+
# "price": 100,
|
2335
|
+
# "quantity": 1,
|
2336
|
+
# "stopPrice": 0,
|
2337
|
+
# "workingType": "",
|
2338
|
+
# "timeInForce": ""
|
2339
|
+
# }
|
2340
|
+
#
|
2251
2341
|
# fetchOrder, fetchOpenOrders, fetchClosedOrders
|
2252
2342
|
#
|
2253
2343
|
# {
|
ccxt/async_support/bitget.py
CHANGED
@@ -21,7 +21,6 @@ from ccxt.base.errors import InsufficientFunds
|
|
21
21
|
from ccxt.base.errors import InvalidAddress
|
22
22
|
from ccxt.base.errors import InvalidOrder
|
23
23
|
from ccxt.base.errors import OrderNotFound
|
24
|
-
from ccxt.base.errors import CancelPending
|
25
24
|
from ccxt.base.errors import NotSupported
|
26
25
|
from ccxt.base.errors import DDoSProtection
|
27
26
|
from ccxt.base.errors import RateLimitExceeded
|
@@ -29,6 +28,7 @@ from ccxt.base.errors import ExchangeNotAvailable
|
|
29
28
|
from ccxt.base.errors import OnMaintenance
|
30
29
|
from ccxt.base.errors import InvalidNonce
|
31
30
|
from ccxt.base.errors import RequestTimeout
|
31
|
+
from ccxt.base.errors import CancelPending
|
32
32
|
from ccxt.base.decimal_to_precision import TICK_SIZE
|
33
33
|
from ccxt.base.precise import Precise
|
34
34
|
|
ccxt/async_support/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
|