ccxt 4.2.36__py2.py3-none-any.whl → 4.2.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/bitfinex2.py +122 -122
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/binance.py +122 -55
- ccxt/async_support/bitfinex2.py +122 -122
- ccxt/async_support/bitmex.py +22 -3
- ccxt/async_support/bybit.py +11 -4
- ccxt/base/exchange.py +1 -1
- ccxt/binance.py +122 -55
- ccxt/bitfinex2.py +122 -122
- ccxt/bitmex.py +22 -3
- ccxt/bybit.py +11 -4
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/gemini.py +165 -3
- ccxt/test/test_async.py +8 -6
- ccxt/test/test_sync.py +8 -6
- {ccxt-4.2.36.dist-info → ccxt-4.2.37.dist-info}/METADATA +6 -6
- {ccxt-4.2.36.dist-info → ccxt-4.2.37.dist-info}/RECORD +21 -21
- {ccxt-4.2.36.dist-info → ccxt-4.2.37.dist-info}/WHEEL +0 -0
- {ccxt-4.2.36.dist-info → ccxt-4.2.37.dist-info}/top_level.txt +0 -0
ccxt/async_support/binance.py
CHANGED
@@ -4841,7 +4841,7 @@ class binance(Exchange, ImplicitAPI):
|
|
4841
4841
|
# "msg": "Quantity greater than max quantity."
|
4842
4842
|
# }
|
4843
4843
|
#
|
4844
|
-
# createOrder: portfolio margin linear swap and future
|
4844
|
+
# createOrder, fetchOpenOrders: portfolio margin linear swap and future
|
4845
4845
|
#
|
4846
4846
|
# {
|
4847
4847
|
# "symbol": "BTCUSDT",
|
@@ -4864,7 +4864,7 @@ class binance(Exchange, ImplicitAPI):
|
|
4864
4864
|
# "status": "NEW"
|
4865
4865
|
# }
|
4866
4866
|
#
|
4867
|
-
# createOrder: portfolio margin inverse swap and future
|
4867
|
+
# createOrder, fetchOpenOrders: portfolio margin inverse swap and future
|
4868
4868
|
#
|
4869
4869
|
# {
|
4870
4870
|
# "symbol": "ETHUSD_PERP",
|
@@ -4886,7 +4886,7 @@ class binance(Exchange, ImplicitAPI):
|
|
4886
4886
|
# "status": "NEW"
|
4887
4887
|
# }
|
4888
4888
|
#
|
4889
|
-
# createOrder: portfolio margin linear swap and future conditional
|
4889
|
+
# createOrder, fetchOpenOrders: portfolio margin linear swap and future conditional
|
4890
4890
|
#
|
4891
4891
|
# {
|
4892
4892
|
# "newClientStrategyId": "x-xcKtGhcu27f109953d6e4dc0974006",
|
@@ -4909,7 +4909,7 @@ class binance(Exchange, ImplicitAPI):
|
|
4909
4909
|
# "selfTradePreventionMode": "NONE"
|
4910
4910
|
# }
|
4911
4911
|
#
|
4912
|
-
# createOrder: portfolio margin inverse swap and future conditional
|
4912
|
+
# createOrder, fetchOpenOrders: portfolio margin inverse swap and future conditional
|
4913
4913
|
#
|
4914
4914
|
# {
|
4915
4915
|
# "newClientStrategyId": "x-xcKtGhcuc6b86f053bb34933850739",
|
@@ -4930,7 +4930,7 @@ class binance(Exchange, ImplicitAPI):
|
|
4930
4930
|
# "priceProtect": False
|
4931
4931
|
# }
|
4932
4932
|
#
|
4933
|
-
# createOrder: portfolio margin spot margin
|
4933
|
+
# createOrder, cancelAllOrders: portfolio margin spot margin
|
4934
4934
|
#
|
4935
4935
|
# {
|
4936
4936
|
# "clientOrderId": "x-R4BD3S82e9ef29d8346440f0b28b86",
|
@@ -4949,13 +4949,39 @@ class binance(Exchange, ImplicitAPI):
|
|
4949
4949
|
# "type": "LIMIT"
|
4950
4950
|
# }
|
4951
4951
|
#
|
4952
|
+
# fetchOpenOrders: portfolio margin spot margin
|
4953
|
+
#
|
4954
|
+
# {
|
4955
|
+
# "symbol": "BTCUSDT",
|
4956
|
+
# "orderId": 24700763749,
|
4957
|
+
# "clientOrderId": "x-R4BD3S826f724c2a4af6425f98c7b6",
|
4958
|
+
# "price": "35000.00000000",
|
4959
|
+
# "origQty": "0.00100000",
|
4960
|
+
# "executedQty": "0.00000000",
|
4961
|
+
# "cummulativeQuoteQty": "0.00000000",
|
4962
|
+
# "status": "NEW",
|
4963
|
+
# "timeInForce": "GTC",
|
4964
|
+
# "type": "LIMIT",
|
4965
|
+
# "side": "BUY",
|
4966
|
+
# "stopPrice": "0.00000000",
|
4967
|
+
# "icebergQty": "0.00000000",
|
4968
|
+
# "time": 1707199187679,
|
4969
|
+
# "updateTime": 1707199187679,
|
4970
|
+
# "isWorking": True,
|
4971
|
+
# "accountId": 200180970,
|
4972
|
+
# "selfTradePreventionMode": "EXPIRE_MAKER",
|
4973
|
+
# "preventedMatchId": null,
|
4974
|
+
# "preventedQuantity": null
|
4975
|
+
# }
|
4976
|
+
#
|
4952
4977
|
code = self.safe_string(order, 'code')
|
4953
4978
|
if code is not None:
|
4954
4979
|
# cancelOrders/createOrders might have a partial success
|
4955
4980
|
return self.safe_order({'info': order, 'status': 'rejected'}, market)
|
4956
4981
|
status = self.parse_order_status(self.safe_string_2(order, 'status', 'strategyStatus'))
|
4957
4982
|
marketId = self.safe_string(order, 'symbol')
|
4958
|
-
|
4983
|
+
isContract = ('positionSide' in order) or ('cumQuote' in order)
|
4984
|
+
marketType = 'contract' if isContract else 'spot'
|
4959
4985
|
symbol = self.safe_symbol(marketId, market, None, marketType)
|
4960
4986
|
filled = self.safe_string(order, 'executedQty', '0')
|
4961
4987
|
timestamp = self.safe_integer_n(order, ['time', 'createTime', 'workingTime', 'transactTime', 'updateTime']) # order of the keys matters here
|
@@ -5219,16 +5245,6 @@ class binance(Exchange, ImplicitAPI):
|
|
5219
5245
|
else:
|
5220
5246
|
if reduceOnly:
|
5221
5247
|
request['sideEffectType'] = 'AUTO_REPAY'
|
5222
|
-
if not isPortfolioMargin:
|
5223
|
-
postOnly = self.is_post_only(isMarketOrder, initialUppercaseType == 'LIMIT_MAKER', params)
|
5224
|
-
if market['spot'] or marketType == 'margin':
|
5225
|
-
# only supported for spot/margin api(all margin markets are spot markets)
|
5226
|
-
if postOnly:
|
5227
|
-
type = 'LIMIT_MAKER'
|
5228
|
-
if marginMode == 'isolated':
|
5229
|
-
request['isIsolated'] = True
|
5230
|
-
if market['contract'] and postOnly:
|
5231
|
-
request['timeInForce'] = 'GTX'
|
5232
5248
|
triggerPrice = self.safe_string_2(params, 'triggerPrice', 'stopPrice')
|
5233
5249
|
stopLossPrice = self.safe_string(params, 'stopLossPrice', triggerPrice) # fallback to stopLoss
|
5234
5250
|
takeProfitPrice = self.safe_string(params, 'takeProfitPrice')
|
@@ -5286,6 +5302,15 @@ class binance(Exchange, ImplicitAPI):
|
|
5286
5302
|
request[clientOrderIdRequest] = brokerId + self.uuid22()
|
5287
5303
|
else:
|
5288
5304
|
request[clientOrderIdRequest] = clientOrderId
|
5305
|
+
postOnly = None
|
5306
|
+
if not isPortfolioMargin:
|
5307
|
+
postOnly = self.is_post_only(isMarketOrder, initialUppercaseType == 'LIMIT_MAKER', params)
|
5308
|
+
if market['spot'] or marketType == 'margin':
|
5309
|
+
# only supported for spot/margin api(all margin markets are spot markets)
|
5310
|
+
if postOnly:
|
5311
|
+
uppercaseType = 'LIMIT_MAKER'
|
5312
|
+
if marginMode == 'isolated':
|
5313
|
+
request['isIsolated'] = True
|
5289
5314
|
typeRequest = 'strategyType' if isPortfolioMarginConditional else 'type'
|
5290
5315
|
request[typeRequest] = uppercaseType
|
5291
5316
|
# additional required fields depending on the order type
|
@@ -5372,8 +5397,6 @@ class binance(Exchange, ImplicitAPI):
|
|
5372
5397
|
if price is None:
|
5373
5398
|
raise InvalidOrder(self.id + ' createOrder() requires a price argument for a ' + type + ' order')
|
5374
5399
|
request['price'] = self.price_to_precision(symbol, price)
|
5375
|
-
if timeInForceIsRequired:
|
5376
|
-
request['timeInForce'] = self.options['defaultTimeInForce'] # 'GTC' = Good To Cancel(default), 'IOC' = Immediate Or Cancel
|
5377
5400
|
if stopPriceIsRequired:
|
5378
5401
|
if market['contract']:
|
5379
5402
|
if stopPrice is None:
|
@@ -5384,16 +5407,10 @@ class binance(Exchange, ImplicitAPI):
|
|
5384
5407
|
raise InvalidOrder(self.id + ' createOrder() requires a stopPrice or trailingDelta param for a ' + type + ' order')
|
5385
5408
|
if stopPrice is not None:
|
5386
5409
|
request['stopPrice'] = self.price_to_precision(symbol, stopPrice)
|
5387
|
-
if
|
5388
|
-
|
5389
|
-
|
5390
|
-
|
5391
|
-
if postOnly:
|
5392
|
-
type = 'LIMIT_MAKER'
|
5393
|
-
if marginMode == 'isolated':
|
5394
|
-
request['isIsolated'] = True
|
5395
|
-
if market['contract'] and postOnly:
|
5396
|
-
request['timeInForce'] = 'GTX'
|
5410
|
+
if timeInForceIsRequired and (self.safe_string(params, 'timeInForce') is None):
|
5411
|
+
request['timeInForce'] = self.options['defaultTimeInForce'] # 'GTC' = Good To Cancel(default), 'IOC' = Immediate Or Cancel
|
5412
|
+
if not isPortfolioMargin and market['contract'] and postOnly:
|
5413
|
+
request['timeInForce'] = 'GTX'
|
5397
5414
|
# remove timeInForce from params because PO is only used by self.is_post_onlyand it's not a valid value for Binance
|
5398
5415
|
if self.safe_string(params, 'timeInForce') == 'PO':
|
5399
5416
|
params = self.omit(params, 'timeInForce')
|
@@ -5626,21 +5643,28 @@ class binance(Exchange, ImplicitAPI):
|
|
5626
5643
|
|
5627
5644
|
async def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
5628
5645
|
"""
|
5646
|
+
fetch all unfilled currently open orders
|
5629
5647
|
:see: https://binance-docs.github.io/apidocs/spot/en/#cancel-an-existing-order-and-send-a-new-order-trade
|
5630
5648
|
:see: https://binance-docs.github.io/apidocs/futures/en/#current-all-open-orders-user_data
|
5631
5649
|
:see: https://binance-docs.github.io/apidocs/delivery/en/#current-all-open-orders-user_data
|
5632
5650
|
:see: https://binance-docs.github.io/apidocs/voptions/en/#query-current-open-option-orders-user_data
|
5633
|
-
fetch all unfilled currently open orders
|
5634
5651
|
:see: https://binance-docs.github.io/apidocs/spot/en/#current-open-orders-user_data
|
5635
5652
|
:see: https://binance-docs.github.io/apidocs/futures/en/#current-all-open-orders-user_data
|
5636
5653
|
:see: https://binance-docs.github.io/apidocs/delivery/en/#current-all-open-orders-user_data
|
5637
5654
|
:see: https://binance-docs.github.io/apidocs/voptions/en/#query-current-open-option-orders-user_data
|
5638
5655
|
:see: https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-open-orders-user_data
|
5656
|
+
:see: https://binance-docs.github.io/apidocs/pm/en/#query-all-current-um-open-orders-user_data
|
5657
|
+
:see: https://binance-docs.github.io/apidocs/pm/en/#query-all-current-cm-open-orders-user_data
|
5658
|
+
:see: https://binance-docs.github.io/apidocs/pm/en/#query-all-current-um-open-conditional-orders-user_data
|
5659
|
+
:see: https://binance-docs.github.io/apidocs/pm/en/#query-all-current-cm-open-conditional-orders-user_data
|
5660
|
+
:see: https://binance-docs.github.io/apidocs/pm/en/#query-current-margin-open-order-user_data
|
5639
5661
|
:param str symbol: unified market symbol
|
5640
5662
|
:param int [since]: the earliest time in ms to fetch open orders for
|
5641
5663
|
:param int [limit]: the maximum number of open orders structures to retrieve
|
5642
5664
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
5643
5665
|
:param str [params.marginMode]: 'cross' or 'isolated', for spot margin trading
|
5666
|
+
:param boolean [params.portfolioMargin]: set to True if you would like to fetch open orders in the portfolio margin account
|
5667
|
+
:param boolean [params.stop]: set to True if you would like to fetch portfolio margin account conditional orders
|
5644
5668
|
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
5645
5669
|
"""
|
5646
5670
|
await self.load_markets()
|
@@ -5648,14 +5672,16 @@ class binance(Exchange, ImplicitAPI):
|
|
5648
5672
|
type = None
|
5649
5673
|
request = {}
|
5650
5674
|
marginMode = None
|
5651
|
-
|
5652
|
-
|
5675
|
+
marginMode, params = self.handle_margin_mode_and_params('fetchOpenOrders', params)
|
5676
|
+
isPortfolioMargin = None
|
5677
|
+
isPortfolioMargin, params = self.handle_option_and_params_2(params, 'fetchOpenOrders', 'papi', 'portfolioMargin', False)
|
5678
|
+
isConditional = self.safe_bool_2(params, 'stop', 'conditional')
|
5653
5679
|
if symbol is not None:
|
5654
5680
|
market = self.market(symbol)
|
5655
5681
|
request['symbol'] = market['id']
|
5656
5682
|
defaultType = self.safe_string_2(self.options, 'fetchOpenOrders', 'defaultType', 'spot')
|
5657
5683
|
marketType = market['type'] if ('type' in market) else defaultType
|
5658
|
-
type = self.safe_string(
|
5684
|
+
type = self.safe_string(params, 'type', marketType)
|
5659
5685
|
elif self.options['warnOnFetchOpenOrdersWithoutSymbol']:
|
5660
5686
|
symbols = self.symbols
|
5661
5687
|
numSymbols = len(symbols)
|
@@ -5663,29 +5689,44 @@ class binance(Exchange, ImplicitAPI):
|
|
5663
5689
|
raise ExchangeError(self.id + ' fetchOpenOrders() WARNING: fetching open orders without specifying a symbol is rate-limited to one call per ' + str(fetchOpenOrdersRateLimit) + ' seconds. Do not call self method frequently to avoid ban. Set ' + self.id + '.options["warnOnFetchOpenOrdersWithoutSymbol"] = False to suppress self warning message.')
|
5664
5690
|
else:
|
5665
5691
|
defaultType = self.safe_string_2(self.options, 'fetchOpenOrders', 'defaultType', 'spot')
|
5666
|
-
type = self.safe_string(
|
5692
|
+
type = self.safe_string(params, 'type', defaultType)
|
5667
5693
|
subType = None
|
5668
|
-
subType,
|
5669
|
-
|
5694
|
+
subType, params = self.handle_sub_type_and_params('fetchOpenOrders', market, params)
|
5695
|
+
params = self.omit(params, ['type', 'stop', 'conditional'])
|
5670
5696
|
response = None
|
5671
5697
|
if type == 'option':
|
5672
5698
|
if since is not None:
|
5673
5699
|
request['startTime'] = since
|
5674
5700
|
if limit is not None:
|
5675
5701
|
request['limit'] = limit
|
5676
|
-
response = await self.eapiPrivateGetOpenOrders(self.extend(request,
|
5702
|
+
response = await self.eapiPrivateGetOpenOrders(self.extend(request, params))
|
5677
5703
|
elif self.is_linear(type, subType):
|
5678
|
-
|
5704
|
+
if isPortfolioMargin:
|
5705
|
+
if isConditional:
|
5706
|
+
response = await self.papiGetUmConditionalOpenOrders(self.extend(request, params))
|
5707
|
+
else:
|
5708
|
+
response = await self.papiGetUmOpenOrders(self.extend(request, params))
|
5709
|
+
else:
|
5710
|
+
response = await self.fapiPrivateGetOpenOrders(self.extend(request, params))
|
5679
5711
|
elif self.is_inverse(type, subType):
|
5680
|
-
|
5712
|
+
if isPortfolioMargin:
|
5713
|
+
if isConditional:
|
5714
|
+
response = await self.papiGetCmConditionalOpenOrders(self.extend(request, params))
|
5715
|
+
else:
|
5716
|
+
response = await self.papiGetCmOpenOrders(self.extend(request, params))
|
5717
|
+
else:
|
5718
|
+
response = await self.dapiPrivateGetOpenOrders(self.extend(request, params))
|
5681
5719
|
elif type == 'margin' or marginMode is not None:
|
5682
|
-
if
|
5683
|
-
|
5684
|
-
|
5685
|
-
|
5686
|
-
|
5720
|
+
if isPortfolioMargin:
|
5721
|
+
response = await self.papiGetMarginOpenOrders(self.extend(request, params))
|
5722
|
+
else:
|
5723
|
+
if marginMode == 'isolated':
|
5724
|
+
request['isIsolated'] = True
|
5725
|
+
if symbol is None:
|
5726
|
+
raise ArgumentsRequired(self.id + ' fetchOpenOrders() requires a symbol argument for isolated markets')
|
5727
|
+
response = await self.sapiGetMarginOpenOrders(self.extend(request, params))
|
5687
5728
|
else:
|
5688
|
-
response = await self.privateGetOpenOrders(self.extend(request,
|
5729
|
+
response = await self.privateGetOpenOrders(self.extend(request, params))
|
5689
5730
|
return self.parse_orders(response, market, since, limit)
|
5690
5731
|
|
5691
5732
|
async def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
@@ -5781,40 +5822,66 @@ class binance(Exchange, ImplicitAPI):
|
|
5781
5822
|
|
5782
5823
|
async def cancel_all_orders(self, symbol: Str = None, params={}):
|
5783
5824
|
"""
|
5825
|
+
cancel all open orders in a market
|
5784
5826
|
:see: https://binance-docs.github.io/apidocs/spot/en/#cancel-all-open-orders-on-a-symbol-trade
|
5785
5827
|
:see: https://binance-docs.github.io/apidocs/futures/en/#cancel-all-open-orders-trade
|
5786
5828
|
:see: https://binance-docs.github.io/apidocs/delivery/en/#cancel-all-open-orders-trade
|
5787
5829
|
:see: https://binance-docs.github.io/apidocs/voptions/en/#cancel-all-option-orders-on-specific-symbol-trade
|
5788
5830
|
:see: https://binance-docs.github.io/apidocs/spot/en/#margin-account-cancel-order-trade
|
5789
|
-
cancel
|
5831
|
+
:see: https://binance-docs.github.io/apidocs/pm/en/#cancel-all-um-open-orders-trade
|
5832
|
+
:see: https://binance-docs.github.io/apidocs/pm/en/#cancel-all-cm-open-orders-trade
|
5833
|
+
:see: https://binance-docs.github.io/apidocs/pm/en/#cancel-all-um-open-conditional-orders-trade
|
5834
|
+
:see: https://binance-docs.github.io/apidocs/pm/en/#cancel-all-cm-open-conditional-orders-trade
|
5835
|
+
:see: https://binance-docs.github.io/apidocs/pm/en/#cancel-margin-account-all-open-orders-on-a-symbol-trade
|
5790
5836
|
:param str symbol: unified market symbol of the market to cancel orders in
|
5791
5837
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
5792
5838
|
:param str [params.marginMode]: 'cross' or 'isolated', for spot margin trading
|
5839
|
+
:param boolean [params.portfolioMargin]: set to True if you would like to cancel orders in a portfolio margin account
|
5840
|
+
:param boolean [params.stop]: set to True if you would like to cancel portfolio margin account conditional orders
|
5793
5841
|
:returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
5794
5842
|
"""
|
5795
5843
|
if symbol is None:
|
5796
|
-
raise ArgumentsRequired(self.id + '
|
5844
|
+
raise ArgumentsRequired(self.id + ' cancelAllOrders() requires a symbol argument')
|
5797
5845
|
await self.load_markets()
|
5798
5846
|
market = self.market(symbol)
|
5799
5847
|
request = {
|
5800
5848
|
'symbol': market['id'],
|
5801
5849
|
}
|
5850
|
+
isPortfolioMargin = None
|
5851
|
+
isPortfolioMargin, params = self.handle_option_and_params_2(params, 'cancelAllOrders', 'papi', 'portfolioMargin', False)
|
5852
|
+
isConditional = self.safe_bool_2(params, 'stop', 'conditional')
|
5802
5853
|
type = self.safe_string(params, 'type', market['type'])
|
5803
|
-
params = self.omit(params, ['type'])
|
5804
|
-
marginMode
|
5854
|
+
params = self.omit(params, ['type', 'stop', 'conditional'])
|
5855
|
+
marginMode = None
|
5856
|
+
marginMode, params = self.handle_margin_mode_and_params('cancelAllOrders', params)
|
5805
5857
|
response = None
|
5806
5858
|
if market['option']:
|
5807
|
-
response = await self.eapiPrivateDeleteAllOpenOrders(self.extend(request,
|
5859
|
+
response = await self.eapiPrivateDeleteAllOpenOrders(self.extend(request, params))
|
5808
5860
|
elif market['linear']:
|
5809
|
-
|
5861
|
+
if isPortfolioMargin:
|
5862
|
+
if isConditional:
|
5863
|
+
response = await self.papiDeleteUmConditionalAllOpenOrders(self.extend(request, params))
|
5864
|
+
else:
|
5865
|
+
response = await self.papiDeleteUmAllOpenOrders(self.extend(request, params))
|
5866
|
+
else:
|
5867
|
+
response = await self.fapiPrivateDeleteAllOpenOrders(self.extend(request, params))
|
5810
5868
|
elif market['inverse']:
|
5811
|
-
|
5869
|
+
if isPortfolioMargin:
|
5870
|
+
if isConditional:
|
5871
|
+
response = await self.papiDeleteCmConditionalAllOpenOrders(self.extend(request, params))
|
5872
|
+
else:
|
5873
|
+
response = await self.papiDeleteCmAllOpenOrders(self.extend(request, params))
|
5874
|
+
else:
|
5875
|
+
response = await self.dapiPrivateDeleteAllOpenOrders(self.extend(request, params))
|
5812
5876
|
elif (type == 'margin') or (marginMode is not None):
|
5813
|
-
if
|
5814
|
-
|
5815
|
-
|
5877
|
+
if isPortfolioMargin:
|
5878
|
+
response = await self.papiDeleteMarginAllOpenOrders(self.extend(request, params))
|
5879
|
+
else:
|
5880
|
+
if marginMode == 'isolated':
|
5881
|
+
request['isIsolated'] = True
|
5882
|
+
response = await self.sapiDeleteMarginOpenOrders(self.extend(request, params))
|
5816
5883
|
else:
|
5817
|
-
response = await self.privateDeleteOpenOrders(self.extend(request,
|
5884
|
+
response = await self.privateDeleteOpenOrders(self.extend(request, params))
|
5818
5885
|
if isinstance(response, list):
|
5819
5886
|
return self.parse_orders(response, market)
|
5820
5887
|
else:
|
ccxt/async_support/bitfinex2.py
CHANGED
@@ -153,149 +153,149 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
153
153
|
'api': {
|
154
154
|
'public': {
|
155
155
|
'get': {
|
156
|
-
'conf/{config}': 2.
|
157
|
-
'conf/pub:{action}:{object}': 2.
|
158
|
-
'conf/pub:{action}:{object}:{detail}': 2.
|
159
|
-
'conf/pub:map:{object}': 2.
|
160
|
-
'conf/pub:map:{object}:{detail}': 2.
|
161
|
-
'conf/pub:map:currency:{detail}': 2.
|
162
|
-
'conf/pub:map:currency:sym': 2.
|
163
|
-
'conf/pub:map:currency:label': 2.
|
164
|
-
'conf/pub:map:currency:unit': 2.
|
165
|
-
'conf/pub:map:currency:undl': 2.
|
166
|
-
'conf/pub:map:currency:pool': 2.
|
167
|
-
'conf/pub:map:currency:explorer': 2.
|
168
|
-
'conf/pub:map:currency:tx:fee': 2.
|
169
|
-
'conf/pub:map:tx:method': 2.
|
170
|
-
'conf/pub:list:{object}': 2.
|
171
|
-
'conf/pub:list:{object}:{detail}': 2.
|
172
|
-
'conf/pub:list:currency': 2.
|
173
|
-
'conf/pub:list:pair:exchange': 2.
|
174
|
-
'conf/pub:list:pair:margin': 2.
|
175
|
-
'conf/pub:list:pair:futures': 2.
|
176
|
-
'conf/pub:list:competitions': 2.
|
177
|
-
'conf/pub:info:{object}': 2.
|
178
|
-
'conf/pub:info:{object}:{detail}': 2.
|
179
|
-
'conf/pub:info:pair': 2.
|
180
|
-
'conf/pub:info:pair:futures': 2.
|
181
|
-
'conf/pub:info:tx:status': 2.
|
182
|
-
'conf/pub:fees': 2.
|
156
|
+
'conf/{config}': 2.7, # 90 requests a minute, 90/60 = 1.5, 1000 / (250 * 2.66) = 1.503, use 2.7 instead of 2.66 to ensure rateLimitExceeded is not triggered
|
157
|
+
'conf/pub:{action}:{object}': 2.7,
|
158
|
+
'conf/pub:{action}:{object}:{detail}': 2.7,
|
159
|
+
'conf/pub:map:{object}': 2.7,
|
160
|
+
'conf/pub:map:{object}:{detail}': 2.7,
|
161
|
+
'conf/pub:map:currency:{detail}': 2.7,
|
162
|
+
'conf/pub:map:currency:sym': 2.7, # maps symbols to their API symbols, BAB > BCH
|
163
|
+
'conf/pub:map:currency:label': 2.7, # verbose friendly names, BNT > Bancor
|
164
|
+
'conf/pub:map:currency:unit': 2.7, # maps symbols to unit of measure where applicable
|
165
|
+
'conf/pub:map:currency:undl': 2.7, # maps derivatives symbols to their underlying currency
|
166
|
+
'conf/pub:map:currency:pool': 2.7, # maps symbols to underlying network/protocol they operate on
|
167
|
+
'conf/pub:map:currency:explorer': 2.7, # maps symbols to their recognised block explorer URLs
|
168
|
+
'conf/pub:map:currency:tx:fee': 2.7, # maps currencies to their withdrawal fees https://github.com/ccxt/ccxt/issues/7745
|
169
|
+
'conf/pub:map:tx:method': 2.7,
|
170
|
+
'conf/pub:list:{object}': 2.7,
|
171
|
+
'conf/pub:list:{object}:{detail}': 2.7,
|
172
|
+
'conf/pub:list:currency': 2.7,
|
173
|
+
'conf/pub:list:pair:exchange': 2.7,
|
174
|
+
'conf/pub:list:pair:margin': 2.7,
|
175
|
+
'conf/pub:list:pair:futures': 2.7,
|
176
|
+
'conf/pub:list:competitions': 2.7,
|
177
|
+
'conf/pub:info:{object}': 2.7,
|
178
|
+
'conf/pub:info:{object}:{detail}': 2.7,
|
179
|
+
'conf/pub:info:pair': 2.7,
|
180
|
+
'conf/pub:info:pair:futures': 2.7,
|
181
|
+
'conf/pub:info:tx:status': 2.7, # [deposit, withdrawal] statuses 1 = active, 0 = maintenance
|
182
|
+
'conf/pub:fees': 2.7,
|
183
183
|
'platform/status': 8, # 30 requests per minute = 0.5 requests per second =>( 1000ms / rateLimit ) / 0.5 = 8
|
184
|
-
'tickers': 2.
|
185
|
-
'ticker/{symbol}': 2.
|
186
|
-
'tickers/hist': 2.
|
187
|
-
'trades/{symbol}/hist': 2.
|
184
|
+
'tickers': 2.7, # 90 requests a minute = 1.5 requests per second =>( 1000 / rateLimit ) / 1.5 = 2.666666666
|
185
|
+
'ticker/{symbol}': 2.7,
|
186
|
+
'tickers/hist': 2.7,
|
187
|
+
'trades/{symbol}/hist': 2.7,
|
188
188
|
'book/{symbol}/{precision}': 1, # 240 requests a minute
|
189
189
|
'book/{symbol}/P0': 1,
|
190
190
|
'book/{symbol}/P1': 1,
|
191
191
|
'book/{symbol}/P2': 1,
|
192
192
|
'book/{symbol}/P3': 1,
|
193
193
|
'book/{symbol}/R0': 1,
|
194
|
-
'stats1/{key}:{size}:{symbol}:{side}/{section}': 2.
|
195
|
-
'stats1/{key}:{size}:{symbol}:{side}/last': 2.
|
196
|
-
'stats1/{key}:{size}:{symbol}:{side}/hist': 2.
|
197
|
-
'stats1/{key}:{size}:{symbol}/{section}': 2.
|
198
|
-
'stats1/{key}:{size}:{symbol}/last': 2.
|
199
|
-
'stats1/{key}:{size}:{symbol}/hist': 2.
|
200
|
-
'stats1/{key}:{size}:{symbol}:long/last': 2.
|
201
|
-
'stats1/{key}:{size}:{symbol}:long/hist': 2.
|
202
|
-
'stats1/{key}:{size}:{symbol}:short/last': 2.
|
203
|
-
'stats1/{key}:{size}:{symbol}:short/hist': 2.
|
204
|
-
'candles/trade:{timeframe}:{symbol}:{period}/{section}': 2.
|
205
|
-
'candles/trade:{timeframe}:{symbol}/{section}': 2.
|
206
|
-
'candles/trade:{timeframe}:{symbol}/last': 2.
|
207
|
-
'candles/trade:{timeframe}:{symbol}/hist': 2.
|
208
|
-
'status/{type}': 2.
|
209
|
-
'status/deriv': 2.
|
210
|
-
'status/deriv/{symbol}/hist': 2.
|
194
|
+
'stats1/{key}:{size}:{symbol}:{side}/{section}': 2.7,
|
195
|
+
'stats1/{key}:{size}:{symbol}:{side}/last': 2.7,
|
196
|
+
'stats1/{key}:{size}:{symbol}:{side}/hist': 2.7,
|
197
|
+
'stats1/{key}:{size}:{symbol}/{section}': 2.7,
|
198
|
+
'stats1/{key}:{size}:{symbol}/last': 2.7,
|
199
|
+
'stats1/{key}:{size}:{symbol}/hist': 2.7,
|
200
|
+
'stats1/{key}:{size}:{symbol}:long/last': 2.7,
|
201
|
+
'stats1/{key}:{size}:{symbol}:long/hist': 2.7,
|
202
|
+
'stats1/{key}:{size}:{symbol}:short/last': 2.7,
|
203
|
+
'stats1/{key}:{size}:{symbol}:short/hist': 2.7,
|
204
|
+
'candles/trade:{timeframe}:{symbol}:{period}/{section}': 2.7,
|
205
|
+
'candles/trade:{timeframe}:{symbol}/{section}': 2.7,
|
206
|
+
'candles/trade:{timeframe}:{symbol}/last': 2.7,
|
207
|
+
'candles/trade:{timeframe}:{symbol}/hist': 2.7,
|
208
|
+
'status/{type}': 2.7,
|
209
|
+
'status/deriv': 2.7,
|
210
|
+
'status/deriv/{symbol}/hist': 2.7,
|
211
211
|
'liquidations/hist': 80, # 3 requests a minute = 0.05 requests a second =>( 1000ms / rateLimit ) / 0.05 = 80
|
212
|
-
'rankings/{key}:{timeframe}:{symbol}/{section}': 2.
|
213
|
-
'rankings/{key}:{timeframe}:{symbol}/hist': 2.
|
214
|
-
'pulse/hist': 2.
|
215
|
-
'pulse/profile/{nickname}': 2.
|
212
|
+
'rankings/{key}:{timeframe}:{symbol}/{section}': 2.7,
|
213
|
+
'rankings/{key}:{timeframe}:{symbol}/hist': 2.7,
|
214
|
+
'pulse/hist': 2.7,
|
215
|
+
'pulse/profile/{nickname}': 2.7,
|
216
216
|
'funding/stats/{symbol}/hist': 10, # ratelimit not in docs
|
217
217
|
},
|
218
218
|
'post': {
|
219
|
-
'calc/trade/avg': 2.
|
220
|
-
'calc/fx': 2.
|
219
|
+
'calc/trade/avg': 2.7,
|
220
|
+
'calc/fx': 2.7,
|
221
221
|
},
|
222
222
|
},
|
223
223
|
'private': {
|
224
224
|
'post': {
|
225
225
|
# 'auth/r/orders/{symbol}/new', # outdated
|
226
226
|
# 'auth/r/stats/perf:{timeframe}/hist', # outdated
|
227
|
-
'auth/r/wallets': 2.
|
228
|
-
'auth/r/wallets/hist': 2.
|
229
|
-
'auth/r/orders': 2.
|
230
|
-
'auth/r/orders/{symbol}': 2.
|
231
|
-
'auth/w/order/submit': 2.
|
232
|
-
'auth/w/order/update': 2.
|
233
|
-
'auth/w/order/cancel': 2.
|
234
|
-
'auth/w/order/multi': 2.
|
235
|
-
'auth/w/order/cancel/multi': 2.
|
236
|
-
'auth/r/orders/{symbol}/hist': 2.
|
237
|
-
'auth/r/orders/hist': 2.
|
238
|
-
'auth/r/order/{symbol}:{id}/trades': 2.
|
239
|
-
'auth/r/trades/{symbol}/hist': 2.
|
240
|
-
'auth/r/trades/hist': 2.
|
241
|
-
'auth/r/ledgers/{currency}/hist': 2.
|
242
|
-
'auth/r/ledgers/hist': 2.
|
243
|
-
'auth/r/info/margin/{key}': 2.
|
244
|
-
'auth/r/info/margin/base': 2.
|
245
|
-
'auth/r/info/margin/sym_all': 2.
|
246
|
-
'auth/r/positions': 2.
|
247
|
-
'auth/w/position/claim': 2.
|
248
|
-
'auth/w/position/increase:': 2.
|
249
|
-
'auth/r/position/increase/info': 2.
|
250
|
-
'auth/r/positions/hist': 2.
|
251
|
-
'auth/r/positions/audit': 2.
|
252
|
-
'auth/r/positions/snap': 2.
|
253
|
-
'auth/w/deriv/collateral/set': 2.
|
254
|
-
'auth/w/deriv/collateral/limits': 2.
|
255
|
-
'auth/r/funding/offers': 2.
|
256
|
-
'auth/r/funding/offers/{symbol}': 2.
|
257
|
-
'auth/w/funding/offer/submit': 2.
|
258
|
-
'auth/w/funding/offer/cancel': 2.
|
259
|
-
'auth/w/funding/offer/cancel/all': 2.
|
260
|
-
'auth/w/funding/close': 2.
|
261
|
-
'auth/w/funding/auto': 2.
|
262
|
-
'auth/w/funding/keep': 2.
|
263
|
-
'auth/r/funding/offers/{symbol}/hist': 2.
|
264
|
-
'auth/r/funding/offers/hist': 2.
|
265
|
-
'auth/r/funding/loans': 2.
|
266
|
-
'auth/r/funding/loans/hist': 2.
|
267
|
-
'auth/r/funding/loans/{symbol}': 2.
|
268
|
-
'auth/r/funding/loans/{symbol}/hist': 2.
|
269
|
-
'auth/r/funding/credits': 2.
|
270
|
-
'auth/r/funding/credits/hist': 2.
|
271
|
-
'auth/r/funding/credits/{symbol}': 2.
|
272
|
-
'auth/r/funding/credits/{symbol}/hist': 2.
|
273
|
-
'auth/r/funding/trades/{symbol}/hist': 2.
|
274
|
-
'auth/r/funding/trades/hist': 2.
|
275
|
-
'auth/r/info/funding/{key}': 2.
|
276
|
-
'auth/r/info/user': 2.
|
277
|
-
'auth/r/summary': 2.
|
278
|
-
'auth/r/logins/hist': 2.
|
279
|
-
'auth/r/permissions': 2.
|
280
|
-
'auth/w/token': 2.
|
281
|
-
'auth/r/audit/hist': 2.
|
282
|
-
'auth/w/transfer': 2.
|
227
|
+
'auth/r/wallets': 2.7,
|
228
|
+
'auth/r/wallets/hist': 2.7,
|
229
|
+
'auth/r/orders': 2.7,
|
230
|
+
'auth/r/orders/{symbol}': 2.7,
|
231
|
+
'auth/w/order/submit': 2.7,
|
232
|
+
'auth/w/order/update': 2.7,
|
233
|
+
'auth/w/order/cancel': 2.7,
|
234
|
+
'auth/w/order/multi': 2.7,
|
235
|
+
'auth/w/order/cancel/multi': 2.7,
|
236
|
+
'auth/r/orders/{symbol}/hist': 2.7,
|
237
|
+
'auth/r/orders/hist': 2.7,
|
238
|
+
'auth/r/order/{symbol}:{id}/trades': 2.7,
|
239
|
+
'auth/r/trades/{symbol}/hist': 2.7,
|
240
|
+
'auth/r/trades/hist': 2.7,
|
241
|
+
'auth/r/ledgers/{currency}/hist': 2.7,
|
242
|
+
'auth/r/ledgers/hist': 2.7,
|
243
|
+
'auth/r/info/margin/{key}': 2.7,
|
244
|
+
'auth/r/info/margin/base': 2.7,
|
245
|
+
'auth/r/info/margin/sym_all': 2.7,
|
246
|
+
'auth/r/positions': 2.7,
|
247
|
+
'auth/w/position/claim': 2.7,
|
248
|
+
'auth/w/position/increase:': 2.7,
|
249
|
+
'auth/r/position/increase/info': 2.7,
|
250
|
+
'auth/r/positions/hist': 2.7,
|
251
|
+
'auth/r/positions/audit': 2.7,
|
252
|
+
'auth/r/positions/snap': 2.7,
|
253
|
+
'auth/w/deriv/collateral/set': 2.7,
|
254
|
+
'auth/w/deriv/collateral/limits': 2.7,
|
255
|
+
'auth/r/funding/offers': 2.7,
|
256
|
+
'auth/r/funding/offers/{symbol}': 2.7,
|
257
|
+
'auth/w/funding/offer/submit': 2.7,
|
258
|
+
'auth/w/funding/offer/cancel': 2.7,
|
259
|
+
'auth/w/funding/offer/cancel/all': 2.7,
|
260
|
+
'auth/w/funding/close': 2.7,
|
261
|
+
'auth/w/funding/auto': 2.7,
|
262
|
+
'auth/w/funding/keep': 2.7,
|
263
|
+
'auth/r/funding/offers/{symbol}/hist': 2.7,
|
264
|
+
'auth/r/funding/offers/hist': 2.7,
|
265
|
+
'auth/r/funding/loans': 2.7,
|
266
|
+
'auth/r/funding/loans/hist': 2.7,
|
267
|
+
'auth/r/funding/loans/{symbol}': 2.7,
|
268
|
+
'auth/r/funding/loans/{symbol}/hist': 2.7,
|
269
|
+
'auth/r/funding/credits': 2.7,
|
270
|
+
'auth/r/funding/credits/hist': 2.7,
|
271
|
+
'auth/r/funding/credits/{symbol}': 2.7,
|
272
|
+
'auth/r/funding/credits/{symbol}/hist': 2.7,
|
273
|
+
'auth/r/funding/trades/{symbol}/hist': 2.7,
|
274
|
+
'auth/r/funding/trades/hist': 2.7,
|
275
|
+
'auth/r/info/funding/{key}': 2.7,
|
276
|
+
'auth/r/info/user': 2.7,
|
277
|
+
'auth/r/summary': 2.7,
|
278
|
+
'auth/r/logins/hist': 2.7,
|
279
|
+
'auth/r/permissions': 2.7,
|
280
|
+
'auth/w/token': 2.7,
|
281
|
+
'auth/r/audit/hist': 2.7,
|
282
|
+
'auth/w/transfer': 2.7, # ratelimit not in docs...
|
283
283
|
'auth/w/deposit/address': 24, # 10 requests a minute = 0.166 requests per second =>( 1000ms / rateLimit ) / 0.166 = 24
|
284
284
|
'auth/w/deposit/invoice': 24, # ratelimit not in docs
|
285
285
|
'auth/w/withdraw': 24, # ratelimit not in docs
|
286
|
-
'auth/r/movements/{currency}/hist': 2.
|
287
|
-
'auth/r/movements/hist': 2.
|
288
|
-
'auth/r/alerts': 5.
|
289
|
-
'auth/w/alert/set': 2.
|
290
|
-
'auth/w/alert/price:{symbol}:{price}/del': 2.
|
291
|
-
'auth/w/alert/{type}:{symbol}:{price}/del': 2.
|
292
|
-
'auth/calc/order/avail': 2.
|
293
|
-
'auth/w/settings/set': 2.
|
294
|
-
'auth/r/settings': 2.
|
295
|
-
'auth/w/settings/del': 2.
|
296
|
-
'auth/r/pulse/hist': 2.
|
286
|
+
'auth/r/movements/{currency}/hist': 2.7,
|
287
|
+
'auth/r/movements/hist': 2.7,
|
288
|
+
'auth/r/alerts': 5.34, # 45 requests a minute = 0.75 requests per second =>( 1000ms / rateLimit ) / 0.749 => 5.34
|
289
|
+
'auth/w/alert/set': 2.7,
|
290
|
+
'auth/w/alert/price:{symbol}:{price}/del': 2.7,
|
291
|
+
'auth/w/alert/{type}:{symbol}:{price}/del': 2.7,
|
292
|
+
'auth/calc/order/avail': 2.7,
|
293
|
+
'auth/w/settings/set': 2.7,
|
294
|
+
'auth/r/settings': 2.7,
|
295
|
+
'auth/w/settings/del': 2.7,
|
296
|
+
'auth/r/pulse/hist': 2.7,
|
297
297
|
'auth/w/pulse/add': 16, # 15 requests a minute = 0.25 requests per second =>( 1000ms / rateLimit ) / 0.25 => 16
|
298
|
-
'auth/w/pulse/del': 2.
|
298
|
+
'auth/w/pulse/del': 2.7,
|
299
299
|
},
|
300
300
|
},
|
301
301
|
},
|