ccxt 4.3.35__py2.py3-none-any.whl → 4.3.37__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/bitbay.py +6 -0
- ccxt/abstract/kraken.py +3 -3
- ccxt/abstract/zonda.py +6 -0
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/bingx.py +63 -33
- ccxt/async_support/bit2c.py +2 -1
- ccxt/async_support/bitbank.py +46 -1
- ccxt/async_support/bitget.py +10 -4
- ccxt/async_support/bitmart.py +2 -2
- ccxt/async_support/htx.py +64 -3
- ccxt/async_support/kraken.py +5 -5
- ccxt/async_support/paymium.py +4 -1
- ccxt/async_support/whitebit.py +24 -3
- ccxt/async_support/woofipro.py +3 -1
- ccxt/async_support/zaif.py +30 -2
- ccxt/async_support/zonda.py +6 -0
- ccxt/base/exchange.py +1 -1
- ccxt/bingx.py +63 -33
- ccxt/bit2c.py +2 -1
- ccxt/bitbank.py +46 -1
- ccxt/bitget.py +10 -4
- ccxt/bitmart.py +2 -2
- ccxt/htx.py +64 -3
- ccxt/kraken.py +5 -5
- ccxt/paymium.py +4 -1
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/binance.py +4 -4
- ccxt/pro/bingx.py +9 -4
- ccxt/pro/bitfinex2.py +4 -4
- ccxt/pro/bitmart.py +8 -6
- ccxt/pro/bybit.py +6 -6
- ccxt/pro/htx.py +5 -6
- ccxt/pro/okx.py +3 -4
- ccxt/pro/woo.py +4 -4
- ccxt/whitebit.py +24 -3
- ccxt/woofipro.py +3 -1
- ccxt/zaif.py +30 -2
- ccxt/zonda.py +6 -0
- {ccxt-4.3.35.dist-info → ccxt-4.3.37.dist-info}/METADATA +4 -4
- {ccxt-4.3.35.dist-info → ccxt-4.3.37.dist-info}/RECORD +44 -44
- {ccxt-4.3.35.dist-info → ccxt-4.3.37.dist-info}/WHEEL +0 -0
- {ccxt-4.3.35.dist-info → ccxt-4.3.37.dist-info}/top_level.txt +0 -0
ccxt/async_support/zonda.py
CHANGED
@@ -183,6 +183,10 @@ class zonda(Exchange, ImplicitAPI):
|
|
183
183
|
'balances/BITBAY/balance',
|
184
184
|
'fiat_cantor/rate/{baseId}/{quoteId}',
|
185
185
|
'fiat_cantor/history',
|
186
|
+
'client_payments/v2/customer/crypto/{currency}/channels/deposit',
|
187
|
+
'client_payments/v2/customer/crypto/{currency}/channels/withdrawal',
|
188
|
+
'client_payments/v2/customer/crypto/deposit/fee',
|
189
|
+
'client_payments/v2/customer/crypto/withdrawal/fee',
|
186
190
|
],
|
187
191
|
'post': [
|
188
192
|
'trading/offer/{symbol}',
|
@@ -193,6 +197,8 @@ class zonda(Exchange, ImplicitAPI):
|
|
193
197
|
'fiat_cantor/exchange',
|
194
198
|
'api_payments/withdrawals/crypto',
|
195
199
|
'api_payments/withdrawals/fiat',
|
200
|
+
'client_payments/v2/customer/crypto/deposit',
|
201
|
+
'client_payments/v2/customer/crypto/withdrawal',
|
196
202
|
],
|
197
203
|
'delete': [
|
198
204
|
'trading/offer/{symbol}/{id}/{side}/{price}',
|
ccxt/base/exchange.py
CHANGED
ccxt/bingx.py
CHANGED
@@ -1016,7 +1016,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1016
1016
|
if time == 0:
|
1017
1017
|
time = None
|
1018
1018
|
cost = self.safe_string(trade, 'quoteQty')
|
1019
|
-
type = 'spot' if (cost is None) else 'swap'
|
1019
|
+
# type = 'spot' if (cost is None) else 'swap'; self is not reliable
|
1020
1020
|
currencyId = self.safe_string_n(trade, ['currency', 'N', 'commissionAsset'])
|
1021
1021
|
currencyCode = self.safe_currency_code(currencyId)
|
1022
1022
|
m = self.safe_bool(trade, 'm')
|
@@ -1047,7 +1047,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1047
1047
|
'info': trade,
|
1048
1048
|
'timestamp': time,
|
1049
1049
|
'datetime': self.iso8601(time),
|
1050
|
-
'symbol': self.safe_symbol(marketId, market, '-'
|
1050
|
+
'symbol': self.safe_symbol(marketId, market, '-'),
|
1051
1051
|
'order': self.safe_string_2(trade, 'orderId', 'i'),
|
1052
1052
|
'type': self.safe_string_lower(trade, 'o'),
|
1053
1053
|
'side': self.parse_order_side(side),
|
@@ -2569,7 +2569,9 @@ class bingx(Exchange, ImplicitAPI):
|
|
2569
2569
|
#
|
2570
2570
|
else:
|
2571
2571
|
raise BadRequest(self.id + ' cancelAllOrders is only supported for spot and swap markets.')
|
2572
|
-
|
2572
|
+
data = self.safe_dict(response, 'data', {})
|
2573
|
+
orders = self.safe_list_2(data, 'success', 'orders', [])
|
2574
|
+
return self.parse_orders(orders)
|
2573
2575
|
|
2574
2576
|
def cancel_orders(self, ids: List[str], symbol: Str = None, params={}):
|
2575
2577
|
"""
|
@@ -2605,42 +2607,70 @@ class bingx(Exchange, ImplicitAPI):
|
|
2605
2607
|
spotReqKey = 'clientOrderIDs' if areClientOrderIds else 'orderIds'
|
2606
2608
|
request[spotReqKey] = ','.join(parsedIds)
|
2607
2609
|
response = self.spotV1PrivatePostTradeCancelOrders(self.extend(request, params))
|
2610
|
+
#
|
2611
|
+
# {
|
2612
|
+
# "code": 0,
|
2613
|
+
# "msg": "",
|
2614
|
+
# "debugMsg": "",
|
2615
|
+
# "data": {
|
2616
|
+
# "orders": [
|
2617
|
+
# {
|
2618
|
+
# "symbol": "SOL-USDT",
|
2619
|
+
# "orderId": 1795970045910614016,
|
2620
|
+
# "transactTime": 1717027601111,
|
2621
|
+
# "price": "180.25",
|
2622
|
+
# "stopPrice": "0",
|
2623
|
+
# "origQty": "0.03",
|
2624
|
+
# "executedQty": "0",
|
2625
|
+
# "cummulativeQuoteQty": "0",
|
2626
|
+
# "status": "CANCELED",
|
2627
|
+
# "type": "LIMIT",
|
2628
|
+
# "side": "SELL",
|
2629
|
+
# "clientOrderID": ""
|
2630
|
+
# },
|
2631
|
+
# ...
|
2632
|
+
# ]
|
2633
|
+
# }
|
2634
|
+
# }
|
2635
|
+
#
|
2608
2636
|
else:
|
2609
2637
|
if areClientOrderIds:
|
2610
2638
|
request['clientOrderIDList'] = self.json(parsedIds)
|
2611
2639
|
else:
|
2612
2640
|
request['orderIdList'] = parsedIds
|
2613
2641
|
response = self.swapV2PrivateDeleteTradeBatchOrders(self.extend(request, params))
|
2614
|
-
|
2615
|
-
|
2616
|
-
|
2617
|
-
|
2618
|
-
|
2619
|
-
|
2620
|
-
|
2621
|
-
|
2622
|
-
|
2623
|
-
|
2624
|
-
|
2625
|
-
|
2626
|
-
|
2627
|
-
|
2628
|
-
|
2629
|
-
|
2630
|
-
|
2631
|
-
|
2632
|
-
|
2633
|
-
|
2634
|
-
|
2635
|
-
|
2636
|
-
|
2637
|
-
|
2638
|
-
|
2639
|
-
|
2640
|
-
|
2641
|
-
|
2642
|
-
|
2643
|
-
|
2642
|
+
#
|
2643
|
+
# {
|
2644
|
+
# "code": 0,
|
2645
|
+
# "msg": "",
|
2646
|
+
# "data": {
|
2647
|
+
# "success": [
|
2648
|
+
# {
|
2649
|
+
# "symbol": "LINK-USDT",
|
2650
|
+
# "orderId": 1597783850786750464,
|
2651
|
+
# "side": "BUY",
|
2652
|
+
# "positionSide": "LONG",
|
2653
|
+
# "type": "TRIGGER_MARKET",
|
2654
|
+
# "origQty": "5.0",
|
2655
|
+
# "price": "5.5710",
|
2656
|
+
# "executedQty": "0.0",
|
2657
|
+
# "avgPrice": "0.0000",
|
2658
|
+
# "cumQuote": "0",
|
2659
|
+
# "stopPrice": "5.0000",
|
2660
|
+
# "profit": "0.0000",
|
2661
|
+
# "commission": "0.000000",
|
2662
|
+
# "status": "CANCELLED",
|
2663
|
+
# "time": 1669776330000,
|
2664
|
+
# "updateTime": 1672370837000
|
2665
|
+
# }
|
2666
|
+
# ],
|
2667
|
+
# "failed": null
|
2668
|
+
# }
|
2669
|
+
# }
|
2670
|
+
#
|
2671
|
+
data = self.safe_dict(response, 'data', {})
|
2672
|
+
success = self.safe_list_2(data, 'success', 'orders', [])
|
2673
|
+
return self.parse_orders(success)
|
2644
2674
|
|
2645
2675
|
def cancel_all_orders_after(self, timeout: Int, params={}):
|
2646
2676
|
"""
|
ccxt/bit2c.py
CHANGED
@@ -448,7 +448,8 @@ class bit2c(Exchange, ImplicitAPI):
|
|
448
448
|
request: dict = {
|
449
449
|
'id': id,
|
450
450
|
}
|
451
|
-
|
451
|
+
response = self.privatePostOrderCancelOrder(self.extend(request, params))
|
452
|
+
return self.parse_order(response)
|
452
453
|
|
453
454
|
def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
454
455
|
"""
|
ccxt/bitbank.py
CHANGED
@@ -669,8 +669,31 @@ class bitbank(Exchange, ImplicitAPI):
|
|
669
669
|
'pair': market['id'],
|
670
670
|
}
|
671
671
|
response = self.privatePostUserSpotCancelOrder(self.extend(request, params))
|
672
|
+
#
|
673
|
+
# {
|
674
|
+
# "success": 1,
|
675
|
+
# "data": {
|
676
|
+
# "order_id": 0,
|
677
|
+
# "pair": "string",
|
678
|
+
# "side": "string",
|
679
|
+
# "type": "string",
|
680
|
+
# "start_amount": "string",
|
681
|
+
# "remaining_amount": "string",
|
682
|
+
# "executed_amount": "string",
|
683
|
+
# "price": "string",
|
684
|
+
# "post_only": False,
|
685
|
+
# "average_price": "string",
|
686
|
+
# "ordered_at": 0,
|
687
|
+
# "expire_at": 0,
|
688
|
+
# "canceled_at": 0,
|
689
|
+
# "triggered_at": 0,
|
690
|
+
# "trigger_price": "string",
|
691
|
+
# "status": "string"
|
692
|
+
# }
|
693
|
+
# }
|
694
|
+
#
|
672
695
|
data = self.safe_value(response, 'data')
|
673
|
-
return data
|
696
|
+
return self.parse_order(data)
|
674
697
|
|
675
698
|
def fetch_order(self, id: str, symbol: Str = None, params={}):
|
676
699
|
"""
|
@@ -687,6 +710,28 @@ class bitbank(Exchange, ImplicitAPI):
|
|
687
710
|
'pair': market['id'],
|
688
711
|
}
|
689
712
|
response = self.privateGetUserSpotOrder(self.extend(request, params))
|
713
|
+
#
|
714
|
+
# {
|
715
|
+
# "success": 1,
|
716
|
+
# "data": {
|
717
|
+
# "order_id": 0,
|
718
|
+
# "pair": "string",
|
719
|
+
# "side": "string",
|
720
|
+
# "type": "string",
|
721
|
+
# "start_amount": "string",
|
722
|
+
# "remaining_amount": "string",
|
723
|
+
# "executed_amount": "string",
|
724
|
+
# "price": "string",
|
725
|
+
# "post_only": False,
|
726
|
+
# "average_price": "string",
|
727
|
+
# "ordered_at": 0,
|
728
|
+
# "expire_at": 0,
|
729
|
+
# "triggered_at": 0,
|
730
|
+
# "triger_price": "string",
|
731
|
+
# "status": "string"
|
732
|
+
# }
|
733
|
+
# }
|
734
|
+
#
|
690
735
|
data = self.safe_dict(response, 'data')
|
691
736
|
return self.parse_order(data, market)
|
692
737
|
|
ccxt/bitget.py
CHANGED
@@ -1249,6 +1249,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
1249
1249
|
'40712': InsufficientFunds, # Insufficient margin
|
1250
1250
|
'40713': ExchangeError, # Cannot exceed the maximum transferable margin amount
|
1251
1251
|
'40714': ExchangeError, # No direct margin call is allowed
|
1252
|
+
'40762': InsufficientFunds, # {"code":"40762","msg":"The order amount exceeds the balance","requestTime":1716572156622,"data":null}
|
1252
1253
|
'40768': OrderNotFound, # Order does not exist"
|
1253
1254
|
'41114': OnMaintenance, # {"code":"41114","msg":"The current trading pair is under maintenance, please refer to the official announcement for the opening time","requestTime":1679196062544,"data":null}
|
1254
1255
|
'43011': InvalidOrder, # The parameter does not meet the specification executePrice <= 0
|
@@ -4138,18 +4139,23 @@ class bitget(Exchange, ImplicitAPI):
|
|
4138
4139
|
marginMode = 'cross'
|
4139
4140
|
marginModeRequest = 'crossed' if (marginMode == 'cross') else 'isolated'
|
4140
4141
|
request['marginMode'] = marginModeRequest
|
4141
|
-
|
4142
|
-
params = self.
|
4142
|
+
hedged = None
|
4143
|
+
hedged, params = self.handle_param_bool(params, 'hedged', False)
|
4144
|
+
# backward compatibility for `oneWayMode`
|
4145
|
+
oneWayMode = None
|
4146
|
+
oneWayMode, params = self.handle_param_bool(params, 'oneWayMode')
|
4147
|
+
if oneWayMode is not None:
|
4148
|
+
hedged = not oneWayMode
|
4143
4149
|
requestSide = side
|
4144
4150
|
if reduceOnly:
|
4145
|
-
if
|
4151
|
+
if not hedged:
|
4146
4152
|
request['reduceOnly'] = 'YES'
|
4147
4153
|
else:
|
4148
4154
|
# on bitget hedge mode if the position is long the side is always buy, and if the position is short the side is always sell
|
4149
4155
|
requestSide = 'sell' if (side == 'buy') else 'buy'
|
4150
4156
|
request['tradeSide'] = 'Close'
|
4151
4157
|
else:
|
4152
|
-
if
|
4158
|
+
if hedged:
|
4153
4159
|
request['tradeSide'] = 'Open'
|
4154
4160
|
request['side'] = requestSide
|
4155
4161
|
elif marketType == 'spot':
|
ccxt/bitmart.py
CHANGED
@@ -1180,9 +1180,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1180
1180
|
market = self.safe_market(marketId, market)
|
1181
1181
|
symbol = market['symbol']
|
1182
1182
|
last = self.safe_string_2(ticker, 'close_24h', 'last_price')
|
1183
|
-
percentage =
|
1183
|
+
percentage = self.safe_string(ticker, 'price_change_percent_24h')
|
1184
1184
|
if percentage is None:
|
1185
|
-
percentage = Precise.
|
1185
|
+
percentage = Precise.string_mul(self.safe_string(ticker, 'fluctuation'), '100')
|
1186
1186
|
baseVolume = self.safe_string(ticker, 'base_volume_24h')
|
1187
1187
|
quoteVolume = self.safe_string(ticker, 'quote_volume_24h')
|
1188
1188
|
if quoteVolume is None:
|
ccxt/htx.py
CHANGED
@@ -56,6 +56,8 @@ class htx(Exchange, ImplicitAPI):
|
|
56
56
|
'cancelAllOrdersAfter': True,
|
57
57
|
'cancelOrder': True,
|
58
58
|
'cancelOrders': True,
|
59
|
+
'closeAllPositions': False,
|
60
|
+
'closePosition': True,
|
59
61
|
'createDepositAddress': None,
|
60
62
|
'createMarketBuyOrderWithCost': True,
|
61
63
|
'createMarketOrderWithCost': False,
|
@@ -5003,7 +5005,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5003
5005
|
:param float [params.stopLossPrice]: *contract only* the price a stop-loss order is triggered at
|
5004
5006
|
:param float [params.takeProfitPrice]: *contract only* the price a take-profit order is triggered at
|
5005
5007
|
:param str [params.operator]: *spot and margin only* gte or lte, trigger price condition
|
5006
|
-
:param str [params.offset]: *contract only* '
|
5008
|
+
:param str [params.offset]: *contract only* 'both'(linear only), 'open', or 'close', required in hedge mode and for inverse markets
|
5007
5009
|
:param bool [params.postOnly]: *contract only* True or False
|
5008
5010
|
:param int [params.leverRate]: *contract only* required for all contract orders except tpsl, leverage greater than 20x requires prior approval of high-leverage agreement
|
5009
5011
|
:param str [params.timeInForce]: supports 'IOC' and 'FOK'
|
@@ -5053,6 +5055,9 @@ class htx(Exchange, ImplicitAPI):
|
|
5053
5055
|
else:
|
5054
5056
|
response = self.contractPrivatePostLinearSwapApiV1SwapCrossOrder(contractRequest)
|
5055
5057
|
elif market['inverse']:
|
5058
|
+
offset = self.safe_string(params, 'offset')
|
5059
|
+
if offset is None:
|
5060
|
+
raise ArgumentsRequired(self.id + ' createOrder() requires an extra parameter params["offset"] to be set to "open" or "close" when placing orders in inverse markets')
|
5056
5061
|
if market['swap']:
|
5057
5062
|
if isStop:
|
5058
5063
|
response = self.contractPrivatePostSwapApiV1SwapTriggerOrder(contractRequest)
|
@@ -6934,14 +6939,19 @@ class htx(Exchange, ImplicitAPI):
|
|
6934
6939
|
fetch all open positions
|
6935
6940
|
:param str[]|None symbols: list of unified market symbols
|
6936
6941
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
6942
|
+
:param str [params.subType]: 'linear' or 'inverse'
|
6943
|
+
:param str [params.type]: *inverse only* 'future', or 'swap'
|
6944
|
+
:param str [params.marginMode]: *linear only* 'cross' or 'isolated'
|
6937
6945
|
:returns dict[]: a list of `position structure <https://docs.ccxt.com/#/?id=position-structure>`
|
6938
6946
|
"""
|
6939
6947
|
self.load_markets()
|
6940
6948
|
symbols = self.market_symbols(symbols)
|
6941
6949
|
market = None
|
6942
6950
|
if symbols is not None:
|
6943
|
-
|
6944
|
-
|
6951
|
+
symbolsLength = len(symbols)
|
6952
|
+
if symbolsLength > 0:
|
6953
|
+
first = self.safe_string(symbols, 0)
|
6954
|
+
market = self.market(first)
|
6945
6955
|
marginMode = None
|
6946
6956
|
marginMode, params = self.handle_margin_mode_and_params('fetchPositions', params, 'cross')
|
6947
6957
|
subType = None
|
@@ -8385,6 +8395,57 @@ class htx(Exchange, ImplicitAPI):
|
|
8385
8395
|
'datetime': self.iso8601(timestamp),
|
8386
8396
|
})
|
8387
8397
|
|
8398
|
+
def close_position(self, symbol: str, side: OrderSide = None, params={}) -> Order:
|
8399
|
+
"""
|
8400
|
+
closes open positions for a contract market, requires 'amount' in params, unlike other exchanges
|
8401
|
+
:see: https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-place-lightning-close-order # USDT-M(isolated)
|
8402
|
+
:see: https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-place-lightning-close-position # USDT-M(cross)
|
8403
|
+
:see: https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#place-lightning-close-order # Coin-M swap
|
8404
|
+
:see: https://huobiapi.github.io/docs/dm/v1/en/#place-flash-close-order # Coin-M futures
|
8405
|
+
:param str symbol: unified CCXT market symbol
|
8406
|
+
:param str side: 'buy' or 'sell', the side of the closing order, opposite side side
|
8407
|
+
:param dict [params]: extra parameters specific to the okx api endpoint
|
8408
|
+
:param str [params.clientOrderId]: client needs to provide unique API and have to maintain the API themselves afterwards. [1, 9223372036854775807]
|
8409
|
+
:param dict [params.marginMode]: 'cross' or 'isolated', required for linear markets
|
8410
|
+
*
|
8411
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
8412
|
+
:param number [params.amount]: order quantity
|
8413
|
+
:param str [params.order_price_type]: 'lightning' by default, 'lightning_fok': lightning fok type, 'lightning_ioc': lightning ioc type 'market' by default, 'market': market order type, 'lightning_fok': lightning
|
8414
|
+
:returns dict: `an order structure <https://docs.ccxt.com/#/?id=position-structure>`
|
8415
|
+
"""
|
8416
|
+
self.load_markets()
|
8417
|
+
market = self.market(symbol)
|
8418
|
+
clientOrderId = self.safe_string(params, 'clientOrderId')
|
8419
|
+
if not market['contract']:
|
8420
|
+
raise BadRequest(self.id + ' closePosition() symbol supports contract markets only')
|
8421
|
+
self.check_required_argument('closePosition', side, 'side')
|
8422
|
+
request: dict = {
|
8423
|
+
'contract_code': market['id'],
|
8424
|
+
'direction': side,
|
8425
|
+
}
|
8426
|
+
if clientOrderId is not None:
|
8427
|
+
request['client_order_id'] = clientOrderId
|
8428
|
+
if market['inverse']:
|
8429
|
+
amount = self.safe_string_2(params, 'volume', 'amount')
|
8430
|
+
if amount is None:
|
8431
|
+
raise ArgumentsRequired(self.id + ' closePosition() requires an extra argument params["amount"] for inverse markets')
|
8432
|
+
request['volume'] = self.amount_to_precision(symbol, amount)
|
8433
|
+
params = self.omit(params, ['clientOrderId', 'volume', 'amount'])
|
8434
|
+
response = None
|
8435
|
+
if market['inverse']: # Coin-M
|
8436
|
+
if market['swap']:
|
8437
|
+
response = self.contractPrivatePostSwapApiV1SwapLightningClosePosition(self.extend(request, params))
|
8438
|
+
else: # future
|
8439
|
+
response = self.contractPrivatePostApiV1LightningClosePosition(self.extend(request, params))
|
8440
|
+
else: # USDT-M
|
8441
|
+
marginMode = None
|
8442
|
+
marginMode, params = self.handle_margin_mode_and_params('closePosition', params, 'cross')
|
8443
|
+
if marginMode == 'cross':
|
8444
|
+
response = self.contractPrivatePostLinearSwapApiV1SwapCrossLightningClosePosition(self.extend(request, params))
|
8445
|
+
else: # isolated
|
8446
|
+
response = self.contractPrivatePostLinearSwapApiV1SwapLightningClosePosition(self.extend(request, params))
|
8447
|
+
return self.parse_order(response, market)
|
8448
|
+
|
8388
8449
|
def set_position_mode(self, hedged: bool, symbol: Str = None, params={}):
|
8389
8450
|
"""
|
8390
8451
|
set hedged to True or False
|
ccxt/kraken.py
CHANGED
@@ -179,13 +179,13 @@ class kraken(Exchange, ImplicitAPI):
|
|
179
179
|
# rate-limits explained in comment in the top of self file
|
180
180
|
'Assets': 1,
|
181
181
|
'AssetPairs': 1,
|
182
|
-
'Depth': 1,
|
183
|
-
'OHLC': 1,
|
182
|
+
'Depth': 1.2,
|
183
|
+
'OHLC': 1.2, # 1.2 because 1 triggers too many requests immediately
|
184
184
|
'Spread': 1,
|
185
185
|
'SystemStatus': 1,
|
186
186
|
'Ticker': 1,
|
187
187
|
'Time': 1,
|
188
|
-
'Trades': 1,
|
188
|
+
'Trades': 1.2,
|
189
189
|
},
|
190
190
|
},
|
191
191
|
'private': {
|
@@ -761,8 +761,8 @@ class kraken(Exchange, ImplicitAPI):
|
|
761
761
|
return {
|
762
762
|
'info': response,
|
763
763
|
'symbol': market['symbol'],
|
764
|
-
'maker': self.
|
765
|
-
'taker': self.
|
764
|
+
'maker': self.parse_number(Precise.string_div(self.safe_string(symbolMakerFee, 'fee'), '100')),
|
765
|
+
'taker': self.parse_number(Precise.string_div(self.safe_string(symbolTakerFee, 'fee'), '100')),
|
766
766
|
'percentage': True,
|
767
767
|
'tierBased': True,
|
768
768
|
}
|
ccxt/paymium.py
CHANGED
@@ -407,7 +407,10 @@ class paymium(Exchange, ImplicitAPI):
|
|
407
407
|
request: dict = {
|
408
408
|
'uuid': id,
|
409
409
|
}
|
410
|
-
|
410
|
+
response = self.privateDeleteUserOrdersUuidCancel(self.extend(request, params))
|
411
|
+
return self.safe_order({
|
412
|
+
'info': response,
|
413
|
+
})
|
411
414
|
|
412
415
|
def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
|
413
416
|
"""
|
ccxt/pro/__init__.py
CHANGED
ccxt/pro/binance.py
CHANGED
@@ -691,10 +691,10 @@ class binance(ccxt.async_support.binance):
|
|
691
691
|
# todo: self is a synch blocking call - make it async
|
692
692
|
# default 100, max 1000, valid limits 5, 10, 20, 50, 100, 500, 1000
|
693
693
|
snapshot = await self.fetch_rest_order_book_safe(symbol, limit, params)
|
694
|
-
|
695
|
-
if orderbook is None:
|
694
|
+
if self.safe_value(self.orderbooks, symbol) is None:
|
696
695
|
# if the orderbook is dropped before the snapshot is received
|
697
696
|
return
|
697
|
+
orderbook = self.orderbooks[symbol]
|
698
698
|
orderbook.reset(snapshot)
|
699
699
|
# unroll the accumulated deltas
|
700
700
|
messages = orderbook.cache
|
@@ -770,8 +770,7 @@ class binance(ccxt.async_support.binance):
|
|
770
770
|
symbol = market['symbol']
|
771
771
|
name = 'depth'
|
772
772
|
messageHash = market['lowercaseId'] + '@' + name
|
773
|
-
|
774
|
-
if orderbook is None:
|
773
|
+
if not (symbol in self.orderbooks):
|
775
774
|
#
|
776
775
|
# https://github.com/ccxt/ccxt/issues/6672
|
777
776
|
#
|
@@ -781,6 +780,7 @@ class binance(ccxt.async_support.binance):
|
|
781
780
|
# therefore it is safe to drop these premature messages.
|
782
781
|
#
|
783
782
|
return
|
783
|
+
orderbook = self.orderbooks[symbol]
|
784
784
|
nonce = self.safe_integer(orderbook, 'nonce')
|
785
785
|
if nonce is None:
|
786
786
|
# 2. Buffer the events you receive from the stream.
|
ccxt/pro/bingx.py
CHANGED
@@ -928,13 +928,16 @@ class bingx(ccxt.async_support.bingx):
|
|
928
928
|
# }
|
929
929
|
#
|
930
930
|
isSpot = ('dataType' in message)
|
931
|
-
result = self.
|
931
|
+
result = self.safe_dict_2(message, 'data', 'o', {})
|
932
932
|
cachedTrades = self.myTrades
|
933
933
|
if cachedTrades is None:
|
934
934
|
limit = self.safe_integer(self.options, 'tradesLimit', 1000)
|
935
935
|
cachedTrades = ArrayCacheBySymbolById(limit)
|
936
936
|
self.myTrades = cachedTrades
|
937
|
-
|
937
|
+
type = 'spot' if isSpot else 'swap'
|
938
|
+
marketId = self.safe_string(result, 's')
|
939
|
+
market = self.safe_market(marketId, None, '-', type)
|
940
|
+
parsed = self.parse_trade(result, market)
|
938
941
|
symbol = parsed['symbol']
|
939
942
|
spotHash = 'spot:mytrades'
|
940
943
|
swapHash = 'swap:mytrades'
|
@@ -980,10 +983,12 @@ class bingx(ccxt.async_support.bingx):
|
|
980
983
|
# }
|
981
984
|
# }
|
982
985
|
#
|
983
|
-
a = self.
|
984
|
-
data = self.
|
986
|
+
a = self.safe_dict(message, 'a', {})
|
987
|
+
data = self.safe_list(a, 'B', [])
|
985
988
|
timestamp = self.safe_integer_2(message, 'T', 'E')
|
986
989
|
type = 'swap' if ('P' in a) else 'spot'
|
990
|
+
if not (type in self.balance):
|
991
|
+
self.balance[type] = {}
|
987
992
|
self.balance[type]['info'] = data
|
988
993
|
self.balance[type]['timestamp'] = timestamp
|
989
994
|
self.balance[type]['datetime'] = self.iso8601(timestamp)
|
ccxt/pro/bitfinex2.py
CHANGED
@@ -551,8 +551,7 @@ class bitfinex2(ccxt.async_support.bitfinex2):
|
|
551
551
|
prec = self.safe_string(subscription, 'prec', 'P0')
|
552
552
|
isRaw = (prec == 'R0')
|
553
553
|
# if it is an initial snapshot
|
554
|
-
|
555
|
-
if orderbook is None:
|
554
|
+
if not (symbol in self.orderbooks):
|
556
555
|
limit = self.safe_integer(subscription, 'len')
|
557
556
|
if isRaw:
|
558
557
|
# raw order books
|
@@ -571,7 +570,7 @@ class bitfinex2(ccxt.async_support.bitfinex2):
|
|
571
570
|
bookside = orderbook[side]
|
572
571
|
idString = self.safe_string(delta, 0)
|
573
572
|
price = self.safe_float(delta, 1)
|
574
|
-
bookside.
|
573
|
+
bookside.storeArray([price, size, idString])
|
575
574
|
else:
|
576
575
|
deltas = message[1]
|
577
576
|
for i in range(0, len(deltas)):
|
@@ -582,10 +581,11 @@ class bitfinex2(ccxt.async_support.bitfinex2):
|
|
582
581
|
size = -amount if (amount < 0) else amount
|
583
582
|
side = 'asks' if (amount < 0) else 'bids'
|
584
583
|
bookside = orderbook[side]
|
585
|
-
bookside.
|
584
|
+
bookside.storeArray([price, size, counter])
|
586
585
|
orderbook['symbol'] = symbol
|
587
586
|
client.resolve(orderbook, messageHash)
|
588
587
|
else:
|
588
|
+
orderbook = self.orderbooks[symbol]
|
589
589
|
deltas = message[1]
|
590
590
|
orderbookItem = self.orderbooks[symbol]
|
591
591
|
if isRaw:
|
ccxt/pro/bitmart.py
CHANGED
@@ -12,7 +12,6 @@ from ccxt.async_support.base.ws.client import Client
|
|
12
12
|
from typing import List
|
13
13
|
from ccxt.base.errors import ExchangeError
|
14
14
|
from ccxt.base.errors import AuthenticationError
|
15
|
-
from ccxt.base.errors import ArgumentsRequired
|
16
15
|
from ccxt.base.errors import NotSupported
|
17
16
|
|
18
17
|
|
@@ -333,9 +332,9 @@ class bitmart(ccxt.async_support.bitmart):
|
|
333
332
|
|
334
333
|
async def watch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
335
334
|
"""
|
336
|
-
:see: https://developer-pro.bitmart.com/en/spot/#private-order-channel
|
337
|
-
:see: https://developer-pro.bitmart.com/en/futures/#private-order-channel
|
338
335
|
watches information on multiple orders made by the user
|
336
|
+
:see: https://developer-pro.bitmart.com/en/spot/#private-order-progress
|
337
|
+
:see: https://developer-pro.bitmart.com/en/futures/#private-order-channel
|
339
338
|
:param str symbol: unified market symbol of the market orders were made in
|
340
339
|
:param int [since]: the earliest time in ms to fetch orders for
|
341
340
|
:param int [limit]: the maximum number of order structures to retrieve
|
@@ -354,11 +353,14 @@ class bitmart(ccxt.async_support.bitmart):
|
|
354
353
|
await self.authenticate(type, params)
|
355
354
|
request = None
|
356
355
|
if type == 'spot':
|
357
|
-
|
358
|
-
|
356
|
+
argsRequest = 'spot/user/order:'
|
357
|
+
if symbol is not None:
|
358
|
+
argsRequest += market['id']
|
359
|
+
else:
|
360
|
+
argsRequest = 'spot/user/orders:ALL_SYMBOLS'
|
359
361
|
request = {
|
360
362
|
'op': 'subscribe',
|
361
|
-
'args': [
|
363
|
+
'args': [argsRequest],
|
362
364
|
}
|
363
365
|
else:
|
364
366
|
request = {
|
ccxt/pro/bybit.py
CHANGED
@@ -678,21 +678,21 @@ class bybit(ccxt.async_support.bybit):
|
|
678
678
|
isSpot = client.url.find('spot') >= 0
|
679
679
|
type = self.safe_string(message, 'type')
|
680
680
|
isSnapshot = (type == 'snapshot')
|
681
|
-
data = self.
|
681
|
+
data = self.safe_dict(message, 'data', {})
|
682
682
|
marketId = self.safe_string(data, 's')
|
683
683
|
marketType = 'spot' if isSpot else 'contract'
|
684
684
|
market = self.safe_market(marketId, None, None, marketType)
|
685
685
|
symbol = market['symbol']
|
686
686
|
timestamp = self.safe_integer(message, 'ts')
|
687
|
-
|
688
|
-
|
689
|
-
|
687
|
+
if not (symbol in self.orderbooks):
|
688
|
+
self.orderbooks[symbol] = self.order_book()
|
689
|
+
orderbook = self.orderbooks[symbol]
|
690
690
|
if isSnapshot:
|
691
691
|
snapshot = self.parse_order_book(data, symbol, timestamp, 'b', 'a')
|
692
692
|
orderbook.reset(snapshot)
|
693
693
|
else:
|
694
|
-
asks = self.
|
695
|
-
bids = self.
|
694
|
+
asks = self.safe_list(data, 'a', [])
|
695
|
+
bids = self.safe_list(data, 'b', [])
|
696
696
|
self.handle_deltas(orderbook['asks'], asks)
|
697
697
|
self.handle_deltas(orderbook['bids'], bids)
|
698
698
|
orderbook['timestamp'] = timestamp
|
ccxt/pro/htx.py
CHANGED
@@ -608,19 +608,18 @@ class htx(ccxt.async_support.htx):
|
|
608
608
|
# }
|
609
609
|
#
|
610
610
|
messageHash = self.safe_string(message, 'ch')
|
611
|
-
tick = self.
|
611
|
+
tick = self.safe_dict(message, 'tick')
|
612
612
|
event = self.safe_string(tick, 'event')
|
613
|
-
ch = self.
|
613
|
+
ch = self.safe_string(message, 'ch')
|
614
614
|
parts = ch.split('.')
|
615
615
|
marketId = self.safe_string(parts, 1)
|
616
616
|
symbol = self.safe_symbol(marketId)
|
617
|
-
|
618
|
-
if orderbook is None:
|
617
|
+
if not (symbol in self.orderbooks):
|
619
618
|
size = self.safe_string(parts, 3)
|
620
619
|
sizeParts = size.split('_')
|
621
620
|
limit = self.safe_integer(sizeParts, 1)
|
622
|
-
|
623
|
-
|
621
|
+
self.orderbooks[symbol] = self.order_book({}, limit)
|
622
|
+
orderbook = self.orderbooks[symbol]
|
624
623
|
if (event is None) and (orderbook['nonce'] is None):
|
625
624
|
orderbook.cache.append(message)
|
626
625
|
else:
|