ccxt 4.4.38__py2.py3-none-any.whl → 4.4.40__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.
Files changed (140) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/digifinex.py +1 -0
  3. ccxt/abstract/mexc.py +1 -0
  4. ccxt/abstract/woo.py +2 -2
  5. ccxt/alpaca.py +74 -3
  6. ccxt/ascendex.py +9 -9
  7. ccxt/async_support/__init__.py +1 -1
  8. ccxt/async_support/alpaca.py +74 -3
  9. ccxt/async_support/ascendex.py +9 -9
  10. ccxt/async_support/base/exchange.py +1 -1
  11. ccxt/async_support/base/ws/aiohttp_client.py +2 -2
  12. ccxt/async_support/binance.py +13 -17
  13. ccxt/async_support/bingx.py +1 -2
  14. ccxt/async_support/bit2c.py +0 -1
  15. ccxt/async_support/bitbank.py +0 -1
  16. ccxt/async_support/bitbns.py +0 -1
  17. ccxt/async_support/bitfinex.py +15 -16
  18. ccxt/async_support/bitfinex1.py +0 -1
  19. ccxt/async_support/bitflyer.py +0 -1
  20. ccxt/async_support/bitget.py +1 -2
  21. ccxt/async_support/bithumb.py +0 -1
  22. ccxt/async_support/bitmart.py +3 -4
  23. ccxt/async_support/bitmex.py +5 -6
  24. ccxt/async_support/bitopro.py +4 -5
  25. ccxt/async_support/bitrue.py +5 -7
  26. ccxt/async_support/bitso.py +1 -2
  27. ccxt/async_support/bitstamp.py +1 -2
  28. ccxt/async_support/bitteam.py +1 -3
  29. ccxt/async_support/bitvavo.py +2 -4
  30. ccxt/async_support/blockchaincom.py +5 -5
  31. ccxt/async_support/blofin.py +10 -10
  32. ccxt/async_support/btcalpha.py +0 -1
  33. ccxt/async_support/btcbox.py +0 -1
  34. ccxt/async_support/btcmarkets.py +1 -3
  35. ccxt/async_support/bybit.py +2 -3
  36. ccxt/async_support/cex.py +1 -1
  37. ccxt/async_support/coinbase.py +77 -1
  38. ccxt/async_support/coinbaseexchange.py +1 -1
  39. ccxt/async_support/coinbaseinternational.py +62 -0
  40. ccxt/async_support/coincatch.py +1 -1
  41. ccxt/async_support/coinex.py +9 -9
  42. ccxt/async_support/coinlist.py +1 -1
  43. ccxt/async_support/coinmetro.py +1 -1
  44. ccxt/async_support/cryptocom.py +91 -2
  45. ccxt/async_support/currencycom.py +1 -1
  46. ccxt/async_support/defx.py +1 -2
  47. ccxt/async_support/delta.py +1 -1
  48. ccxt/async_support/digifinex.py +58 -19
  49. ccxt/async_support/exmo.py +2 -2
  50. ccxt/async_support/gate.py +1 -1
  51. ccxt/async_support/hashkey.py +3 -5
  52. ccxt/async_support/htx.py +155 -33
  53. ccxt/async_support/hyperliquid.py +1 -1
  54. ccxt/async_support/kraken.py +1 -1
  55. ccxt/async_support/kucoin.py +25 -24
  56. ccxt/async_support/luno.py +1 -1
  57. ccxt/async_support/mexc.py +173 -26
  58. ccxt/async_support/ndax.py +1 -1
  59. ccxt/async_support/okcoin.py +18 -18
  60. ccxt/async_support/okx.py +22 -21
  61. ccxt/async_support/phemex.py +12 -8
  62. ccxt/async_support/poloniex.py +1 -1
  63. ccxt/async_support/poloniexfutures.py +6 -6
  64. ccxt/async_support/vertex.py +11 -11
  65. ccxt/async_support/woo.py +39 -39
  66. ccxt/async_support/woofipro.py +24 -24
  67. ccxt/async_support/xt.py +26 -26
  68. ccxt/async_support/zonda.py +1 -1
  69. ccxt/base/exchange.py +32 -25
  70. ccxt/binance.py +13 -17
  71. ccxt/bingx.py +1 -2
  72. ccxt/bit2c.py +0 -1
  73. ccxt/bitbank.py +0 -1
  74. ccxt/bitbns.py +0 -1
  75. ccxt/bitfinex.py +15 -16
  76. ccxt/bitfinex1.py +0 -1
  77. ccxt/bitflyer.py +0 -1
  78. ccxt/bitget.py +1 -2
  79. ccxt/bithumb.py +0 -1
  80. ccxt/bitmart.py +3 -4
  81. ccxt/bitmex.py +5 -6
  82. ccxt/bitopro.py +4 -5
  83. ccxt/bitrue.py +5 -7
  84. ccxt/bitso.py +1 -2
  85. ccxt/bitstamp.py +1 -2
  86. ccxt/bitteam.py +1 -3
  87. ccxt/bitvavo.py +2 -4
  88. ccxt/blockchaincom.py +5 -5
  89. ccxt/blofin.py +10 -10
  90. ccxt/btcalpha.py +0 -1
  91. ccxt/btcbox.py +0 -1
  92. ccxt/btcmarkets.py +1 -3
  93. ccxt/bybit.py +2 -3
  94. ccxt/cex.py +1 -1
  95. ccxt/coinbase.py +77 -1
  96. ccxt/coinbaseexchange.py +1 -1
  97. ccxt/coinbaseinternational.py +62 -0
  98. ccxt/coincatch.py +1 -1
  99. ccxt/coinex.py +9 -9
  100. ccxt/coinlist.py +1 -1
  101. ccxt/coinmetro.py +1 -1
  102. ccxt/cryptocom.py +91 -2
  103. ccxt/currencycom.py +1 -1
  104. ccxt/defx.py +1 -2
  105. ccxt/delta.py +1 -1
  106. ccxt/digifinex.py +58 -19
  107. ccxt/exmo.py +2 -2
  108. ccxt/gate.py +1 -1
  109. ccxt/hashkey.py +3 -5
  110. ccxt/htx.py +155 -33
  111. ccxt/hyperliquid.py +1 -1
  112. ccxt/kraken.py +1 -1
  113. ccxt/kucoin.py +25 -24
  114. ccxt/luno.py +1 -1
  115. ccxt/mexc.py +173 -26
  116. ccxt/ndax.py +1 -1
  117. ccxt/okcoin.py +18 -18
  118. ccxt/okx.py +22 -21
  119. ccxt/phemex.py +12 -8
  120. ccxt/poloniex.py +1 -1
  121. ccxt/poloniexfutures.py +6 -6
  122. ccxt/pro/__init__.py +1 -1
  123. ccxt/pro/bitget.py +1 -1
  124. ccxt/pro/bybit.py +12 -1
  125. ccxt/pro/coinex.py +2 -2
  126. ccxt/pro/gate.py +6 -6
  127. ccxt/pro/kucoin.py +3 -3
  128. ccxt/pro/okx.py +11 -11
  129. ccxt/pro/upbit.py +2 -2
  130. ccxt/pro/woo.py +1 -1
  131. ccxt/vertex.py +11 -11
  132. ccxt/woo.py +39 -39
  133. ccxt/woofipro.py +24 -24
  134. ccxt/xt.py +26 -26
  135. ccxt/zonda.py +1 -1
  136. {ccxt-4.4.38.dist-info → ccxt-4.4.40.dist-info}/METADATA +4 -4
  137. {ccxt-4.4.38.dist-info → ccxt-4.4.40.dist-info}/RECORD +140 -140
  138. {ccxt-4.4.38.dist-info → ccxt-4.4.40.dist-info}/LICENSE.txt +0 -0
  139. {ccxt-4.4.38.dist-info → ccxt-4.4.40.dist-info}/WHEEL +0 -0
  140. {ccxt-4.4.38.dist-info → ccxt-4.4.40.dist-info}/top_level.txt +0 -0
ccxt/async_support/xt.py CHANGED
@@ -2377,7 +2377,7 @@ class xt(Exchange, ImplicitAPI):
2377
2377
  :param str id: order id
2378
2378
  :param str [symbol]: unified symbol of the market the order was made in
2379
2379
  :param dict params: extra parameters specific to the xt api endpoint
2380
- :param bool [params.stop]: if the order is a stop trigger order or not
2380
+ :param bool [params.trigger]: if the order is a trigger order or not
2381
2381
  :param bool [params.stopLossTakeProfit]: if the order is a stop-loss or take-profit order
2382
2382
  :returns dict: An `order structure <https://docs.ccxt.com/en/latest/manual.html#order-structure>`
2383
2383
  """
@@ -2391,15 +2391,15 @@ class xt(Exchange, ImplicitAPI):
2391
2391
  response = None
2392
2392
  type, params = self.handle_market_type_and_params('fetchOrder', market, params)
2393
2393
  subType, params = self.handle_sub_type_and_params('fetchOrder', market, params)
2394
- stop = self.safe_value(params, 'stop')
2394
+ trigger = self.safe_value(params, 'stop')
2395
2395
  stopLossTakeProfit = self.safe_value(params, 'stopLossTakeProfit')
2396
- if stop:
2396
+ if trigger:
2397
2397
  request['entrustId'] = id
2398
2398
  elif stopLossTakeProfit:
2399
2399
  request['profitId'] = id
2400
2400
  else:
2401
2401
  request['orderId'] = id
2402
- if stop:
2402
+ if trigger:
2403
2403
  params = self.omit(params, 'stop')
2404
2404
  if subType == 'inverse':
2405
2405
  response = await self.privateInverseGetFutureTradeV1EntrustPlanDetail(self.extend(request, params))
@@ -2549,7 +2549,7 @@ class xt(Exchange, ImplicitAPI):
2549
2549
  :param int [since]: timestamp in ms of the earliest order
2550
2550
  :param int [limit]: the maximum number of order structures to retrieve
2551
2551
  :param dict params: extra parameters specific to the xt api endpoint
2552
- :param bool [params.stop]: if the order is a stop trigger order or not
2552
+ :param bool [params.trigger]: if the order is a trigger order or not
2553
2553
  :returns dict[]: a list of `order structures <https://docs.ccxt.com/en/latest/manual.html#order-structure>`
2554
2554
  """
2555
2555
  await self.load_markets()
@@ -2567,9 +2567,9 @@ class xt(Exchange, ImplicitAPI):
2567
2567
  response = None
2568
2568
  type, params = self.handle_market_type_and_params('fetchOrders', market, params)
2569
2569
  subType, params = self.handle_sub_type_and_params('fetchOrders', market, params)
2570
- stop = self.safe_value(params, 'stop')
2571
- if stop:
2572
- params = self.omit(params, 'stop')
2570
+ trigger = self.safe_value_2(params, 'trigger', 'stop')
2571
+ if trigger:
2572
+ params = self.omit(params, ['trigger', 'stop'])
2573
2573
  if subType == 'inverse':
2574
2574
  response = await self.privateInverseGetFutureTradeV1EntrustPlanListHistory(self.extend(request, params))
2575
2575
  else:
@@ -2710,31 +2710,31 @@ class xt(Exchange, ImplicitAPI):
2710
2710
  response = None
2711
2711
  type, params = self.handle_market_type_and_params('fetchOrdersByStatus', market, params)
2712
2712
  subType, params = self.handle_sub_type_and_params('fetchOrdersByStatus', market, params)
2713
- stop = self.safe_value(params, 'stop')
2713
+ trigger = self.safe_value(params, 'stop')
2714
2714
  stopLossTakeProfit = self.safe_value(params, 'stopLossTakeProfit')
2715
2715
  if status == 'open':
2716
- if stop or stopLossTakeProfit:
2716
+ if trigger or stopLossTakeProfit:
2717
2717
  request['state'] = 'NOT_TRIGGERED'
2718
2718
  elif subType is not None:
2719
2719
  request['state'] = 'NEW'
2720
2720
  elif status == 'closed':
2721
- if stop or stopLossTakeProfit:
2721
+ if trigger or stopLossTakeProfit:
2722
2722
  request['state'] = 'TRIGGERED'
2723
2723
  else:
2724
2724
  request['state'] = 'FILLED'
2725
2725
  elif status == 'canceled':
2726
- if stop or stopLossTakeProfit:
2726
+ if trigger or stopLossTakeProfit:
2727
2727
  request['state'] = 'USER_REVOCATION'
2728
2728
  else:
2729
2729
  request['state'] = 'CANCELED'
2730
2730
  else:
2731
2731
  request['state'] = status
2732
- if stop or stopLossTakeProfit or (subType is not None) or (type == 'swap') or (type == 'future'):
2732
+ if trigger or stopLossTakeProfit or (subType is not None) or (type == 'swap') or (type == 'future'):
2733
2733
  if since is not None:
2734
2734
  request['startTime'] = since
2735
2735
  if limit is not None:
2736
2736
  request['size'] = limit
2737
- if stop:
2737
+ if trigger:
2738
2738
  params = self.omit(params, 'stop')
2739
2739
  if subType == 'inverse':
2740
2740
  response = await self.privateInverseGetFutureTradeV1EntrustPlanList(self.extend(request, params))
@@ -2960,7 +2960,7 @@ class xt(Exchange, ImplicitAPI):
2960
2960
  :param int [since]: timestamp in ms of the earliest order
2961
2961
  :param int [limit]: the maximum number of open order structures to retrieve
2962
2962
  :param dict params: extra parameters specific to the xt api endpoint
2963
- :param bool [params.stop]: if the order is a stop trigger order or not
2963
+ :param bool [params.trigger]: if the order is a trigger order or not
2964
2964
  :param bool [params.stopLossTakeProfit]: if the order is a stop-loss or take-profit order
2965
2965
  :returns dict[]: a list of `order structures <https://docs.ccxt.com/en/latest/manual.html#order-structure>`
2966
2966
  """
@@ -2979,7 +2979,7 @@ class xt(Exchange, ImplicitAPI):
2979
2979
  :param int [since]: timestamp in ms of the earliest order
2980
2980
  :param int [limit]: the maximum number of order structures to retrieve
2981
2981
  :param dict params: extra parameters specific to the xt api endpoint
2982
- :param bool [params.stop]: if the order is a stop trigger order or not
2982
+ :param bool [params.trigger]: if the order is a trigger order or not
2983
2983
  :param bool [params.stopLossTakeProfit]: if the order is a stop-loss or take-profit order
2984
2984
  :returns dict[]: a list of `order structures <https://docs.ccxt.com/en/latest/manual.html#order-structure>`
2985
2985
  """
@@ -2998,7 +2998,7 @@ class xt(Exchange, ImplicitAPI):
2998
2998
  :param int [since]: timestamp in ms of the earliest order
2999
2999
  :param int [limit]: the maximum number of order structures to retrieve
3000
3000
  :param dict params: extra parameters specific to the xt api endpoint
3001
- :param bool [params.stop]: if the order is a stop trigger order or not
3001
+ :param bool [params.trigger]: if the order is a trigger order or not
3002
3002
  :param bool [params.stopLossTakeProfit]: if the order is a stop-loss or take-profit order
3003
3003
  :returns dict: a list of `order structures <https://docs.ccxt.com/en/latest/manual.html#order-structure>`
3004
3004
  """
@@ -3016,7 +3016,7 @@ class xt(Exchange, ImplicitAPI):
3016
3016
  :param str id: order id
3017
3017
  :param str [symbol]: unified symbol of the market the order was made in
3018
3018
  :param dict params: extra parameters specific to the xt api endpoint
3019
- :param bool [params.stop]: if the order is a stop trigger order or not
3019
+ :param bool [params.trigger]: if the order is a trigger order or not
3020
3020
  :param bool [params.stopLossTakeProfit]: if the order is a stop-loss or take-profit order
3021
3021
  :returns dict: An `order structure <https://docs.ccxt.com/en/latest/manual.html#order-structure>`
3022
3022
  """
@@ -3030,16 +3030,16 @@ class xt(Exchange, ImplicitAPI):
3030
3030
  response = None
3031
3031
  type, params = self.handle_market_type_and_params('cancelOrder', market, params)
3032
3032
  subType, params = self.handle_sub_type_and_params('cancelOrder', market, params)
3033
- stop = self.safe_value(params, 'stop')
3033
+ trigger = self.safe_value_2(params, 'trigger', 'stop')
3034
3034
  stopLossTakeProfit = self.safe_value(params, 'stopLossTakeProfit')
3035
- if stop:
3035
+ if trigger:
3036
3036
  request['entrustId'] = id
3037
3037
  elif stopLossTakeProfit:
3038
3038
  request['profitId'] = id
3039
3039
  else:
3040
3040
  request['orderId'] = id
3041
- if stop:
3042
- params = self.omit(params, 'stop')
3041
+ if trigger:
3042
+ params = self.omit(params, ['trigger', 'stop'])
3043
3043
  if subType == 'inverse':
3044
3044
  response = await self.privateInversePostFutureTradeV1EntrustCancelPlan(self.extend(request, params))
3045
3045
  else:
@@ -3092,7 +3092,7 @@ class xt(Exchange, ImplicitAPI):
3092
3092
 
3093
3093
  :param str [symbol]: unified market symbol of the market to cancel orders in
3094
3094
  :param dict params: extra parameters specific to the xt api endpoint
3095
- :param bool [params.stop]: if the order is a stop trigger order or not
3095
+ :param bool [params.trigger]: if the order is a trigger order or not
3096
3096
  :param bool [params.stopLossTakeProfit]: if the order is a stop-loss or take-profit order
3097
3097
  :returns dict[]: a list of `order structures <https://docs.ccxt.com/en/latest/manual.html#order-structure>`
3098
3098
  """
@@ -3107,10 +3107,10 @@ class xt(Exchange, ImplicitAPI):
3107
3107
  response = None
3108
3108
  type, params = self.handle_market_type_and_params('cancelAllOrders', market, params)
3109
3109
  subType, params = self.handle_sub_type_and_params('cancelAllOrders', market, params)
3110
- stop = self.safe_value(params, 'stop')
3110
+ trigger = self.safe_value_2(params, 'trigger', 'stop')
3111
3111
  stopLossTakeProfit = self.safe_value(params, 'stopLossTakeProfit')
3112
- if stop:
3113
- params = self.omit(params, 'stop')
3112
+ if trigger:
3113
+ params = self.omit(params, ['trigger', 'stop'])
3114
3114
  if subType == 'inverse':
3115
3115
  response = await self.privateInversePostFutureTradeV1EntrustCancelAllPlan(self.extend(request, params))
3116
3116
  else:
@@ -853,7 +853,7 @@ class zonda(Exchange, ImplicitAPI):
853
853
  :param int [since]: timestamp in ms of the earliest ledger entry, default is None
854
854
  :param int [limit]: max number of ledger entries to return, default is None
855
855
  :param dict [params]: extra parameters specific to the exchange API endpoint
856
- :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
856
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
857
857
  """
858
858
  balanceCurrencies = []
859
859
  if code is not None:
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.38'
7
+ __version__ = '4.4.40'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -2300,26 +2300,23 @@ class Exchange(object):
2300
2300
  wssProxy = None
2301
2301
  wsSocksProxy = None
2302
2302
  # ws proxy
2303
- if self.value_is_defined(self.wsProxy):
2303
+ isWsProxyDefined = self.value_is_defined(self.wsProxy)
2304
+ is_ws_proxy_defined = self.value_is_defined(self.ws_proxy)
2305
+ if isWsProxyDefined or is_ws_proxy_defined:
2304
2306
  usedProxies.append('wsProxy')
2305
- wsProxy = self.wsProxy
2306
- if self.value_is_defined(self.ws_proxy):
2307
- usedProxies.append('ws_proxy')
2308
- wsProxy = self.ws_proxy
2307
+ wsProxy = self.wsProxy if (isWsProxyDefined) else self.ws_proxy
2309
2308
  # wss proxy
2310
- if self.value_is_defined(self.wssProxy):
2309
+ isWssProxyDefined = self.value_is_defined(self.wssProxy)
2310
+ is_wss_proxy_defined = self.value_is_defined(self.wss_proxy)
2311
+ if isWssProxyDefined or is_wss_proxy_defined:
2311
2312
  usedProxies.append('wssProxy')
2312
- wssProxy = self.wssProxy
2313
- if self.value_is_defined(self.wss_proxy):
2314
- usedProxies.append('wss_proxy')
2315
- wssProxy = self.wss_proxy
2313
+ wssProxy = self.wssProxy if (isWssProxyDefined) else self.wss_proxy
2316
2314
  # ws socks proxy
2317
- if self.value_is_defined(self.wsSocksProxy):
2315
+ isWsSocksProxyDefined = self.value_is_defined(self.wsSocksProxy)
2316
+ is_ws_socks_proxy_defined = self.value_is_defined(self.ws_socks_proxy)
2317
+ if isWsSocksProxyDefined or is_ws_socks_proxy_defined:
2318
2318
  usedProxies.append('wsSocksProxy')
2319
- wsSocksProxy = self.wsSocksProxy
2320
- if self.value_is_defined(self.ws_socks_proxy):
2321
- usedProxies.append('ws_socks_proxy')
2322
- wsSocksProxy = self.ws_socks_proxy
2319
+ wsSocksProxy = self.wsSocksProxy if (isWsSocksProxyDefined) else self.ws_socks_proxy
2323
2320
  # check
2324
2321
  length = len(usedProxies)
2325
2322
  if length > 1:
@@ -6537,29 +6534,39 @@ class Exchange(object):
6537
6534
  symbolAndTimeFrame = symbolsAndTimeFrames[i]
6538
6535
  symbol = self.safe_string(symbolAndTimeFrame, 0)
6539
6536
  timeframe = self.safe_string(symbolAndTimeFrame, 1)
6540
- if timeframe in self.ohlcvs[symbol]:
6541
- del self.ohlcvs[symbol][timeframe]
6537
+ if symbol in self.ohlcvs:
6538
+ if timeframe in self.ohlcvs[symbol]:
6539
+ del self.ohlcvs[symbol][timeframe]
6542
6540
  elif symbolsLength > 0:
6543
6541
  for i in range(0, len(symbols)):
6544
6542
  symbol = symbols[i]
6545
6543
  if topic == 'trades':
6546
- del self.trades[symbol]
6544
+ if symbol in self.trades:
6545
+ del self.trades[symbol]
6547
6546
  elif topic == 'orderbook':
6548
- del self.orderbooks[symbol]
6547
+ if symbol in self.orderbooks:
6548
+ del self.orderbooks[symbol]
6549
6549
  elif topic == 'ticker':
6550
- del self.tickers[symbol]
6550
+ if symbol in self.tickers:
6551
+ del self.tickers[symbol]
6551
6552
  else:
6552
6553
  if topic == 'myTrades':
6553
6554
  # don't reset self.myTrades directly here
6554
- # because in c# we need to use a different object
6555
+ # because in c# we need to use a different object(thread-safe dict)
6555
6556
  keys = list(self.myTrades.keys())
6556
6557
  for i in range(0, len(keys)):
6557
- del self.myTrades[keys[i]]
6558
+ key = keys[i]
6559
+ if key in self.myTrades:
6560
+ del self.myTrades[key]
6558
6561
  elif topic == 'orders':
6559
6562
  orderSymbols = list(self.orders.keys())
6560
6563
  for i in range(0, len(orderSymbols)):
6561
- del self.orders[orderSymbols[i]]
6564
+ orderSymbol = orderSymbols[i]
6565
+ if orderSymbol in self.orders:
6566
+ del self.orders[orderSymbol]
6562
6567
  elif topic == 'ticker':
6563
6568
  tickerSymbols = list(self.tickers.keys())
6564
6569
  for i in range(0, len(tickerSymbols)):
6565
- del self.tickers[tickerSymbols[i]]
6570
+ tickerSymbol = tickerSymbols[i]
6571
+ if tickerSymbol in self.tickers:
6572
+ del self.tickers[tickerSymbol]
ccxt/binance.py CHANGED
@@ -6009,14 +6009,10 @@ class binance(Exchange, ImplicitAPI):
6009
6009
  marginMode = None
6010
6010
  marginMode, params = self.handle_margin_mode_and_params('createOrder', params)
6011
6011
  reduceOnly = self.safe_bool(params, 'reduceOnly', False)
6012
- if (marketType == 'margin') or (marginMode is not None) or market['option']:
6013
- # for swap and future reduceOnly is a string that cant be sent with close position set to True or in hedge mode
6014
- params = self.omit(params, 'reduceOnly')
6015
- if market['option']:
6016
- request['reduceOnly'] = reduceOnly
6017
- else:
6018
- if reduceOnly:
6019
- request['sideEffectType'] = 'AUTO_REPAY'
6012
+ if reduceOnly:
6013
+ if marketType == 'margin' or (not market['contract'] and (marginMode is not None)):
6014
+ params = self.omit(params, 'reduceOnly')
6015
+ request['sideEffectType'] = 'AUTO_REPAY'
6020
6016
  triggerPrice = self.safe_string_2(params, 'triggerPrice', 'stopPrice')
6021
6017
  stopLossPrice = self.safe_string(params, 'stopLossPrice', triggerPrice) # fallback to stopLoss
6022
6018
  takeProfitPrice = self.safe_string(params, 'takeProfitPrice')
@@ -6373,7 +6369,7 @@ class binance(Exchange, ImplicitAPI):
6373
6369
  :param int [params.until]: the latest time in ms to fetch orders for
6374
6370
  :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
6375
6371
  :param boolean [params.portfolioMargin]: set to True if you would like to fetch orders in a portfolio margin account
6376
- :param boolean [params.stop]: set to True if you would like to fetch portfolio margin account stop or conditional orders
6372
+ :param boolean [params.trigger]: set to True if you would like to fetch portfolio margin account trigger or conditional orders
6377
6373
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
6378
6374
  """
6379
6375
  if symbol is None:
@@ -6630,7 +6626,7 @@ class binance(Exchange, ImplicitAPI):
6630
6626
  :param dict [params]: extra parameters specific to the exchange API endpoint
6631
6627
  :param str [params.marginMode]: 'cross' or 'isolated', for spot margin trading
6632
6628
  :param boolean [params.portfolioMargin]: set to True if you would like to fetch open orders in the portfolio margin account
6633
- :param boolean [params.stop]: set to True if you would like to fetch portfolio margin account conditional orders
6629
+ :param boolean [params.trigger]: set to True if you would like to fetch portfolio margin account conditional orders
6634
6630
  :param str [params.subType]: "linear" or "inverse"
6635
6631
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
6636
6632
  """
@@ -6916,7 +6912,7 @@ class binance(Exchange, ImplicitAPI):
6916
6912
  :param dict [params]: extra parameters specific to the exchange API endpoint
6917
6913
  :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
6918
6914
  :param boolean [params.portfolioMargin]: set to True if you would like to fetch orders in a portfolio margin account
6919
- :param boolean [params.stop]: set to True if you would like to fetch portfolio margin account stop or conditional orders
6915
+ :param boolean [params.trigger]: set to True if you would like to fetch portfolio margin account trigger or conditional orders
6920
6916
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
6921
6917
  """
6922
6918
  if symbol is None:
@@ -6945,7 +6941,7 @@ class binance(Exchange, ImplicitAPI):
6945
6941
  :param dict [params]: extra parameters specific to the exchange API endpoint
6946
6942
  :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
6947
6943
  :param boolean [params.portfolioMargin]: set to True if you would like to fetch orders in a portfolio margin account
6948
- :param boolean [params.stop]: set to True if you would like to fetch portfolio margin account stop or conditional orders
6944
+ :param boolean [params.trigger]: set to True if you would like to fetch portfolio margin account trigger or conditional orders
6949
6945
  :returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
6950
6946
  """
6951
6947
  if symbol is None:
@@ -6974,7 +6970,7 @@ class binance(Exchange, ImplicitAPI):
6974
6970
  :param dict [params]: extra parameters specific to the exchange API endpoint
6975
6971
  :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
6976
6972
  :param boolean [params.portfolioMargin]: set to True if you would like to fetch orders in a portfolio margin account
6977
- :param boolean [params.stop]: set to True if you would like to fetch portfolio margin account stop or conditional orders
6973
+ :param boolean [params.trigger]: set to True if you would like to fetch portfolio margin account trigger or conditional orders
6978
6974
  :returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
6979
6975
  """
6980
6976
  if symbol is None:
@@ -7005,7 +7001,7 @@ class binance(Exchange, ImplicitAPI):
7005
7001
  :param str symbol: unified symbol of the market the order was made in
7006
7002
  :param dict [params]: extra parameters specific to the exchange API endpoint
7007
7003
  :param boolean [params.portfolioMargin]: set to True if you would like to cancel an order in a portfolio margin account
7008
- :param boolean [params.stop]: set to True if you would like to cancel a portfolio margin account conditional order
7004
+ :param boolean [params.trigger]: set to True if you would like to cancel a portfolio margin account conditional order
7009
7005
  :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
7010
7006
  """
7011
7007
  if symbol is None:
@@ -7085,7 +7081,7 @@ class binance(Exchange, ImplicitAPI):
7085
7081
  :param dict [params]: extra parameters specific to the exchange API endpoint
7086
7082
  :param str [params.marginMode]: 'cross' or 'isolated', for spot margin trading
7087
7083
  :param boolean [params.portfolioMargin]: set to True if you would like to cancel orders in a portfolio margin account
7088
- :param boolean [params.stop]: set to True if you would like to cancel portfolio margin account conditional orders
7084
+ :param boolean [params.trigger]: set to True if you would like to cancel portfolio margin account conditional orders
7089
7085
  :returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
7090
7086
  """
7091
7087
  if symbol is None:
@@ -10839,7 +10835,7 @@ class binance(Exchange, ImplicitAPI):
10839
10835
  :param str id: the identification number of the ledger entry
10840
10836
  :param str code: unified currency code
10841
10837
  :param dict [params]: extra parameters specific to the exchange API endpoint
10842
- :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
10838
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
10843
10839
  """
10844
10840
  self.load_markets()
10845
10841
  type = None
@@ -10885,7 +10881,7 @@ class binance(Exchange, ImplicitAPI):
10885
10881
  :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
10886
10882
  :param boolean [params.portfolioMargin]: set to True if you would like to fetch the ledger for a portfolio margin account
10887
10883
  :param str [params.subType]: "linear" or "inverse"
10888
- :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
10884
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
10889
10885
  """
10890
10886
  self.load_markets()
10891
10887
  paginate = False
ccxt/bingx.py CHANGED
@@ -3439,7 +3439,6 @@ class bingx(Exchange, ImplicitAPI):
3439
3439
  'postOnly': None,
3440
3440
  'side': self.parse_order_side(side),
3441
3441
  'price': self.safe_string_2(order, 'price', 'p'),
3442
- 'stopPrice': triggerPrice,
3443
3442
  'triggerPrice': triggerPrice,
3444
3443
  'stopLossPrice': stopLossPrice,
3445
3444
  'takeProfitPrice': takeProfitPrice,
@@ -5872,7 +5871,7 @@ class bingx(Exchange, ImplicitAPI):
5872
5871
  :param float amount: how much of the currency you want to trade in units of the base currency
5873
5872
  :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
5874
5873
  :param dict [params]: extra parameters specific to the exchange API endpoint
5875
- :param str [params.stopPrice]: Trigger price used for TAKE_STOP_LIMIT, TAKE_STOP_MARKET, TRIGGER_LIMIT, TRIGGER_MARKET order types.
5874
+ :param str [params.triggerPrice]: Trigger price used for TAKE_STOP_LIMIT, TAKE_STOP_MARKET, TRIGGER_LIMIT, TRIGGER_MARKET order types.
5876
5875
  :param dict [params.takeProfit]: *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered
5877
5876
  :param float [params.takeProfit.triggerPrice]: take profit trigger price
5878
5877
  :param dict [params.stopLoss]: *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered
ccxt/bit2c.py CHANGED
@@ -620,7 +620,6 @@ class bit2c(Exchange, ImplicitAPI):
620
620
  'postOnly': None,
621
621
  'side': side,
622
622
  'price': price,
623
- 'stopPrice': None,
624
623
  'triggerPrice': None,
625
624
  'amount': amount,
626
625
  'filled': None,
ccxt/bitbank.py CHANGED
@@ -636,7 +636,6 @@ class bitbank(Exchange, ImplicitAPI):
636
636
  'postOnly': None,
637
637
  'side': side,
638
638
  'price': price,
639
- 'stopPrice': None,
640
639
  'triggerPrice': None,
641
640
  'cost': None,
642
641
  'average': average,
ccxt/bitbns.py CHANGED
@@ -552,7 +552,6 @@ class bitbns(Exchange, ImplicitAPI):
552
552
  'postOnly': None,
553
553
  'side': side,
554
554
  'price': self.safe_string(order, 'rate'),
555
- 'stopPrice': triggerPrice,
556
555
  'triggerPrice': triggerPrice,
557
556
  'amount': self.safe_string(order, 'btc'),
558
557
  'cost': None,
ccxt/bitfinex.py CHANGED
@@ -1483,10 +1483,10 @@ class bitfinex(Exchange, ImplicitAPI):
1483
1483
  if flags[i] == 'postOnly':
1484
1484
  postOnly = True
1485
1485
  price = self.safe_string(orderList, 16)
1486
- stopPrice = None
1486
+ triggerPrice = None
1487
1487
  if (orderType == 'EXCHANGE STOP') or (orderType == 'EXCHANGE STOP LIMIT'):
1488
1488
  price = None
1489
- stopPrice = self.safe_string(orderList, 16)
1489
+ triggerPrice = self.safe_string(orderList, 16)
1490
1490
  if orderType == 'EXCHANGE STOP LIMIT':
1491
1491
  price = self.safe_string(orderList, 19)
1492
1492
  status = None
@@ -1509,8 +1509,7 @@ class bitfinex(Exchange, ImplicitAPI):
1509
1509
  'postOnly': postOnly,
1510
1510
  'side': side,
1511
1511
  'price': price,
1512
- 'stopPrice': stopPrice,
1513
- 'triggerPrice': stopPrice,
1512
+ 'triggerPrice': triggerPrice,
1514
1513
  'amount': amount,
1515
1514
  'cost': None,
1516
1515
  'average': average,
@@ -1531,7 +1530,7 @@ class bitfinex(Exchange, ImplicitAPI):
1531
1530
  :param float amount: how much you want to trade in units of the base currency
1532
1531
  :param float [price]: the price of the order, in units of the quote currency, ignored in market orders
1533
1532
  :param dict [params]: extra parameters specific to the exchange API endpoint
1534
- :param float [params.stopPrice]: The price at which a trigger order is triggered at
1533
+ :param float [params.triggerPrice]: The price at which a trigger order is triggered at
1535
1534
  :param str [params.timeInForce]: "GTC", "IOC", "FOK", or "PO"
1536
1535
  :param bool [params.postOnly]:
1537
1536
  :param bool [params.reduceOnly]: Ensures that the executed order does not flip the opened position.
@@ -1549,7 +1548,7 @@ class bitfinex(Exchange, ImplicitAPI):
1549
1548
  'symbol': market['id'],
1550
1549
  'amount': amountString,
1551
1550
  }
1552
- stopPrice = self.safe_string_2(params, 'stopPrice', 'triggerPrice')
1551
+ triggerPrice = self.safe_string_2(params, 'stopPrice', 'triggerPrice')
1553
1552
  trailingAmount = self.safe_string(params, 'trailingAmount')
1554
1553
  timeInForce = self.safe_string(params, 'timeInForce')
1555
1554
  postOnlyParam = self.safe_bool(params, 'postOnly', False)
@@ -1559,9 +1558,9 @@ class bitfinex(Exchange, ImplicitAPI):
1559
1558
  if trailingAmount is not None:
1560
1559
  orderType = 'TRAILING STOP'
1561
1560
  request['price_trailing'] = trailingAmount
1562
- elif stopPrice is not None:
1561
+ elif triggerPrice is not None:
1563
1562
  # request['price'] is taken for stop orders
1564
- request['price'] = self.price_to_precision(symbol, stopPrice)
1563
+ request['price'] = self.price_to_precision(symbol, triggerPrice)
1565
1564
  if type == 'limit':
1566
1565
  orderType = 'STOP LIMIT'
1567
1566
  request['price_aux_limit'] = self.price_to_precision(symbol, price)
@@ -1574,7 +1573,7 @@ class bitfinex(Exchange, ImplicitAPI):
1574
1573
  raise InvalidOrder(self.id + ' createOrder() requires a price argument with IOC and FOK orders')
1575
1574
  if (ioc or fok) and (type == 'market'):
1576
1575
  raise InvalidOrder(self.id + ' createOrder() does not allow market IOC and FOK orders')
1577
- if (type != 'market') and (stopPrice is None):
1576
+ if (type != 'market') and (triggerPrice is None):
1578
1577
  request['price'] = self.price_to_precision(symbol, price)
1579
1578
  if ioc:
1580
1579
  orderType = 'IOC'
@@ -1611,7 +1610,7 @@ class bitfinex(Exchange, ImplicitAPI):
1611
1610
  :param float amount: the amount of currency to trade
1612
1611
  :param float [price]: price of the order
1613
1612
  :param dict [params]: extra parameters specific to the exchange API endpoint
1614
- :param float [params.stopPrice]: the price that triggers a trigger order
1613
+ :param float [params.triggerPrice]: the price that triggers a trigger order
1615
1614
  :param str [params.timeInForce]: "GTC", "IOC", "FOK", or "PO"
1616
1615
  :param boolean [params.postOnly]: set to True if you want to make a post only order
1617
1616
  :param boolean [params.reduceOnly]: indicates that the order is to reduce the size of a position
@@ -2849,7 +2848,7 @@ class bitfinex(Exchange, ImplicitAPI):
2849
2848
  :param dict [params]: extra parameters specific to the exchange API endpoint
2850
2849
  :param int [params.until]: timestamp in ms of the latest ledger entry
2851
2850
  :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
2852
- :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
2851
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
2853
2852
  """
2854
2853
  self.load_markets()
2855
2854
  paginate = False
@@ -3520,7 +3519,7 @@ class bitfinex(Exchange, ImplicitAPI):
3520
3519
  :param float amount: how much you want to trade in units of the base currency
3521
3520
  :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
3522
3521
  :param dict [params]: extra parameters specific to the exchange API endpoint
3523
- :param float [params.stopPrice]: the price that triggers a trigger order
3522
+ :param float [params.triggerPrice]: the price that triggers a trigger order
3524
3523
  :param boolean [params.postOnly]: set to True if you want to make a post only order
3525
3524
  :param boolean [params.reduceOnly]: indicates that the order is to reduce the size of a position
3526
3525
  :param int [params.flags]: additional order parameters: 4096(Post Only), 1024(Reduce Only), 16384(OCO), 64(Hidden), 512(Close), 524288(No Var Rates)
@@ -3538,7 +3537,7 @@ class bitfinex(Exchange, ImplicitAPI):
3538
3537
  amountString = self.amount_to_precision(symbol, amount)
3539
3538
  amountString = amountString if (side == 'buy') else Precise.string_neg(amountString)
3540
3539
  request['amount'] = amountString
3541
- stopPrice = self.safe_string_2(params, 'stopPrice', 'triggerPrice')
3540
+ triggerPrice = self.safe_string_2(params, 'stopPrice', 'triggerPrice')
3542
3541
  trailingAmount = self.safe_string(params, 'trailingAmount')
3543
3542
  timeInForce = self.safe_string(params, 'timeInForce')
3544
3543
  postOnlyParam = self.safe_bool(params, 'postOnly', False)
@@ -3546,13 +3545,13 @@ class bitfinex(Exchange, ImplicitAPI):
3546
3545
  clientOrderId = self.safe_integer_2(params, 'cid', 'clientOrderId')
3547
3546
  if trailingAmount is not None:
3548
3547
  request['price_trailing'] = trailingAmount
3549
- elif stopPrice is not None:
3548
+ elif triggerPrice is not None:
3550
3549
  # request['price'] is taken for stop orders
3551
- request['price'] = self.price_to_precision(symbol, stopPrice)
3550
+ request['price'] = self.price_to_precision(symbol, triggerPrice)
3552
3551
  if type == 'limit':
3553
3552
  request['price_aux_limit'] = self.price_to_precision(symbol, price)
3554
3553
  postOnly = (postOnlyParam or (timeInForce == 'PO'))
3555
- if (type != 'market') and (stopPrice is None):
3554
+ if (type != 'market') and (triggerPrice is None):
3556
3555
  request['price'] = self.price_to_precision(symbol, price)
3557
3556
  # flag values may be summed to combine flags
3558
3557
  flags = 0
ccxt/bitfinex1.py CHANGED
@@ -1247,7 +1247,6 @@ class bitfinex1(Exchange, ImplicitAPI):
1247
1247
  'postOnly': None,
1248
1248
  'side': side,
1249
1249
  'price': self.safe_string(order, 'price'),
1250
- 'stopPrice': None,
1251
1250
  'triggerPrice': None,
1252
1251
  'average': self.safe_string(order, 'avg_execution_price'),
1253
1252
  'amount': self.safe_string(order, 'original_amount'),
ccxt/bitflyer.py CHANGED
@@ -638,7 +638,6 @@ class bitflyer(Exchange, ImplicitAPI):
638
638
  'postOnly': None,
639
639
  'side': side,
640
640
  'price': price,
641
- 'stopPrice': None,
642
641
  'triggerPrice': None,
643
642
  'cost': None,
644
643
  'amount': amount,
ccxt/bitget.py CHANGED
@@ -4102,7 +4102,6 @@ class bitget(Exchange, ImplicitAPI):
4102
4102
  'timeInForce': timeInForce,
4103
4103
  'postOnly': postOnly,
4104
4104
  'reduceOnly': reduceOnly,
4105
- 'stopPrice': self.safe_number(order, 'triggerPrice'),
4106
4105
  'triggerPrice': self.safe_number(order, 'triggerPrice'),
4107
4106
  'takeProfitPrice': self.safe_number_2(order, 'presetStopSurplusPrice', 'stopSurplusTriggerPrice'),
4108
4107
  'stopLossPrice': self.safe_number_2(order, 'presetStopLossPrice', 'stopLossTriggerPrice'),
@@ -5712,7 +5711,7 @@ class bitget(Exchange, ImplicitAPI):
5712
5711
  :param str [params.symbol]: *contract only* unified market symbol
5713
5712
  :param str [params.productType]: *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
5714
5713
  :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
5715
- :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
5714
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
5716
5715
  """
5717
5716
  self.load_markets()
5718
5717
  symbol = self.safe_string(params, 'symbol')
ccxt/bithumb.py CHANGED
@@ -905,7 +905,6 @@ class bithumb(Exchange, ImplicitAPI):
905
905
  'postOnly': None,
906
906
  'side': side,
907
907
  'price': price,
908
- 'stopPrice': None,
909
908
  'triggerPrice': None,
910
909
  'amount': amount,
911
910
  'cost': None,
ccxt/bitmart.py CHANGED
@@ -2482,7 +2482,6 @@ class bitmart(Exchange, ImplicitAPI):
2482
2482
  'postOnly': postOnly,
2483
2483
  'side': self.parse_order_side(self.safe_string(order, 'side')),
2484
2484
  'price': self.omit_zero(priceString),
2485
- 'stopPrice': trailingActivationPrice,
2486
2485
  'triggerPrice': trailingActivationPrice,
2487
2486
  'amount': self.omit_zero(self.safe_string(order, 'size')),
2488
2487
  'cost': self.safe_string_2(order, 'filled_notional', 'filledNotional'),
@@ -2890,7 +2889,7 @@ class bitmart(Exchange, ImplicitAPI):
2890
2889
  :param str symbol: unified symbol of the market the order was made in
2891
2890
  :param dict [params]: extra parameters specific to the exchange API endpoint
2892
2891
  :param str [params.clientOrderId]: *spot only* the client order id of the order to cancel
2893
- :param boolean [params.stop]: *swap only* whether the order is a stop order
2892
+ :param boolean [params.trigger]: *swap only* whether the order is a trigger order
2894
2893
  :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
2895
2894
  """
2896
2895
  if symbol is None:
@@ -2910,9 +2909,9 @@ class bitmart(Exchange, ImplicitAPI):
2910
2909
  if market['spot']:
2911
2910
  response = self.privatePostSpotV3CancelOrder(self.extend(request, params))
2912
2911
  else:
2913
- stop = self.safe_bool_2(params, 'stop', 'trigger')
2912
+ trigger = self.safe_bool_2(params, 'stop', 'trigger')
2914
2913
  params = self.omit(params, ['stop', 'trigger'])
2915
- if not stop:
2914
+ if not trigger:
2916
2915
  response = self.privatePostContractPrivateCancelOrder(self.extend(request, params))
2917
2916
  else:
2918
2917
  response = self.privatePostContractPrivateCancelPlanOrder(self.extend(request, params))