ccxt 4.1.95__py2.py3-none-any.whl → 4.1.97__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.
Potentially problematic release.
This version of ccxt might be problematic. Click here for more details.
- ccxt/__init__.py +2 -1
- ccxt/abstract/bingx.py +2 -0
- ccxt/abstract/kucoin.py +12 -0
- ccxt/abstract/kucoinfutures.py +12 -1
- ccxt/ace.py +1 -1
- ccxt/ascendex.py +1 -1
- ccxt/async_support/__init__.py +2 -1
- ccxt/async_support/ace.py +1 -1
- ccxt/async_support/ascendex.py +1 -1
- ccxt/async_support/base/exchange.py +29 -23
- ccxt/async_support/bigone.py +2 -2
- ccxt/async_support/binance.py +116 -114
- ccxt/async_support/bingx.py +46 -7
- ccxt/async_support/bit2c.py +2 -3
- ccxt/async_support/bitfinex.py +1 -1
- ccxt/async_support/bitfinex2.py +3 -4
- ccxt/async_support/bitflyer.py +2 -2
- ccxt/async_support/bitmart.py +2 -2
- ccxt/async_support/bitmex.py +2 -2
- ccxt/async_support/bitopro.py +1 -1
- ccxt/async_support/bitpanda.py +1 -1
- ccxt/async_support/bitvavo.py +1 -1
- ccxt/async_support/blockchaincom.py +1 -1
- ccxt/async_support/btcalpha.py +2 -2
- ccxt/async_support/btcbox.py +3 -4
- ccxt/async_support/btcmarkets.py +2 -2
- ccxt/async_support/btcturk.py +1 -1
- ccxt/async_support/bybit.py +2 -2
- ccxt/async_support/cex.py +1 -1
- ccxt/async_support/coinbase.py +11 -5
- ccxt/async_support/coinbasepro.py +2 -2
- ccxt/async_support/coinex.py +1 -1
- ccxt/async_support/coinlist.py +1 -1
- ccxt/async_support/cryptocom.py +2 -1
- ccxt/async_support/delta.py +24 -1
- ccxt/async_support/deribit.py +1 -1
- ccxt/async_support/digifinex.py +1 -1
- ccxt/async_support/gate.py +2 -2
- ccxt/async_support/hitbtc.py +1 -1
- ccxt/async_support/hollaex.py +2 -2
- ccxt/async_support/htx.py +1 -1
- ccxt/async_support/huobijp.py +2 -2
- ccxt/async_support/idex.py +1 -1
- ccxt/async_support/independentreserve.py +1 -1
- ccxt/async_support/kraken.py +45 -41
- ccxt/async_support/krakenfutures.py +46 -23
- ccxt/async_support/kucoin.py +68 -5
- ccxt/async_support/kucoinfutures.py +2 -2
- ccxt/async_support/kuna.py +1 -1
- ccxt/async_support/latoken.py +1 -1
- ccxt/async_support/luno.py +2 -2
- ccxt/async_support/lykke.py +1 -1
- ccxt/async_support/mexc.py +2 -2
- ccxt/async_support/ndax.py +1 -1
- ccxt/async_support/novadax.py +2 -2
- ccxt/async_support/oceanex.py +1 -1
- ccxt/async_support/okcoin.py +1 -1
- ccxt/async_support/okx.py +1 -1
- ccxt/async_support/poloniexfutures.py +1 -1
- ccxt/async_support/probit.py +1 -1
- ccxt/async_support/timex.py +1 -1
- ccxt/async_support/tokocrypto.py +1 -1
- ccxt/async_support/upbit.py +1 -1
- ccxt/async_support/wavesexchange.py +1 -1
- ccxt/async_support/whitebit.py +1 -1
- ccxt/async_support/woo.py +1 -1
- ccxt/async_support/zaif.py +1 -1
- ccxt/base/errors.py +6 -0
- ccxt/base/exchange.py +10 -7
- ccxt/bigone.py +2 -2
- ccxt/binance.py +116 -114
- ccxt/bingx.py +46 -7
- ccxt/bit2c.py +2 -3
- ccxt/bitfinex.py +1 -1
- ccxt/bitfinex2.py +3 -4
- ccxt/bitflyer.py +2 -2
- ccxt/bitmart.py +2 -2
- ccxt/bitmex.py +2 -2
- ccxt/bitopro.py +1 -1
- ccxt/bitpanda.py +1 -1
- ccxt/bitvavo.py +1 -1
- ccxt/blockchaincom.py +1 -1
- ccxt/btcalpha.py +2 -2
- ccxt/btcbox.py +3 -4
- ccxt/btcmarkets.py +2 -2
- ccxt/btcturk.py +1 -1
- ccxt/bybit.py +2 -2
- ccxt/cex.py +1 -1
- ccxt/coinbase.py +11 -5
- ccxt/coinbasepro.py +2 -2
- ccxt/coinex.py +1 -1
- ccxt/coinlist.py +1 -1
- ccxt/cryptocom.py +2 -1
- ccxt/delta.py +24 -1
- ccxt/deribit.py +1 -1
- ccxt/digifinex.py +1 -1
- ccxt/gate.py +2 -2
- ccxt/hitbtc.py +1 -1
- ccxt/hollaex.py +2 -2
- ccxt/htx.py +1 -1
- ccxt/huobijp.py +2 -2
- ccxt/idex.py +1 -1
- ccxt/independentreserve.py +1 -1
- ccxt/kraken.py +45 -41
- ccxt/krakenfutures.py +46 -23
- ccxt/kucoin.py +68 -5
- ccxt/kucoinfutures.py +2 -2
- ccxt/kuna.py +1 -1
- ccxt/latoken.py +1 -1
- ccxt/luno.py +2 -2
- ccxt/lykke.py +1 -1
- ccxt/mexc.py +2 -2
- ccxt/ndax.py +1 -1
- ccxt/novadax.py +2 -2
- ccxt/oceanex.py +1 -1
- ccxt/okcoin.py +1 -1
- ccxt/okx.py +1 -1
- ccxt/poloniexfutures.py +1 -1
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/alpaca.py +1 -1
- ccxt/pro/ascendex.py +1 -1
- ccxt/pro/binance.py +5 -6
- ccxt/pro/bingx.py +6 -3
- ccxt/pro/bitfinex.py +3 -4
- ccxt/pro/bitfinex2.py +1 -1
- ccxt/pro/bitmex.py +1 -1
- ccxt/pro/bitpanda.py +1 -1
- ccxt/pro/blockchaincom.py +1 -1
- ccxt/pro/bybit.py +2 -2
- ccxt/pro/cex.py +1 -1
- ccxt/pro/coinbase.py +1 -1
- ccxt/pro/coinbasepro.py +1 -1
- ccxt/pro/cryptocom.py +1 -1
- ccxt/pro/deribit.py +1 -1
- ccxt/pro/gate.py +3 -3
- ccxt/pro/gemini.py +1 -1
- ccxt/pro/hitbtc.py +1 -1
- ccxt/pro/hollaex.py +1 -1
- ccxt/pro/htx.py +1 -1
- ccxt/pro/idex.py +1 -1
- ccxt/pro/kraken.py +3 -4
- ccxt/pro/krakenfutures.py +1 -1
- ccxt/pro/kucoinfutures.py +1 -1
- ccxt/pro/mexc.py +1 -1
- ccxt/pro/okcoin.py +1 -1
- ccxt/pro/okx.py +4 -4
- ccxt/pro/phemex.py +1 -1
- ccxt/pro/poloniexfutures.py +1 -1
- ccxt/pro/woo.py +2 -3
- ccxt/probit.py +1 -1
- ccxt/test/test_async.py +3 -1
- ccxt/test/test_sync.py +3 -1
- ccxt/timex.py +1 -1
- ccxt/tokocrypto.py +1 -1
- ccxt/upbit.py +1 -1
- ccxt/wavesexchange.py +1 -1
- ccxt/whitebit.py +1 -1
- ccxt/woo.py +1 -1
- ccxt/zaif.py +1 -1
- {ccxt-4.1.95.dist-info → ccxt-4.1.97.dist-info}/METADATA +4 -4
- {ccxt-4.1.95.dist-info → ccxt-4.1.97.dist-info}/RECORD +163 -163
- {ccxt-4.1.95.dist-info → ccxt-4.1.97.dist-info}/WHEEL +0 -0
- {ccxt-4.1.95.dist-info → ccxt-4.1.97.dist-info}/top_level.txt +0 -0
ccxt/async_support/binance.py
CHANGED
@@ -2504,22 +2504,21 @@ class binance(Exchange, ImplicitAPI):
|
|
2504
2504
|
type = self.safe_string(params, 'type', defaultType)
|
2505
2505
|
subType = None
|
2506
2506
|
subType, params = self.handle_sub_type_and_params('fetchBalance', None, params)
|
2507
|
+
marginMode = None
|
2508
|
+
query = None
|
2507
2509
|
marginMode, query = self.handle_margin_mode_and_params('fetchBalance', params)
|
2508
|
-
|
2510
|
+
query = self.omit(query, 'type')
|
2511
|
+
response = None
|
2509
2512
|
request = {}
|
2510
2513
|
if self.is_linear(type, subType):
|
2511
|
-
options = self.safe_value(self.options, type, {})
|
2512
|
-
fetchBalanceOptions = self.safe_value(options, 'fetchBalance', {})
|
2513
|
-
method = self.safe_string(fetchBalanceOptions, 'method', 'fapiPrivateV2GetAccount')
|
2514
2514
|
type = 'linear'
|
2515
|
+
response = await self.fapiPrivateV2GetAccount(self.extend(request, query))
|
2515
2516
|
elif self.is_inverse(type, subType):
|
2516
|
-
options = self.safe_value(self.options, type, {})
|
2517
|
-
fetchBalanceOptions = self.safe_value(options, 'fetchBalance', {})
|
2518
|
-
method = self.safe_string(fetchBalanceOptions, 'method', 'dapiPrivateGetAccount')
|
2519
2517
|
type = 'inverse'
|
2518
|
+
response = await self.dapiPrivateGetAccount(self.extend(request, query))
|
2520
2519
|
elif marginMode == 'isolated':
|
2521
|
-
method = 'sapiGetMarginIsolatedAccount'
|
2522
2520
|
paramSymbols = self.safe_value(params, 'symbols')
|
2521
|
+
query = self.omit(query, 'symbols')
|
2523
2522
|
if paramSymbols is not None:
|
2524
2523
|
symbols = ''
|
2525
2524
|
if isinstance(paramSymbols, list):
|
@@ -2531,14 +2530,15 @@ class binance(Exchange, ImplicitAPI):
|
|
2531
2530
|
else:
|
2532
2531
|
symbols = paramSymbols
|
2533
2532
|
request['symbols'] = symbols
|
2533
|
+
response = await self.sapiGetMarginIsolatedAccount(self.extend(request, query))
|
2534
2534
|
elif (type == 'margin') or (marginMode == 'cross'):
|
2535
|
-
|
2535
|
+
response = await self.sapiGetMarginAccount(self.extend(request, query))
|
2536
2536
|
elif type == 'savings':
|
2537
|
-
|
2537
|
+
response = await self.sapiGetLendingUnionAccount(self.extend(request, query))
|
2538
2538
|
elif type == 'funding':
|
2539
|
-
|
2540
|
-
|
2541
|
-
|
2539
|
+
response = await self.sapiPostAssetGetFundingAsset(self.extend(request, query))
|
2540
|
+
else:
|
2541
|
+
response = await self.privateGetAccount(self.extend(request, query))
|
2542
2542
|
#
|
2543
2543
|
# spot
|
2544
2544
|
#
|
@@ -3185,24 +3185,25 @@ class binance(Exchange, ImplicitAPI):
|
|
3185
3185
|
request['endTime'] = min(now, endTime)
|
3186
3186
|
if until is not None:
|
3187
3187
|
request['endTime'] = until
|
3188
|
-
|
3188
|
+
response = None
|
3189
3189
|
if market['option']:
|
3190
|
-
|
3190
|
+
response = await self.eapiPublicGetKlines(self.extend(request, params))
|
3191
3191
|
elif price == 'mark':
|
3192
3192
|
if market['inverse']:
|
3193
|
-
|
3193
|
+
response = await self.dapiPublicGetMarkPriceKlines(self.extend(request, params))
|
3194
3194
|
else:
|
3195
|
-
|
3195
|
+
response = await self.fapiPublicGetMarkPriceKlines(self.extend(request, params))
|
3196
3196
|
elif price == 'index':
|
3197
3197
|
if market['inverse']:
|
3198
|
-
|
3198
|
+
response = await self.dapiPublicGetIndexPriceKlines(self.extend(request, params))
|
3199
3199
|
else:
|
3200
|
-
|
3200
|
+
response = await self.fapiPublicGetIndexPriceKlines(self.extend(request, params))
|
3201
3201
|
elif market['linear']:
|
3202
|
-
|
3202
|
+
response = await self.fapiPublicGetKlines(self.extend(request, params))
|
3203
3203
|
elif market['inverse']:
|
3204
|
-
|
3205
|
-
|
3204
|
+
response = await self.dapiPublicGetKlines(self.extend(request, params))
|
3205
|
+
else:
|
3206
|
+
response = await self.publicGetKlines(self.extend(request, params))
|
3206
3207
|
#
|
3207
3208
|
# [
|
3208
3209
|
# [1591478520000,"0.02501300","0.02501800","0.02500000","0.02500000","22.19000000",1591478579999,"0.55490906",40,"10.92900000","0.27336462","0"],
|
@@ -4458,17 +4459,6 @@ class binance(Exchange, ImplicitAPI):
|
|
4458
4459
|
request = {
|
4459
4460
|
'symbol': market['id'],
|
4460
4461
|
}
|
4461
|
-
method = 'privateGetOrder'
|
4462
|
-
if market['option']:
|
4463
|
-
method = 'eapiPrivateGetOrder'
|
4464
|
-
elif market['linear']:
|
4465
|
-
method = 'fapiPrivateGetOrder'
|
4466
|
-
elif market['inverse']:
|
4467
|
-
method = 'dapiPrivateGetOrder'
|
4468
|
-
elif type == 'margin' or marginMode is not None:
|
4469
|
-
method = 'sapiGetMarginOrder'
|
4470
|
-
if marginMode == 'isolated':
|
4471
|
-
request['isIsolated'] = True
|
4472
4462
|
clientOrderId = self.safe_value_2(params, 'origClientOrderId', 'clientOrderId')
|
4473
4463
|
if clientOrderId is not None:
|
4474
4464
|
if market['option']:
|
@@ -4478,7 +4468,19 @@ class binance(Exchange, ImplicitAPI):
|
|
4478
4468
|
else:
|
4479
4469
|
request['orderId'] = id
|
4480
4470
|
requestParams = self.omit(query, ['type', 'clientOrderId', 'origClientOrderId'])
|
4481
|
-
response =
|
4471
|
+
response = None
|
4472
|
+
if market['option']:
|
4473
|
+
response = await self.eapiPrivateGetOrder(self.extend(request, requestParams))
|
4474
|
+
elif market['linear']:
|
4475
|
+
response = await self.fapiPrivateGetOrder(self.extend(request, requestParams))
|
4476
|
+
elif market['inverse']:
|
4477
|
+
response = await self.dapiPrivateGetOrder(self.extend(request, requestParams))
|
4478
|
+
elif type == 'margin' or marginMode is not None:
|
4479
|
+
if marginMode == 'isolated':
|
4480
|
+
request['isIsolated'] = True
|
4481
|
+
response = await self.sapiGetMarginOrder(self.extend(request, requestParams))
|
4482
|
+
else:
|
4483
|
+
response = await self.privateGetOrder(self.extend(request, requestParams))
|
4482
4484
|
return self.parse_order(response, market)
|
4483
4485
|
|
4484
4486
|
async def fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
@@ -4512,17 +4514,6 @@ class binance(Exchange, ImplicitAPI):
|
|
4512
4514
|
request = {
|
4513
4515
|
'symbol': market['id'],
|
4514
4516
|
}
|
4515
|
-
method = 'privateGetAllOrders'
|
4516
|
-
if market['option']:
|
4517
|
-
method = 'eapiPrivateGetHistoryOrders'
|
4518
|
-
elif market['linear']:
|
4519
|
-
method = 'fapiPrivateGetAllOrders'
|
4520
|
-
elif market['inverse']:
|
4521
|
-
method = 'dapiPrivateGetAllOrders'
|
4522
|
-
elif type == 'margin' or marginMode is not None:
|
4523
|
-
method = 'sapiGetMarginAllOrders'
|
4524
|
-
if marginMode == 'isolated':
|
4525
|
-
request['isIsolated'] = True
|
4526
4517
|
until = self.safe_integer(params, 'until')
|
4527
4518
|
if until is not None:
|
4528
4519
|
params = self.omit(params, 'until')
|
@@ -4531,7 +4522,19 @@ class binance(Exchange, ImplicitAPI):
|
|
4531
4522
|
request['startTime'] = since
|
4532
4523
|
if limit is not None:
|
4533
4524
|
request['limit'] = limit
|
4534
|
-
response =
|
4525
|
+
response = None
|
4526
|
+
if market['option']:
|
4527
|
+
response = await self.eapiPrivateGetHistoryOrders(self.extend(request, query))
|
4528
|
+
elif market['linear']:
|
4529
|
+
response = await self.fapiPrivateGetAllOrders(self.extend(request, query))
|
4530
|
+
elif market['inverse']:
|
4531
|
+
response = await self.dapiPrivateGetAllOrders(self.extend(request, query))
|
4532
|
+
elif type == 'margin' or marginMode is not None:
|
4533
|
+
if marginMode == 'isolated':
|
4534
|
+
request['isIsolated'] = True
|
4535
|
+
response = await self.sapiGetMarginAllOrders(self.extend(request, query))
|
4536
|
+
else:
|
4537
|
+
response = await self.privateGetAllOrders(self.extend(request, query))
|
4535
4538
|
#
|
4536
4539
|
# spot
|
4537
4540
|
#
|
@@ -4651,24 +4654,25 @@ class binance(Exchange, ImplicitAPI):
|
|
4651
4654
|
subType = None
|
4652
4655
|
subType, query = self.handle_sub_type_and_params('fetchOpenOrders', market, query)
|
4653
4656
|
requestParams = self.omit(query, 'type')
|
4654
|
-
|
4657
|
+
response = None
|
4655
4658
|
if type == 'option':
|
4656
|
-
method = 'eapiPrivateGetOpenOrders'
|
4657
4659
|
if since is not None:
|
4658
4660
|
request['startTime'] = since
|
4659
4661
|
if limit is not None:
|
4660
4662
|
request['limit'] = limit
|
4663
|
+
response = await self.eapiPrivateGetOpenOrders(self.extend(request, requestParams))
|
4661
4664
|
elif self.is_linear(type, subType):
|
4662
|
-
|
4665
|
+
response = await self.fapiPrivateGetOpenOrders(self.extend(request, requestParams))
|
4663
4666
|
elif self.is_inverse(type, subType):
|
4664
|
-
|
4667
|
+
response = await self.dapiPrivateGetOpenOrders(self.extend(request, requestParams))
|
4665
4668
|
elif type == 'margin' or marginMode is not None:
|
4666
|
-
method = 'sapiGetMarginOpenOrders'
|
4667
4669
|
if marginMode == 'isolated':
|
4668
4670
|
request['isIsolated'] = True
|
4669
4671
|
if symbol is None:
|
4670
4672
|
raise ArgumentsRequired(self.id + ' fetchOpenOrders() requires a symbol argument for isolated markets')
|
4671
|
-
|
4673
|
+
response = await self.sapiGetMarginOpenOrders(self.extend(request, requestParams))
|
4674
|
+
else:
|
4675
|
+
response = await self.privateGetOpenOrders(self.extend(request, requestParams))
|
4672
4676
|
return self.parse_orders(response, market, since, limit)
|
4673
4677
|
|
4674
4678
|
async def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
@@ -4746,19 +4750,20 @@ class binance(Exchange, ImplicitAPI):
|
|
4746
4750
|
request['origClientOrderId'] = clientOrderId
|
4747
4751
|
else:
|
4748
4752
|
request['orderId'] = id
|
4749
|
-
|
4753
|
+
requestParams = self.omit(query, ['type', 'origClientOrderId', 'clientOrderId'])
|
4754
|
+
response = None
|
4750
4755
|
if market['option']:
|
4751
|
-
|
4756
|
+
response = await self.eapiPrivateDeleteOrder(self.extend(request, requestParams))
|
4752
4757
|
elif market['linear']:
|
4753
|
-
|
4758
|
+
response = await self.fapiPrivateDeleteOrder(self.extend(request, requestParams))
|
4754
4759
|
elif market['inverse']:
|
4755
|
-
|
4760
|
+
response = await self.dapiPrivateDeleteOrder(self.extend(request, requestParams))
|
4756
4761
|
elif type == 'margin' or marginMode is not None:
|
4757
|
-
method = 'sapiDeleteMarginOrder'
|
4758
4762
|
if marginMode == 'isolated':
|
4759
4763
|
request['isIsolated'] = True
|
4760
|
-
|
4761
|
-
|
4764
|
+
response = await self.sapiDeleteMarginOrder(self.extend(request, requestParams))
|
4765
|
+
else:
|
4766
|
+
response = await self.privateDeleteOrder(self.extend(request, requestParams))
|
4762
4767
|
return self.parse_order(response, market)
|
4763
4768
|
|
4764
4769
|
async def cancel_all_orders(self, symbol: Str = None, params={}):
|
@@ -4784,18 +4789,19 @@ class binance(Exchange, ImplicitAPI):
|
|
4784
4789
|
type = self.safe_string(params, 'type', market['type'])
|
4785
4790
|
params = self.omit(params, ['type'])
|
4786
4791
|
marginMode, query = self.handle_margin_mode_and_params('cancelAllOrders', params)
|
4787
|
-
|
4792
|
+
response = None
|
4788
4793
|
if market['option']:
|
4789
|
-
|
4794
|
+
response = await self.eapiPrivateDeleteAllOpenOrders(self.extend(request, query))
|
4790
4795
|
elif market['linear']:
|
4791
|
-
|
4796
|
+
response = await self.fapiPrivateDeleteAllOpenOrders(self.extend(request, query))
|
4792
4797
|
elif market['inverse']:
|
4793
|
-
|
4798
|
+
response = await self.dapiPrivateDeleteAllOpenOrders(self.extend(request, query))
|
4794
4799
|
elif (type == 'margin') or (marginMode is not None):
|
4795
|
-
method = 'sapiDeleteMarginOpenOrders'
|
4796
4800
|
if marginMode == 'isolated':
|
4797
4801
|
request['isIsolated'] = True
|
4798
|
-
|
4802
|
+
response = await self.sapiDeleteMarginOpenOrders(self.extend(request, query))
|
4803
|
+
else:
|
4804
|
+
response = await self.privateDeleteOpenOrders(self.extend(request, query))
|
4799
4805
|
if isinstance(response, list):
|
4800
4806
|
return self.parse_orders(response, market)
|
4801
4807
|
else:
|
@@ -4917,28 +4923,11 @@ class binance(Exchange, ImplicitAPI):
|
|
4917
4923
|
request = {}
|
4918
4924
|
market = None
|
4919
4925
|
type = None
|
4920
|
-
method = None
|
4921
4926
|
marginMode = None
|
4922
4927
|
if symbol is not None:
|
4923
4928
|
market = self.market(symbol)
|
4924
4929
|
request['symbol'] = market['id']
|
4925
4930
|
type, params = self.handle_market_type_and_params('fetchMyTrades', market, params)
|
4926
|
-
if type == 'option':
|
4927
|
-
method = 'eapiPrivateGetUserTrades'
|
4928
|
-
else:
|
4929
|
-
if symbol is None:
|
4930
|
-
raise ArgumentsRequired(self.id + ' fetchMyTrades() requires a symbol argument')
|
4931
|
-
marginMode, params = self.handle_margin_mode_and_params('fetchMyTrades', params)
|
4932
|
-
if type == 'spot' or type == 'margin':
|
4933
|
-
method = 'privateGetMyTrades'
|
4934
|
-
if (type == 'margin') or (marginMode is not None):
|
4935
|
-
method = 'sapiGetMarginMyTrades'
|
4936
|
-
if marginMode == 'isolated':
|
4937
|
-
request['isIsolated'] = True
|
4938
|
-
elif market['linear']:
|
4939
|
-
method = 'fapiPrivateGetUserTrades'
|
4940
|
-
elif market['inverse']:
|
4941
|
-
method = 'dapiPrivateGetUserTrades'
|
4942
4931
|
endTime = self.safe_integer_2(params, 'until', 'endTime')
|
4943
4932
|
if since is not None:
|
4944
4933
|
startTime = since
|
@@ -4960,7 +4949,24 @@ class binance(Exchange, ImplicitAPI):
|
|
4960
4949
|
if (type == 'option') or market['contract']:
|
4961
4950
|
limit = min(limit, 1000) # above 1000, returns error
|
4962
4951
|
request['limit'] = limit
|
4963
|
-
response =
|
4952
|
+
response = None
|
4953
|
+
if type == 'option':
|
4954
|
+
response = await self.eapiPrivateGetUserTrades(self.extend(request, params))
|
4955
|
+
else:
|
4956
|
+
if symbol is None:
|
4957
|
+
raise ArgumentsRequired(self.id + ' fetchMyTrades() requires a symbol argument')
|
4958
|
+
marginMode, params = self.handle_margin_mode_and_params('fetchMyTrades', params)
|
4959
|
+
if type == 'spot' or type == 'margin':
|
4960
|
+
if (type == 'margin') or (marginMode is not None):
|
4961
|
+
if marginMode == 'isolated':
|
4962
|
+
request['isIsolated'] = True
|
4963
|
+
response = await self.sapiGetMarginMyTrades(self.extend(request, params))
|
4964
|
+
else:
|
4965
|
+
response = await self.privateGetMyTrades(self.extend(request, params))
|
4966
|
+
elif market['linear']:
|
4967
|
+
response = await self.fapiPrivateGetUserTrades(self.extend(request, params))
|
4968
|
+
elif market['inverse']:
|
4969
|
+
response = await self.dapiPrivateGetUserTrades(self.extend(request, params))
|
4964
4970
|
#
|
4965
4971
|
# spot trade
|
4966
4972
|
#
|
@@ -6190,7 +6196,6 @@ class binance(Exchange, ImplicitAPI):
|
|
6190
6196
|
:returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>` indexed by market symbols
|
6191
6197
|
"""
|
6192
6198
|
await self.load_markets()
|
6193
|
-
method = None
|
6194
6199
|
type = None
|
6195
6200
|
type, params = self.handle_market_type_and_params('fetchTradingFees', None, params)
|
6196
6201
|
subType = None
|
@@ -6198,13 +6203,13 @@ class binance(Exchange, ImplicitAPI):
|
|
6198
6203
|
isSpotOrMargin = (type == 'spot') or (type == 'margin')
|
6199
6204
|
isLinear = self.is_linear(type, subType)
|
6200
6205
|
isInverse = self.is_inverse(type, subType)
|
6206
|
+
response = None
|
6201
6207
|
if isSpotOrMargin:
|
6202
|
-
|
6208
|
+
response = await self.sapiGetAssetTradeFee(params)
|
6203
6209
|
elif isLinear:
|
6204
|
-
|
6210
|
+
response = await self.fapiPrivateV2GetAccount(params)
|
6205
6211
|
elif isInverse:
|
6206
|
-
|
6207
|
-
response = await getattr(self, method)(params)
|
6212
|
+
response = await self.dapiPrivateGetAccount(params)
|
6208
6213
|
#
|
6209
6214
|
# sapi / spot
|
6210
6215
|
#
|
@@ -6389,14 +6394,13 @@ class binance(Exchange, ImplicitAPI):
|
|
6389
6394
|
request = {
|
6390
6395
|
'symbol': market['id'],
|
6391
6396
|
}
|
6392
|
-
|
6397
|
+
response = None
|
6393
6398
|
if market['linear']:
|
6394
|
-
|
6399
|
+
response = await self.fapiPublicGetPremiumIndex(self.extend(request, params))
|
6395
6400
|
elif market['inverse']:
|
6396
|
-
|
6401
|
+
response = await self.dapiPublicGetPremiumIndex(self.extend(request, params))
|
6397
6402
|
else:
|
6398
6403
|
raise NotSupported(self.id + ' fetchFundingRate() supports linear and inverse contracts only')
|
6399
|
-
response = await getattr(self, method)(self.extend(request, params))
|
6400
6404
|
if market['inverse']:
|
6401
6405
|
response = response[0]
|
6402
6406
|
#
|
@@ -6972,17 +6976,17 @@ class binance(Exchange, ImplicitAPI):
|
|
6972
6976
|
:returns dict: a dictionary of `leverage tiers structures <https://docs.ccxt.com/#/?id=leverage-tiers-structure>`, indexed by market symbols
|
6973
6977
|
"""
|
6974
6978
|
await self.load_markets()
|
6975
|
-
type
|
6979
|
+
type = None
|
6980
|
+
type, params = self.handle_market_type_and_params('fetchLeverageTiers', None, params)
|
6976
6981
|
subType = None
|
6977
|
-
subType, params = self.handle_sub_type_and_params('fetchLeverageTiers', None,
|
6978
|
-
|
6982
|
+
subType, params = self.handle_sub_type_and_params('fetchLeverageTiers', None, params, 'linear')
|
6983
|
+
response = None
|
6979
6984
|
if self.is_linear(type, subType):
|
6980
|
-
|
6985
|
+
response = await self.fapiPrivateGetLeverageBracket(params)
|
6981
6986
|
elif self.is_inverse(type, subType):
|
6982
|
-
|
6987
|
+
response = await self.dapiPrivateV2GetLeverageBracket(params)
|
6983
6988
|
else:
|
6984
6989
|
raise NotSupported(self.id + ' fetchLeverageTiers() supports linear and inverse contracts only')
|
6985
|
-
response = await getattr(self, method)(query)
|
6986
6990
|
#
|
6987
6991
|
# usdm
|
6988
6992
|
#
|
@@ -7409,18 +7413,18 @@ class binance(Exchange, ImplicitAPI):
|
|
7409
7413
|
raise BadRequest(self.id + ' leverage should be between 1 and 125')
|
7410
7414
|
await self.load_markets()
|
7411
7415
|
market = self.market(symbol)
|
7412
|
-
method: str
|
7413
|
-
if market['linear']:
|
7414
|
-
method = 'fapiPrivatePostLeverage'
|
7415
|
-
elif market['inverse']:
|
7416
|
-
method = 'dapiPrivatePostLeverage'
|
7417
|
-
else:
|
7418
|
-
raise NotSupported(self.id + ' setLeverage() supports linear and inverse contracts only')
|
7419
7416
|
request = {
|
7420
7417
|
'symbol': market['id'],
|
7421
7418
|
'leverage': leverage,
|
7422
7419
|
}
|
7423
|
-
|
7420
|
+
response = None
|
7421
|
+
if market['linear']:
|
7422
|
+
response = await self.fapiPrivatePostLeverage(self.extend(request, params))
|
7423
|
+
elif market['inverse']:
|
7424
|
+
response = await self.dapiPrivatePostLeverage(self.extend(request, params))
|
7425
|
+
else:
|
7426
|
+
raise NotSupported(self.id + ' setLeverage() supports linear and inverse contracts only')
|
7427
|
+
return response
|
7424
7428
|
|
7425
7429
|
async def set_margin_mode(self, marginMode: str, symbol: Str = None, params={}):
|
7426
7430
|
"""
|
@@ -7448,20 +7452,18 @@ class binance(Exchange, ImplicitAPI):
|
|
7448
7452
|
raise BadRequest(self.id + ' marginMode must be either isolated or cross')
|
7449
7453
|
await self.load_markets()
|
7450
7454
|
market = self.market(symbol)
|
7451
|
-
method = None
|
7452
|
-
if market['linear']:
|
7453
|
-
method = 'fapiPrivatePostMarginType'
|
7454
|
-
elif market['inverse']:
|
7455
|
-
method = 'dapiPrivatePostMarginType'
|
7456
|
-
else:
|
7457
|
-
raise NotSupported(self.id + ' setMarginMode() supports linear and inverse contracts only')
|
7458
7455
|
request = {
|
7459
7456
|
'symbol': market['id'],
|
7460
7457
|
'marginType': marginMode,
|
7461
7458
|
}
|
7462
7459
|
response = None
|
7463
7460
|
try:
|
7464
|
-
|
7461
|
+
if market['linear']:
|
7462
|
+
response = await self.fapiPrivatePostMarginType(self.extend(request, params))
|
7463
|
+
elif market['inverse']:
|
7464
|
+
response = await self.dapiPrivatePostMarginType(self.extend(request, params))
|
7465
|
+
else:
|
7466
|
+
raise NotSupported(self.id + ' setMarginMode() supports linear and inverse contracts only')
|
7465
7467
|
except Exception as e:
|
7466
7468
|
# not an error
|
7467
7469
|
# https://github.com/ccxt/ccxt/issues/11268
|
ccxt/async_support/bingx.py
CHANGED
@@ -158,6 +158,16 @@ class bingx(Exchange, ImplicitAPI):
|
|
158
158
|
},
|
159
159
|
},
|
160
160
|
'swap': {
|
161
|
+
'v1': {
|
162
|
+
'private': {
|
163
|
+
'get': {
|
164
|
+
'positionSide/dual': 1,
|
165
|
+
},
|
166
|
+
'post': {
|
167
|
+
'positionSide/dual': 1,
|
168
|
+
},
|
169
|
+
},
|
170
|
+
},
|
161
171
|
'v2': {
|
162
172
|
'public': {
|
163
173
|
'get': {
|
@@ -344,6 +354,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
344
354
|
'100202': InsufficientFunds,
|
345
355
|
'100204': BadRequest,
|
346
356
|
'100400': BadRequest,
|
357
|
+
'100421': BadSymbol, # {"code":100421,"msg":"This pair is currently restricted from API trading","debugMsg":""}
|
347
358
|
'100440': ExchangeError,
|
348
359
|
'100500': ExchangeError,
|
349
360
|
'100503': ExchangeError,
|
@@ -1261,7 +1272,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1261
1272
|
# }
|
1262
1273
|
#
|
1263
1274
|
marketId = self.safe_string(ticker, 'symbol')
|
1264
|
-
change = self.safe_string(ticker, 'priceChange')
|
1275
|
+
# change = self.safe_string(ticker, 'priceChange') # self is not ccxt's change because it does high-low instead of last-open
|
1265
1276
|
lastQty = self.safe_string(ticker, 'lastQty')
|
1266
1277
|
# in spot markets, lastQty is not present
|
1267
1278
|
# it's(bad, but) the only way we can check the tickers origin
|
@@ -1273,9 +1284,10 @@ class bingx(Exchange, ImplicitAPI):
|
|
1273
1284
|
close = self.safe_string(ticker, 'lastPrice')
|
1274
1285
|
quoteVolume = self.safe_string(ticker, 'quoteVolume')
|
1275
1286
|
baseVolume = self.safe_string(ticker, 'volume')
|
1276
|
-
percentage = self.safe_string(ticker, 'priceChangePercent')
|
1277
|
-
if percentage is not None:
|
1278
|
-
|
1287
|
+
# percentage = self.safe_string(ticker, 'priceChangePercent')
|
1288
|
+
# if percentage is not None:
|
1289
|
+
# percentage = percentage.replace('%', '')
|
1290
|
+
# } similarly to change, it's not ccxt's percentage because it does priceChange/open, and priceChange is high-low
|
1279
1291
|
ts = self.safe_integer(ticker, 'closeTime')
|
1280
1292
|
datetime = self.iso8601(ts)
|
1281
1293
|
bid = self.safe_string(ticker, 'bidPrice')
|
@@ -1297,8 +1309,8 @@ class bingx(Exchange, ImplicitAPI):
|
|
1297
1309
|
'close': close,
|
1298
1310
|
'last': None,
|
1299
1311
|
'previousClose': None,
|
1300
|
-
'change':
|
1301
|
-
'percentage':
|
1312
|
+
'change': None,
|
1313
|
+
'percentage': None,
|
1302
1314
|
'average': None,
|
1303
1315
|
'baseVolume': baseVolume,
|
1304
1316
|
'quoteVolume': quoteVolume,
|
@@ -2335,7 +2347,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
2335
2347
|
:see: https://bingx-api.github.io/docs/#/standard/contract-interface.html#Historical%20order
|
2336
2348
|
:param str [symbol]: unified market symbol of the market orders were made in
|
2337
2349
|
:param int [since]: the earliest time in ms to fetch orders for
|
2338
|
-
:param int [limit]: the maximum number of
|
2350
|
+
:param int [limit]: the maximum number of order structures to retrieve
|
2339
2351
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2340
2352
|
:param int [params.until]: the latest time in ms to fetch orders for
|
2341
2353
|
:param boolean [params.standard]: whether to fetch standard contract orders
|
@@ -3210,6 +3222,33 @@ class bingx(Exchange, ImplicitAPI):
|
|
3210
3222
|
positions.append(position)
|
3211
3223
|
return positions
|
3212
3224
|
|
3225
|
+
async def set_position_mode(self, hedged, symbol: Str = None, params={}):
|
3226
|
+
"""
|
3227
|
+
set hedged to True or False for a market
|
3228
|
+
:see: https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Set%20Position%20Mode
|
3229
|
+
:param bool hedged: set to True to use dualSidePosition
|
3230
|
+
:param str symbol: not used by bingx setPositionMode()
|
3231
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3232
|
+
:returns dict: response from the exchange
|
3233
|
+
"""
|
3234
|
+
dualSidePosition = None
|
3235
|
+
if hedged:
|
3236
|
+
dualSidePosition = 'true'
|
3237
|
+
else:
|
3238
|
+
dualSidePosition = 'false'
|
3239
|
+
request = {
|
3240
|
+
'dualSidePosition': dualSidePosition,
|
3241
|
+
}
|
3242
|
+
#
|
3243
|
+
# {
|
3244
|
+
# code: '0',
|
3245
|
+
# msg: '',
|
3246
|
+
# timeStamp: '1703327432734',
|
3247
|
+
# data: {dualSidePosition: 'false'}
|
3248
|
+
# }
|
3249
|
+
#
|
3250
|
+
return await self.swapV1PrivatePostPositionSideDual(self.extend(request, params))
|
3251
|
+
|
3213
3252
|
def sign(self, path, section='public', method='GET', params={}, headers=None, body=None):
|
3214
3253
|
type = section[0]
|
3215
3254
|
version = section[1]
|
ccxt/async_support/bit2c.py
CHANGED
@@ -278,14 +278,13 @@ class bit2c(Exchange, ImplicitAPI):
|
|
278
278
|
|
279
279
|
def parse_ticker(self, ticker, market: Market = None) -> Ticker:
|
280
280
|
symbol = self.safe_symbol(None, market)
|
281
|
-
timestamp = self.milliseconds()
|
282
281
|
averagePrice = self.safe_string(ticker, 'av')
|
283
282
|
baseVolume = self.safe_string(ticker, 'a')
|
284
283
|
last = self.safe_string(ticker, 'll')
|
285
284
|
return self.safe_ticker({
|
286
285
|
'symbol': symbol,
|
287
|
-
'timestamp':
|
288
|
-
'datetime':
|
286
|
+
'timestamp': None,
|
287
|
+
'datetime': None,
|
289
288
|
'high': None,
|
290
289
|
'low': None,
|
291
290
|
'bid': self.safe_string(ticker, 'h'),
|
ccxt/async_support/bitfinex.py
CHANGED
@@ -1181,7 +1181,7 @@ class bitfinex(Exchange, ImplicitAPI):
|
|
1181
1181
|
fetches information on multiple closed orders made by the user
|
1182
1182
|
:param str symbol: unified market symbol of the market orders were made in
|
1183
1183
|
:param int [since]: the earliest time in ms to fetch orders for
|
1184
|
-
:param int [limit]: the maximum number of
|
1184
|
+
:param int [limit]: the maximum number of order structures to retrieve
|
1185
1185
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1186
1186
|
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
1187
1187
|
"""
|
ccxt/async_support/bitfinex2.py
CHANGED
@@ -1046,15 +1046,14 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
1046
1046
|
# FRR_AMOUNT_AVAILABLE
|
1047
1047
|
# ]
|
1048
1048
|
#
|
1049
|
-
timestamp = self.milliseconds()
|
1050
1049
|
symbol = self.safe_symbol(None, market)
|
1051
1050
|
length = len(ticker)
|
1052
1051
|
last = self.safe_string(ticker, length - 4)
|
1053
1052
|
percentage = self.safe_string(ticker, length - 5)
|
1054
1053
|
return self.safe_ticker({
|
1055
1054
|
'symbol': symbol,
|
1056
|
-
'timestamp':
|
1057
|
-
'datetime':
|
1055
|
+
'timestamp': None,
|
1056
|
+
'datetime': None,
|
1058
1057
|
'high': self.safe_string(ticker, length - 2),
|
1059
1058
|
'low': self.safe_string(ticker, length - 1),
|
1060
1059
|
'bid': self.safe_string(ticker, length - 10),
|
@@ -1736,7 +1735,7 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
1736
1735
|
:see: https://docs.bitfinex.com/reference/rest-auth-retrieve-orders-by-symbol
|
1737
1736
|
:param str symbol: unified market symbol of the market orders were made in
|
1738
1737
|
:param int [since]: the earliest time in ms to fetch orders for
|
1739
|
-
:param int [limit]: the maximum number of
|
1738
|
+
:param int [limit]: the maximum number of order structures to retrieve
|
1740
1739
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1741
1740
|
:param int [params.until]: the latest time in ms to fetch entries for
|
1742
1741
|
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
ccxt/async_support/bitflyer.py
CHANGED
@@ -620,7 +620,7 @@ class bitflyer(Exchange, ImplicitAPI):
|
|
620
620
|
:see: https://lightning.bitflyer.com/docs?lang=en#list-orders
|
621
621
|
:param str symbol: unified market symbol of the market orders were made in
|
622
622
|
:param int [since]: the earliest time in ms to fetch orders for
|
623
|
-
:param int [limit]: the maximum number of
|
623
|
+
:param int [limit]: the maximum number of order structures to retrieve
|
624
624
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
625
625
|
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
626
626
|
"""
|
@@ -659,7 +659,7 @@ class bitflyer(Exchange, ImplicitAPI):
|
|
659
659
|
:see: https://lightning.bitflyer.com/docs?lang=en#list-orders
|
660
660
|
:param str symbol: unified market symbol of the market orders were made in
|
661
661
|
:param int [since]: the earliest time in ms to fetch orders for
|
662
|
-
:param int [limit]: the maximum number of
|
662
|
+
:param int [limit]: the maximum number of order structures to retrieve
|
663
663
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
664
664
|
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
665
665
|
"""
|
ccxt/async_support/bitmart.py
CHANGED
@@ -1074,7 +1074,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1074
1074
|
# "legal_coin_price":"0.1302699"
|
1075
1075
|
# }
|
1076
1076
|
#
|
1077
|
-
timestamp = self.safe_integer(ticker, 'timestamp'
|
1077
|
+
timestamp = self.safe_integer(ticker, 'timestamp')
|
1078
1078
|
marketId = self.safe_string_2(ticker, 'symbol', 'contract_symbol')
|
1079
1079
|
market = self.safe_market(marketId, market)
|
1080
1080
|
symbol = market['symbol']
|
@@ -2589,7 +2589,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2589
2589
|
fetches information on multiple closed orders made by the user
|
2590
2590
|
:param str symbol: unified market symbol of the market orders were made in
|
2591
2591
|
:param int [since]: the earliest time in ms to fetch orders for
|
2592
|
-
:param int [limit]: the maximum number of
|
2592
|
+
:param int [limit]: the maximum number of order structures to retrieve
|
2593
2593
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2594
2594
|
:param int [params.until]: timestamp in ms of the latest entry
|
2595
2595
|
:param str [params.marginMode]: *spot only* 'cross' or 'isolated', for margin trading
|
ccxt/async_support/bitmex.py
CHANGED
@@ -847,7 +847,7 @@ class bitmex(Exchange, ImplicitAPI):
|
|
847
847
|
fetches information on multiple orders made by the user
|
848
848
|
:param str symbol: unified market symbol of the market orders were made in
|
849
849
|
:param int [since]: the earliest time in ms to fetch orders for
|
850
|
-
:param int [limit]: the maximum number of
|
850
|
+
:param int [limit]: the maximum number of order structures to retrieve
|
851
851
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
852
852
|
:param int [params.until]: the earliest time in ms to fetch orders for
|
853
853
|
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
@@ -901,7 +901,7 @@ class bitmex(Exchange, ImplicitAPI):
|
|
901
901
|
fetches information on multiple closed orders made by the user
|
902
902
|
:param str symbol: unified market symbol of the market orders were made in
|
903
903
|
:param int [since]: the earliest time in ms to fetch orders for
|
904
|
-
:param int [limit]: the maximum number of
|
904
|
+
:param int [limit]: the maximum number of order structures to retrieve
|
905
905
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
906
906
|
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
907
907
|
"""
|
ccxt/async_support/bitopro.py
CHANGED
@@ -1203,7 +1203,7 @@ class bitopro(Exchange, ImplicitAPI):
|
|
1203
1203
|
:see: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/get_orders_data.md
|
1204
1204
|
:param str symbol: unified market symbol of the market orders were made in
|
1205
1205
|
:param int [since]: the earliest time in ms to fetch orders for
|
1206
|
-
:param int [limit]: the maximum number of
|
1206
|
+
:param int [limit]: the maximum number of order structures to retrieve
|
1207
1207
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1208
1208
|
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
1209
1209
|
"""
|