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/__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/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/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/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
@@ -1920,7 +1920,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1920
1920
|
elif timeInForce == 'GTC':
|
1921
1921
|
request['timeInForce'] = 'GTC'
|
1922
1922
|
if isSpot:
|
1923
|
-
cost = self.
|
1923
|
+
cost = self.safe_string_2(params, 'cost', 'quoteOrderQty')
|
1924
1924
|
params = self.omit(params, 'cost')
|
1925
1925
|
if cost is not None:
|
1926
1926
|
request['quoteOrderQty'] = self.parse_to_numeric(self.cost_to_precision(symbol, cost))
|
@@ -2030,7 +2030,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
2030
2030
|
else:
|
2031
2031
|
positionSide = 'LONG' if (side == 'buy') else 'SHORT'
|
2032
2032
|
request['positionSide'] = positionSide
|
2033
|
-
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
|
2034
2034
|
params = self.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'trailingType', 'takeProfit', 'stopLoss', 'clientOrderId'])
|
2035
2035
|
return self.extend(request, params)
|
2036
2036
|
|
@@ -2039,6 +2039,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
2039
2039
|
create a trade order
|
2040
2040
|
:see: https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Trade%20order
|
2041
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
|
2042
2043
|
:param str symbol: unified symbol of the market to create an order in
|
2043
2044
|
:param str type: 'market' or 'limit'
|
2044
2045
|
:param str side: 'buy' or 'sell'
|
@@ -2071,6 +2072,8 @@ class bingx(Exchange, ImplicitAPI):
|
|
2071
2072
|
if market['swap']:
|
2072
2073
|
if test:
|
2073
2074
|
response = await self.swapV2PrivatePostTradeOrderTest(request)
|
2075
|
+
elif market['inverse']:
|
2076
|
+
response = await self.cswapV1PrivatePostTradeOrder(request)
|
2074
2077
|
else:
|
2075
2078
|
response = await self.swapV2PrivatePostTradeOrder(request)
|
2076
2079
|
else:
|
@@ -2095,7 +2098,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
2095
2098
|
# }
|
2096
2099
|
# }
|
2097
2100
|
#
|
2098
|
-
# swap
|
2101
|
+
# linear swap
|
2099
2102
|
#
|
2100
2103
|
# {
|
2101
2104
|
# "code": 0,
|
@@ -2113,15 +2116,37 @@ class bingx(Exchange, ImplicitAPI):
|
|
2113
2116
|
# }
|
2114
2117
|
# }
|
2115
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
|
+
#
|
2116
2134
|
if isinstance(response, str):
|
2117
2135
|
# broken api engine : order-ids are too long numbers(i.e. 1742930526912864656)
|
2118
2136
|
# and json.loadscan not handle them in JS, so we have to use .parseJson
|
2119
2137
|
# however, when order has an attached SL/TP, their value types need extra parsing
|
2120
2138
|
response = self.fix_stringified_json_members(response)
|
2121
2139
|
response = self.parse_json(response)
|
2122
|
-
data = self.
|
2123
|
-
|
2124
|
-
|
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)
|
2125
2150
|
|
2126
2151
|
async def create_orders(self, orders: List[OrderRequest], params={}):
|
2127
2152
|
"""
|
@@ -2287,7 +2312,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
2287
2312
|
# }
|
2288
2313
|
#
|
2289
2314
|
#
|
2290
|
-
# swap
|
2315
|
+
# linear swap
|
2291
2316
|
# createOrder, createOrders
|
2292
2317
|
#
|
2293
2318
|
# {
|
@@ -2298,6 +2323,21 @@ class bingx(Exchange, ImplicitAPI):
|
|
2298
2323
|
# "type": "LIMIT"
|
2299
2324
|
# }
|
2300
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
|
+
#
|
2301
2341
|
# fetchOrder, fetchOpenOrders, fetchClosedOrders
|
2302
2342
|
#
|
2303
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
|
ccxt/async_support/btcbox.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.btcbox import ImplicitAPI
|
8
8
|
import hashlib
|
9
9
|
import json
|
10
|
-
from ccxt.base.types import Balances, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade
|
10
|
+
from ccxt.base.types import Balances, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import AuthenticationError
|
@@ -73,7 +73,7 @@ class btcbox(Exchange, ImplicitAPI):
|
|
73
73
|
'fetchPositionsRisk': False,
|
74
74
|
'fetchPremiumIndexOHLCV': False,
|
75
75
|
'fetchTicker': True,
|
76
|
-
'fetchTickers':
|
76
|
+
'fetchTickers': True,
|
77
77
|
'fetchTrades': True,
|
78
78
|
'fetchTransfer': False,
|
79
79
|
'fetchTransfers': False,
|
@@ -102,6 +102,7 @@ class btcbox(Exchange, ImplicitAPI):
|
|
102
102
|
'depth',
|
103
103
|
'orders',
|
104
104
|
'ticker',
|
105
|
+
'tickers',
|
105
106
|
],
|
106
107
|
},
|
107
108
|
'private': {
|
@@ -115,12 +116,6 @@ class btcbox(Exchange, ImplicitAPI):
|
|
115
116
|
],
|
116
117
|
},
|
117
118
|
},
|
118
|
-
'markets': {
|
119
|
-
'BTC/JPY': self.safe_market_structure({'id': 'btc', 'symbol': 'BTC/JPY', 'base': 'BTC', 'quote': 'JPY', 'baseId': 'btc', 'quoteId': 'jpy', 'taker': self.parse_number('0.0005'), 'maker': self.parse_number('0.0005'), 'type': 'spot', 'spot': True}),
|
120
|
-
'ETH/JPY': self.safe_market_structure({'id': 'eth', 'symbol': 'ETH/JPY', 'base': 'ETH', 'quote': 'JPY', 'baseId': 'eth', 'quoteId': 'jpy', 'taker': self.parse_number('0.0010'), 'maker': self.parse_number('0.0010'), 'type': 'spot', 'spot': True}),
|
121
|
-
'LTC/JPY': self.safe_market_structure({'id': 'ltc', 'symbol': 'LTC/JPY', 'base': 'LTC', 'quote': 'JPY', 'baseId': 'ltc', 'quoteId': 'jpy', 'taker': self.parse_number('0.0010'), 'maker': self.parse_number('0.0010'), 'type': 'spot', 'spot': True}),
|
122
|
-
'BCH/JPY': self.safe_market_structure({'id': 'bch', 'symbol': 'BCH/JPY', 'base': 'BCH', 'quote': 'JPY', 'baseId': 'bch', 'quoteId': 'jpy', 'taker': self.parse_number('0.0010'), 'maker': self.parse_number('0.0010'), 'type': 'spot', 'spot': True}),
|
123
|
-
},
|
124
119
|
'precisionMode': TICK_SIZE,
|
125
120
|
'exceptions': {
|
126
121
|
'104': AuthenticationError,
|
@@ -136,6 +131,137 @@ class btcbox(Exchange, ImplicitAPI):
|
|
136
131
|
},
|
137
132
|
})
|
138
133
|
|
134
|
+
async def fetch_markets(self, params={}) -> List[Market]:
|
135
|
+
"""
|
136
|
+
retrieves data on all markets for ace
|
137
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
138
|
+
:returns dict[]: an array of objects representing market data
|
139
|
+
"""
|
140
|
+
response = await self.publicGetTickers()
|
141
|
+
#
|
142
|
+
marketIds = list(response.keys())
|
143
|
+
markets = []
|
144
|
+
for i in range(0, len(marketIds)):
|
145
|
+
marketId = marketIds[i]
|
146
|
+
symbolParts = marketId.split('_')
|
147
|
+
baseCurr = self.safe_string(symbolParts, 0)
|
148
|
+
quote = self.safe_string(symbolParts, 1)
|
149
|
+
quoteId = quote.lower()
|
150
|
+
id = baseCurr.lower()
|
151
|
+
res = response[marketId]
|
152
|
+
symbol = baseCurr + '/' + quote
|
153
|
+
fee = self.parse_number('0.0005') if (id == 'BTC') else self.parse_number('0.0010')
|
154
|
+
markets.append(self.safe_market_structure({
|
155
|
+
'id': id,
|
156
|
+
'uppercaseId': None,
|
157
|
+
'symbol': symbol,
|
158
|
+
'base': baseCurr,
|
159
|
+
'baseId': id,
|
160
|
+
'quote': quote,
|
161
|
+
'quoteId': quoteId,
|
162
|
+
'settle': None,
|
163
|
+
'settleId': None,
|
164
|
+
'type': 'spot',
|
165
|
+
'spot': True,
|
166
|
+
'margin': False,
|
167
|
+
'swap': False,
|
168
|
+
'future': False,
|
169
|
+
'option': False,
|
170
|
+
'taker': fee,
|
171
|
+
'maker': fee,
|
172
|
+
'contract': False,
|
173
|
+
'linear': None,
|
174
|
+
'inverse': None,
|
175
|
+
'contractSize': None,
|
176
|
+
'expiry': None,
|
177
|
+
'expiryDatetime': None,
|
178
|
+
'strike': None,
|
179
|
+
'optionType': None,
|
180
|
+
'limits': {
|
181
|
+
'amount': {
|
182
|
+
'min': None,
|
183
|
+
'max': None,
|
184
|
+
},
|
185
|
+
'price': {
|
186
|
+
'min': None,
|
187
|
+
'max': None,
|
188
|
+
},
|
189
|
+
'cost': {
|
190
|
+
'min': None,
|
191
|
+
'max': None,
|
192
|
+
},
|
193
|
+
'leverage': {
|
194
|
+
'min': None,
|
195
|
+
'max': None,
|
196
|
+
},
|
197
|
+
},
|
198
|
+
'precision': {
|
199
|
+
'price': None,
|
200
|
+
'amount': None,
|
201
|
+
},
|
202
|
+
'active': None,
|
203
|
+
'created': None,
|
204
|
+
'info': res,
|
205
|
+
}))
|
206
|
+
return markets
|
207
|
+
|
208
|
+
def parse_market(self, market: dict) -> Market:
|
209
|
+
baseId = self.safe_string(market, 'base')
|
210
|
+
base = self.safe_currency_code(baseId)
|
211
|
+
quoteId = self.safe_string(market, 'quote')
|
212
|
+
quote = self.safe_currency_code(quoteId)
|
213
|
+
symbol = base + '/' + quote
|
214
|
+
return {
|
215
|
+
'id': self.safe_string(market, 'symbol'),
|
216
|
+
'uppercaseId': None,
|
217
|
+
'symbol': symbol,
|
218
|
+
'base': base,
|
219
|
+
'baseId': baseId,
|
220
|
+
'quote': quote,
|
221
|
+
'quoteId': quoteId,
|
222
|
+
'settle': None,
|
223
|
+
'settleId': None,
|
224
|
+
'type': 'spot',
|
225
|
+
'spot': True,
|
226
|
+
'margin': False,
|
227
|
+
'swap': False,
|
228
|
+
'future': False,
|
229
|
+
'option': False,
|
230
|
+
'contract': False,
|
231
|
+
'linear': None,
|
232
|
+
'inverse': None,
|
233
|
+
'contractSize': None,
|
234
|
+
'expiry': None,
|
235
|
+
'expiryDatetime': None,
|
236
|
+
'strike': None,
|
237
|
+
'optionType': None,
|
238
|
+
'limits': {
|
239
|
+
'amount': {
|
240
|
+
'min': self.safe_number(market, 'minLimitBaseAmount'),
|
241
|
+
'max': self.safe_number(market, 'maxLimitBaseAmount'),
|
242
|
+
},
|
243
|
+
'price': {
|
244
|
+
'min': None,
|
245
|
+
'max': None,
|
246
|
+
},
|
247
|
+
'cost': {
|
248
|
+
'min': None,
|
249
|
+
'max': None,
|
250
|
+
},
|
251
|
+
'leverage': {
|
252
|
+
'min': None,
|
253
|
+
'max': None,
|
254
|
+
},
|
255
|
+
},
|
256
|
+
'precision': {
|
257
|
+
'price': self.parse_number(self.parse_precision(self.safe_string(market, 'quotePrecision'))),
|
258
|
+
'amount': self.parse_number(self.parse_precision(self.safe_string(market, 'basePrecision'))),
|
259
|
+
},
|
260
|
+
'active': None,
|
261
|
+
'created': None,
|
262
|
+
'info': market,
|
263
|
+
}
|
264
|
+
|
139
265
|
def parse_balance(self, response) -> Balances:
|
140
266
|
result: dict = {'info': response}
|
141
267
|
codes = list(self.currencies.keys())
|
@@ -224,6 +350,17 @@ class btcbox(Exchange, ImplicitAPI):
|
|
224
350
|
response = await self.publicGetTicker(self.extend(request, params))
|
225
351
|
return self.parse_ticker(response, market)
|
226
352
|
|
353
|
+
async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
354
|
+
"""
|
355
|
+
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
356
|
+
:param str[] [symbols]: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
357
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
358
|
+
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
359
|
+
"""
|
360
|
+
await self.load_markets()
|
361
|
+
response = await self.publicGetTickers(params)
|
362
|
+
return self.parse_tickers(response, symbols)
|
363
|
+
|
227
364
|
def parse_trade(self, trade: dict, market: Market = None) -> Trade:
|
228
365
|
#
|
229
366
|
# fetchTrades(public)
|
ccxt/async_support/bybit.py
CHANGED
@@ -3188,13 +3188,13 @@ class bybit(Exchange, ImplicitAPI):
|
|
3188
3188
|
if code is not None:
|
3189
3189
|
if code != '0':
|
3190
3190
|
category = self.safe_string(order, 'category')
|
3191
|
-
|
3191
|
+
inferredMarketType = 'spot' if (category == 'spot') else 'contract'
|
3192
3192
|
return self.safe_order({
|
3193
3193
|
'info': order,
|
3194
3194
|
'status': 'rejected',
|
3195
3195
|
'id': self.safe_string(order, 'orderId'),
|
3196
3196
|
'clientOrderId': self.safe_string(order, 'orderLinkId'),
|
3197
|
-
'symbol': self.safe_symbol(self.safe_string(order, 'symbol'), None, None,
|
3197
|
+
'symbol': self.safe_symbol(self.safe_string(order, 'symbol'), None, None, inferredMarketType),
|
3198
3198
|
})
|
3199
3199
|
marketId = self.safe_string(order, 'symbol')
|
3200
3200
|
isContract = ('tpslMode' in order)
|
ccxt/async_support/cex.py
CHANGED
@@ -13,13 +13,13 @@ from ccxt.base.errors import ExchangeError
|
|
13
13
|
from ccxt.base.errors import AuthenticationError
|
14
14
|
from ccxt.base.errors import ArgumentsRequired
|
15
15
|
from ccxt.base.errors import BadSymbol
|
16
|
-
from ccxt.base.errors import NullResponse
|
17
16
|
from ccxt.base.errors import InsufficientFunds
|
18
17
|
from ccxt.base.errors import InvalidOrder
|
19
18
|
from ccxt.base.errors import OrderNotFound
|
20
19
|
from ccxt.base.errors import DDoSProtection
|
21
20
|
from ccxt.base.errors import RateLimitExceeded
|
22
21
|
from ccxt.base.errors import InvalidNonce
|
22
|
+
from ccxt.base.errors import NullResponse
|
23
23
|
from ccxt.base.decimal_to_precision import TICK_SIZE
|
24
24
|
from ccxt.base.precise import Precise
|
25
25
|
|
ccxt/async_support/coinsph.py
CHANGED
@@ -14,7 +14,6 @@ from ccxt.base.errors import PermissionDenied
|
|
14
14
|
from ccxt.base.errors import ArgumentsRequired
|
15
15
|
from ccxt.base.errors import BadRequest
|
16
16
|
from ccxt.base.errors import BadSymbol
|
17
|
-
from ccxt.base.errors import BadResponse
|
18
17
|
from ccxt.base.errors import InsufficientFunds
|
19
18
|
from ccxt.base.errors import InvalidAddress
|
20
19
|
from ccxt.base.errors import InvalidOrder
|
@@ -24,6 +23,7 @@ from ccxt.base.errors import DuplicateOrderId
|
|
24
23
|
from ccxt.base.errors import NotSupported
|
25
24
|
from ccxt.base.errors import RateLimitExceeded
|
26
25
|
from ccxt.base.errors import ExchangeNotAvailable
|
26
|
+
from ccxt.base.errors import BadResponse
|
27
27
|
from ccxt.base.decimal_to_precision import TICK_SIZE
|
28
28
|
from ccxt.base.precise import Precise
|
29
29
|
|
ccxt/async_support/deribit.py
CHANGED
@@ -2022,7 +2022,21 @@ class deribit(Exchange, ImplicitAPI):
|
|
2022
2022
|
market = self.market(symbol)
|
2023
2023
|
request['instrument_name'] = market['id']
|
2024
2024
|
response = await self.privateGetCancelAllByInstrument(self.extend(request, params))
|
2025
|
-
|
2025
|
+
#
|
2026
|
+
# {
|
2027
|
+
# jsonrpc: '2.0',
|
2028
|
+
# result: '1',
|
2029
|
+
# usIn: '1720508354127369',
|
2030
|
+
# usOut: '1720508354133603',
|
2031
|
+
# usDiff: '6234',
|
2032
|
+
# testnet: True
|
2033
|
+
# }
|
2034
|
+
#
|
2035
|
+
return [
|
2036
|
+
self.safe_order({
|
2037
|
+
'info': response,
|
2038
|
+
}),
|
2039
|
+
]
|
2026
2040
|
|
2027
2041
|
async def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
2028
2042
|
"""
|
ccxt/async_support/digifinex.py
CHANGED
@@ -17,7 +17,6 @@ from ccxt.base.errors import AccountSuspended
|
|
17
17
|
from ccxt.base.errors import ArgumentsRequired
|
18
18
|
from ccxt.base.errors import BadRequest
|
19
19
|
from ccxt.base.errors import BadSymbol
|
20
|
-
from ccxt.base.errors import BadResponse
|
21
20
|
from ccxt.base.errors import InsufficientFunds
|
22
21
|
from ccxt.base.errors import InvalidAddress
|
23
22
|
from ccxt.base.errors import InvalidOrder
|
@@ -27,6 +26,7 @@ from ccxt.base.errors import NetworkError
|
|
27
26
|
from ccxt.base.errors import DDoSProtection
|
28
27
|
from ccxt.base.errors import RateLimitExceeded
|
29
28
|
from ccxt.base.errors import InvalidNonce
|
29
|
+
from ccxt.base.errors import BadResponse
|
30
30
|
from ccxt.base.decimal_to_precision import TICK_SIZE
|
31
31
|
from ccxt.base.precise import Precise
|
32
32
|
|
@@ -1809,7 +1809,34 @@ class digifinex(Exchange, ImplicitAPI):
|
|
1809
1809
|
numCanceledOrders = len(canceledOrders)
|
1810
1810
|
if numCanceledOrders != 1:
|
1811
1811
|
raise OrderNotFound(self.id + ' cancelOrder() ' + id + ' not found')
|
1812
|
-
|
1812
|
+
orders = self.parse_cancel_orders(response)
|
1813
|
+
return self.safe_dict(orders, 0)
|
1814
|
+
else:
|
1815
|
+
return self.safe_order({
|
1816
|
+
'info': response,
|
1817
|
+
'orderId': self.safe_string(response, 'data'),
|
1818
|
+
})
|
1819
|
+
|
1820
|
+
def parse_cancel_orders(self, response):
|
1821
|
+
success = self.safe_list(response, 'success')
|
1822
|
+
error = self.safe_list(response, 'error')
|
1823
|
+
result = []
|
1824
|
+
for i in range(0, len(success)):
|
1825
|
+
order = success[i]
|
1826
|
+
result.append(self.safe_order({
|
1827
|
+
'info': order,
|
1828
|
+
'id': order,
|
1829
|
+
'status': 'canceled',
|
1830
|
+
}))
|
1831
|
+
for i in range(0, len(error)):
|
1832
|
+
order = error[i]
|
1833
|
+
result.append(self.safe_order({
|
1834
|
+
'info': order,
|
1835
|
+
'id': self.safe_string_2(order, 'order-id', 'order_id'),
|
1836
|
+
'status': 'failed',
|
1837
|
+
'clientOrderId': self.safe_string(order, 'client-order-id'),
|
1838
|
+
}))
|
1839
|
+
return result
|
1813
1840
|
|
1814
1841
|
async def cancel_orders(self, ids, symbol: Str = None, params={}):
|
1815
1842
|
"""
|
@@ -1840,11 +1867,7 @@ class digifinex(Exchange, ImplicitAPI):
|
|
1840
1867
|
# ]
|
1841
1868
|
# }
|
1842
1869
|
#
|
1843
|
-
|
1844
|
-
numCanceledOrders = len(canceledOrders)
|
1845
|
-
if numCanceledOrders < 1:
|
1846
|
-
raise OrderNotFound(self.id + ' cancelOrders() error')
|
1847
|
-
return response
|
1870
|
+
return self.parse_cancel_orders(response)
|
1848
1871
|
|
1849
1872
|
def parse_order_status(self, status: Str):
|
1850
1873
|
statuses: dict = {
|