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.

Files changed (163) hide show
  1. ccxt/__init__.py +2 -1
  2. ccxt/abstract/bingx.py +2 -0
  3. ccxt/abstract/kucoin.py +12 -0
  4. ccxt/abstract/kucoinfutures.py +12 -1
  5. ccxt/ace.py +1 -1
  6. ccxt/ascendex.py +1 -1
  7. ccxt/async_support/__init__.py +2 -1
  8. ccxt/async_support/ace.py +1 -1
  9. ccxt/async_support/ascendex.py +1 -1
  10. ccxt/async_support/base/exchange.py +29 -23
  11. ccxt/async_support/bigone.py +2 -2
  12. ccxt/async_support/binance.py +116 -114
  13. ccxt/async_support/bingx.py +46 -7
  14. ccxt/async_support/bit2c.py +2 -3
  15. ccxt/async_support/bitfinex.py +1 -1
  16. ccxt/async_support/bitfinex2.py +3 -4
  17. ccxt/async_support/bitflyer.py +2 -2
  18. ccxt/async_support/bitmart.py +2 -2
  19. ccxt/async_support/bitmex.py +2 -2
  20. ccxt/async_support/bitopro.py +1 -1
  21. ccxt/async_support/bitpanda.py +1 -1
  22. ccxt/async_support/bitvavo.py +1 -1
  23. ccxt/async_support/blockchaincom.py +1 -1
  24. ccxt/async_support/btcalpha.py +2 -2
  25. ccxt/async_support/btcbox.py +3 -4
  26. ccxt/async_support/btcmarkets.py +2 -2
  27. ccxt/async_support/btcturk.py +1 -1
  28. ccxt/async_support/bybit.py +2 -2
  29. ccxt/async_support/cex.py +1 -1
  30. ccxt/async_support/coinbase.py +11 -5
  31. ccxt/async_support/coinbasepro.py +2 -2
  32. ccxt/async_support/coinex.py +1 -1
  33. ccxt/async_support/coinlist.py +1 -1
  34. ccxt/async_support/cryptocom.py +2 -1
  35. ccxt/async_support/delta.py +24 -1
  36. ccxt/async_support/deribit.py +1 -1
  37. ccxt/async_support/digifinex.py +1 -1
  38. ccxt/async_support/gate.py +2 -2
  39. ccxt/async_support/hitbtc.py +1 -1
  40. ccxt/async_support/hollaex.py +2 -2
  41. ccxt/async_support/htx.py +1 -1
  42. ccxt/async_support/huobijp.py +2 -2
  43. ccxt/async_support/idex.py +1 -1
  44. ccxt/async_support/independentreserve.py +1 -1
  45. ccxt/async_support/kraken.py +45 -41
  46. ccxt/async_support/krakenfutures.py +46 -23
  47. ccxt/async_support/kucoin.py +68 -5
  48. ccxt/async_support/kucoinfutures.py +2 -2
  49. ccxt/async_support/kuna.py +1 -1
  50. ccxt/async_support/latoken.py +1 -1
  51. ccxt/async_support/luno.py +2 -2
  52. ccxt/async_support/lykke.py +1 -1
  53. ccxt/async_support/mexc.py +2 -2
  54. ccxt/async_support/ndax.py +1 -1
  55. ccxt/async_support/novadax.py +2 -2
  56. ccxt/async_support/oceanex.py +1 -1
  57. ccxt/async_support/okcoin.py +1 -1
  58. ccxt/async_support/okx.py +1 -1
  59. ccxt/async_support/poloniexfutures.py +1 -1
  60. ccxt/async_support/probit.py +1 -1
  61. ccxt/async_support/timex.py +1 -1
  62. ccxt/async_support/tokocrypto.py +1 -1
  63. ccxt/async_support/upbit.py +1 -1
  64. ccxt/async_support/wavesexchange.py +1 -1
  65. ccxt/async_support/whitebit.py +1 -1
  66. ccxt/async_support/woo.py +1 -1
  67. ccxt/async_support/zaif.py +1 -1
  68. ccxt/base/errors.py +6 -0
  69. ccxt/base/exchange.py +10 -7
  70. ccxt/bigone.py +2 -2
  71. ccxt/binance.py +116 -114
  72. ccxt/bingx.py +46 -7
  73. ccxt/bit2c.py +2 -3
  74. ccxt/bitfinex.py +1 -1
  75. ccxt/bitfinex2.py +3 -4
  76. ccxt/bitflyer.py +2 -2
  77. ccxt/bitmart.py +2 -2
  78. ccxt/bitmex.py +2 -2
  79. ccxt/bitopro.py +1 -1
  80. ccxt/bitpanda.py +1 -1
  81. ccxt/bitvavo.py +1 -1
  82. ccxt/blockchaincom.py +1 -1
  83. ccxt/btcalpha.py +2 -2
  84. ccxt/btcbox.py +3 -4
  85. ccxt/btcmarkets.py +2 -2
  86. ccxt/btcturk.py +1 -1
  87. ccxt/bybit.py +2 -2
  88. ccxt/cex.py +1 -1
  89. ccxt/coinbase.py +11 -5
  90. ccxt/coinbasepro.py +2 -2
  91. ccxt/coinex.py +1 -1
  92. ccxt/coinlist.py +1 -1
  93. ccxt/cryptocom.py +2 -1
  94. ccxt/delta.py +24 -1
  95. ccxt/deribit.py +1 -1
  96. ccxt/digifinex.py +1 -1
  97. ccxt/gate.py +2 -2
  98. ccxt/hitbtc.py +1 -1
  99. ccxt/hollaex.py +2 -2
  100. ccxt/htx.py +1 -1
  101. ccxt/huobijp.py +2 -2
  102. ccxt/idex.py +1 -1
  103. ccxt/independentreserve.py +1 -1
  104. ccxt/kraken.py +45 -41
  105. ccxt/krakenfutures.py +46 -23
  106. ccxt/kucoin.py +68 -5
  107. ccxt/kucoinfutures.py +2 -2
  108. ccxt/kuna.py +1 -1
  109. ccxt/latoken.py +1 -1
  110. ccxt/luno.py +2 -2
  111. ccxt/lykke.py +1 -1
  112. ccxt/mexc.py +2 -2
  113. ccxt/ndax.py +1 -1
  114. ccxt/novadax.py +2 -2
  115. ccxt/oceanex.py +1 -1
  116. ccxt/okcoin.py +1 -1
  117. ccxt/okx.py +1 -1
  118. ccxt/poloniexfutures.py +1 -1
  119. ccxt/pro/__init__.py +1 -1
  120. ccxt/pro/alpaca.py +1 -1
  121. ccxt/pro/ascendex.py +1 -1
  122. ccxt/pro/binance.py +5 -6
  123. ccxt/pro/bingx.py +6 -3
  124. ccxt/pro/bitfinex.py +3 -4
  125. ccxt/pro/bitfinex2.py +1 -1
  126. ccxt/pro/bitmex.py +1 -1
  127. ccxt/pro/bitpanda.py +1 -1
  128. ccxt/pro/blockchaincom.py +1 -1
  129. ccxt/pro/bybit.py +2 -2
  130. ccxt/pro/cex.py +1 -1
  131. ccxt/pro/coinbase.py +1 -1
  132. ccxt/pro/coinbasepro.py +1 -1
  133. ccxt/pro/cryptocom.py +1 -1
  134. ccxt/pro/deribit.py +1 -1
  135. ccxt/pro/gate.py +3 -3
  136. ccxt/pro/gemini.py +1 -1
  137. ccxt/pro/hitbtc.py +1 -1
  138. ccxt/pro/hollaex.py +1 -1
  139. ccxt/pro/htx.py +1 -1
  140. ccxt/pro/idex.py +1 -1
  141. ccxt/pro/kraken.py +3 -4
  142. ccxt/pro/krakenfutures.py +1 -1
  143. ccxt/pro/kucoinfutures.py +1 -1
  144. ccxt/pro/mexc.py +1 -1
  145. ccxt/pro/okcoin.py +1 -1
  146. ccxt/pro/okx.py +4 -4
  147. ccxt/pro/phemex.py +1 -1
  148. ccxt/pro/poloniexfutures.py +1 -1
  149. ccxt/pro/woo.py +2 -3
  150. ccxt/probit.py +1 -1
  151. ccxt/test/test_async.py +3 -1
  152. ccxt/test/test_sync.py +3 -1
  153. ccxt/timex.py +1 -1
  154. ccxt/tokocrypto.py +1 -1
  155. ccxt/upbit.py +1 -1
  156. ccxt/wavesexchange.py +1 -1
  157. ccxt/whitebit.py +1 -1
  158. ccxt/woo.py +1 -1
  159. ccxt/zaif.py +1 -1
  160. {ccxt-4.1.95.dist-info → ccxt-4.1.97.dist-info}/METADATA +4 -4
  161. {ccxt-4.1.95.dist-info → ccxt-4.1.97.dist-info}/RECORD +163 -163
  162. {ccxt-4.1.95.dist-info → ccxt-4.1.97.dist-info}/WHEEL +0 -0
  163. {ccxt-4.1.95.dist-info → ccxt-4.1.97.dist-info}/top_level.txt +0 -0
ccxt/kraken.py CHANGED
@@ -822,7 +822,6 @@ class kraken(Exchange, ImplicitAPI):
822
822
  # "o":"2571.56000"
823
823
  # }
824
824
  #
825
- timestamp = self.milliseconds()
826
825
  symbol = self.safe_symbol(None, market)
827
826
  v = self.safe_value(ticker, 'v', [])
828
827
  baseVolume = self.safe_string(v, 1)
@@ -837,8 +836,8 @@ class kraken(Exchange, ImplicitAPI):
837
836
  ask = self.safe_value(ticker, 'a', [])
838
837
  return self.safe_ticker({
839
838
  'symbol': symbol,
840
- 'timestamp': timestamp,
841
- 'datetime': self.iso8601(timestamp),
839
+ 'timestamp': None,
840
+ 'datetime': None,
842
841
  'high': self.safe_string(high, 1),
843
842
  'low': self.safe_string(low, 1),
844
843
  'bid': self.safe_string(bid, 0),
@@ -1309,8 +1308,12 @@ class kraken(Exchange, ImplicitAPI):
1309
1308
  :param float amount: how much of currency you want to trade in units of base currency
1310
1309
  :param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1311
1310
  :param dict [params]: extra parameters specific to the exchange API endpoint
1312
- :param bool params.postOnly:
1313
- :param bool params.reduceOnly:
1311
+ :param bool [params.postOnly]: if True, the order will only be posted to the order book and not executed immediately
1312
+ :param bool [params.reduceOnly]: *margin only* indicates if self order is to reduce the size of a position
1313
+ :param float [params.stopLossPrice]: *margin only* the price that a stop loss order is triggered at
1314
+ :param float [params.takeProfitPrice]: *margin only* the price that a take profit order is triggered at
1315
+ :param str [params.trailingStopPrice]: *margin only* the quote amount to trail away from the current market price
1316
+ :param str [params.trigger]: *margin only* the activation price type, 'last' or 'index', default is 'last'
1314
1317
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1315
1318
  """
1316
1319
  self.load_markets()
@@ -1543,40 +1546,40 @@ class kraken(Exchange, ImplicitAPI):
1543
1546
  params = self.omit(params, ['userref', 'clientOrderId'])
1544
1547
  if clientOrderId is not None:
1545
1548
  request['userref'] = clientOrderId
1546
- #
1547
- # market
1548
- # limit(price = limit price)
1549
- # stop-loss(price = stop loss trigger price)
1550
- # take-profit(price = take profit trigger price)
1551
- # stop-loss-limit(price = stop loss trigger price, price2 = triggered limit price)
1552
- # take-profit-limit(price = take profit trigger price, price2 = triggered limit price)
1553
- # settle-position
1554
- #
1549
+ stopLossTriggerPrice = self.safe_string(params, 'stopLossPrice')
1550
+ takeProfitTriggerPrice = self.safe_string(params, 'takeProfitPrice')
1551
+ isStopLossTriggerOrder = stopLossTriggerPrice is not None
1552
+ isTakeProfitTriggerOrder = takeProfitTriggerPrice is not None
1553
+ isStopLossOrTakeProfitTrigger = isStopLossTriggerOrder or isTakeProfitTriggerOrder
1554
+ trailingStopPrice = self.safe_string(params, 'trailingStopPrice')
1555
+ isTrailingStopPriceOrder = trailingStopPrice is not None
1555
1556
  if type == 'limit':
1556
1557
  request['price'] = self.price_to_precision(symbol, price)
1557
- elif (type == 'stop-loss') or (type == 'take-profit'):
1558
- stopPrice = self.safe_number_2(params, 'price', 'stopPrice', price)
1559
- if stopPrice is None:
1560
- raise ArgumentsRequired(self.id + method + ' requires a price argument or a price/stopPrice parameter for a ' + type + ' order')
1561
- else:
1562
- request['price'] = self.price_to_precision(symbol, stopPrice)
1563
- elif (type == 'stop-loss-limit') or (type == 'take-profit-limit'):
1564
- stopPrice = self.safe_number_2(params, 'price', 'stopPrice')
1565
- limitPrice = self.safe_number(params, 'price2')
1566
- stopPriceDefined = (stopPrice is not None)
1567
- limitPriceDefined = (limitPrice is not None)
1568
- if stopPriceDefined and limitPriceDefined:
1569
- request['price'] = self.price_to_precision(symbol, stopPrice)
1570
- request['price2'] = self.price_to_precision(symbol, limitPrice)
1571
- elif (price is None) or (not(stopPriceDefined or limitPriceDefined)):
1572
- raise ArgumentsRequired(self.id + method + ' requires a price argument and/or price/stopPrice/price2 parameters for a ' + type + ' order')
1558
+ reduceOnly = self.safe_value_2(params, 'reduceOnly', 'reduce_only')
1559
+ if isStopLossOrTakeProfitTrigger:
1560
+ if isStopLossTriggerOrder:
1561
+ request['price'] = self.price_to_precision(symbol, stopLossTriggerPrice)
1562
+ request['ordertype'] = 'stop-loss-limit'
1563
+ elif isTakeProfitTriggerOrder:
1564
+ request['price'] = self.price_to_precision(symbol, takeProfitTriggerPrice)
1565
+ request['ordertype'] = 'take-profit-limit'
1566
+ request['price2'] = self.price_to_precision(symbol, price)
1567
+ reduceOnly = True
1568
+ elif isTrailingStopPriceOrder:
1569
+ trailingStopActivationPriceType = self.safe_string(params, 'trigger', 'last')
1570
+ trailingStopPriceString = '+' + trailingStopPrice
1571
+ request['trigger'] = trailingStopActivationPriceType
1572
+ reduceOnly = True
1573
+ if type == 'limit':
1574
+ trailingStopLimitPriceString = '+' + self.number_to_string(price)
1575
+ request['price'] = trailingStopPriceString
1576
+ request['price2'] = trailingStopLimitPriceString
1577
+ request['ordertype'] = 'trailing-stop-limit'
1573
1578
  else:
1574
- if stopPriceDefined:
1575
- request['price'] = self.price_to_precision(symbol, stopPrice)
1576
- request['price2'] = self.price_to_precision(symbol, price)
1577
- elif limitPriceDefined:
1578
- request['price'] = self.price_to_precision(symbol, price)
1579
- request['price2'] = self.price_to_precision(symbol, limitPrice)
1579
+ request['price'] = trailingStopPriceString
1580
+ request['ordertype'] = 'trailing-stop'
1581
+ if reduceOnly:
1582
+ request['reduce_only'] = 'true' # not using hasattr(self, boolean) case, because the urlencodedNested transforms it into 'True' string
1580
1583
  close = self.safe_value(params, 'close')
1581
1584
  if close is not None:
1582
1585
  close = self.extend({}, close)
@@ -1595,10 +1598,7 @@ class kraken(Exchange, ImplicitAPI):
1595
1598
  postOnly, params = self.handle_post_only(isMarket, False, params)
1596
1599
  if postOnly:
1597
1600
  request['oflags'] = 'post'
1598
- reduceOnly = self.safe_value(params, 'reduceOnly')
1599
- if reduceOnly:
1600
- request['reduce_only'] = True
1601
- params = self.omit(params, ['price', 'stopPrice', 'price2', 'close', 'timeInForce', 'reduceOnly'])
1601
+ params = self.omit(params, ['timeInForce', 'reduceOnly', 'stopLossPrice', 'takeProfitPrice', 'trailingStopPrice'])
1602
1602
  return [request, params]
1603
1603
 
1604
1604
  def edit_order(self, id: str, symbol, type, side, amount=None, price=None, params={}):
@@ -1612,6 +1612,10 @@ class kraken(Exchange, ImplicitAPI):
1612
1612
  :param float amount: how much of the currency you want to trade in units of the base currency
1613
1613
  :param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1614
1614
  :param dict [params]: extra parameters specific to the exchange API endpoint
1615
+ :param float [params.stopLossPrice]: *margin only* the price that a stop loss order is triggered at
1616
+ :param float [params.takeProfitPrice]: *margin only* the price that a take profit order is triggered at
1617
+ :param str [params.trailingStopPrice]: *margin only* the quote price away from the current market price
1618
+ :param str [params.trigger]: *margin only* the activation price type, 'last' or 'index', default is 'last'
1615
1619
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1616
1620
  """
1617
1621
  self.load_markets()
@@ -1950,7 +1954,7 @@ class kraken(Exchange, ImplicitAPI):
1950
1954
  :see: https://docs.kraken.com/rest/#tag/Account-Data/operation/getClosedOrders
1951
1955
  :param str symbol: unified market symbol of the market orders were made in
1952
1956
  :param int [since]: the earliest time in ms to fetch orders for
1953
- :param int [limit]: the maximum number of orde structures to retrieve
1957
+ :param int [limit]: the maximum number of order structures to retrieve
1954
1958
  :param dict [params]: extra parameters specific to the exchange API endpoint
1955
1959
  :param int [params.until]: timestamp in ms of the latest entry
1956
1960
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
ccxt/krakenfutures.py CHANGED
@@ -815,18 +815,12 @@ class krakenfutures(Exchange, ImplicitAPI):
815
815
  })
816
816
 
817
817
  def create_order_request(self, symbol: str, type: OrderType, side: OrderSide, amount, price=None, params={}):
818
+ market = self.market(symbol)
818
819
  type = self.safe_string(params, 'orderType', type)
819
820
  timeInForce = self.safe_string(params, 'timeInForce')
820
- stopPrice = self.safe_string(params, 'stopPrice')
821
821
  postOnly = False
822
822
  postOnly, params = self.handle_post_only(type == 'market', type == 'post', params)
823
- clientOrderId = self.safe_string_2(params, 'clientOrderId', 'cliOrdId')
824
- params = self.omit(params, ['clientOrderId', 'cliOrdId'])
825
- if (type == 'stp' or type == 'take_profit') and stopPrice is None:
826
- raise ArgumentsRequired(self.id + ' createOrder requires params.stopPrice when type is ' + type)
827
- if stopPrice is not None and type != 'take_profit':
828
- type = 'stp'
829
- elif postOnly:
823
+ if postOnly:
830
824
  type = 'post'
831
825
  elif timeInForce == 'ioc':
832
826
  type = 'ioc'
@@ -835,33 +829,62 @@ class krakenfutures(Exchange, ImplicitAPI):
835
829
  elif type == 'market':
836
830
  type = 'mkt'
837
831
  request = {
838
- 'orderType': type,
839
- 'symbol': self.market_id(symbol),
832
+ 'symbol': market['id'],
840
833
  'side': side,
841
834
  'size': amount,
842
835
  }
843
- if price is not None:
844
- request['limitPrice'] = price
836
+ clientOrderId = self.safe_string_2(params, 'clientOrderId', 'cliOrdId')
845
837
  if clientOrderId is not None:
846
838
  request['cliOrdId'] = clientOrderId
839
+ triggerPrice = self.safe_string_2(params, 'triggerPrice', 'stopPrice')
840
+ isTriggerOrder = triggerPrice is not None
841
+ stopLossTriggerPrice = self.safe_string(params, 'stopLossPrice')
842
+ takeProfitTriggerPrice = self.safe_string(params, 'takeProfitPrice')
843
+ isStopLossTriggerOrder = stopLossTriggerPrice is not None
844
+ isTakeProfitTriggerOrder = takeProfitTriggerPrice is not None
845
+ isStopLossOrTakeProfitTrigger = isStopLossTriggerOrder or isTakeProfitTriggerOrder
846
+ triggerSignal = self.safe_string(params, 'triggerSignal', 'last')
847
+ reduceOnly = self.safe_value(params, 'reduceOnly')
848
+ if isStopLossOrTakeProfitTrigger or isTriggerOrder:
849
+ request['triggerSignal'] = triggerSignal
850
+ if isTriggerOrder:
851
+ type = 'stp'
852
+ request['stopPrice'] = self.price_to_precision(symbol, triggerPrice)
853
+ elif isStopLossOrTakeProfitTrigger:
854
+ reduceOnly = True
855
+ if isStopLossTriggerOrder:
856
+ type = 'stp'
857
+ request['stopPrice'] = self.price_to_precision(symbol, stopLossTriggerPrice)
858
+ elif isTakeProfitTriggerOrder:
859
+ type = 'take_profit'
860
+ request['stopPrice'] = self.price_to_precision(symbol, takeProfitTriggerPrice)
861
+ if reduceOnly:
862
+ request['reduceOnly'] = True
863
+ request['orderType'] = type
864
+ if price is not None:
865
+ request['limitPrice'] = price
866
+ params = self.omit(params, ['clientOrderId', 'timeInForce', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice'])
847
867
  return self.extend(request, params)
848
868
 
849
869
  def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount, price=None, params={}):
850
870
  """
851
871
  Create an order on the exchange
852
- :param str symbol: market symbol
853
- :param str type: One of 'limit', 'market', 'take_profit'
854
- :param str side: buy or sell
855
- :param int amount: Contract quantity
856
- :param float [price]: Limit order price
857
- :param float [params.stopPrice]: The stop price associated with a stop or take profit order, Required if orderType is stp or take_profit, Must not have more than 2 decimal places, Note that for stop orders, limitPrice denotes the worst price at which the stop or take_profit order can get filled at. If no limitPrice is provided the stop or take_profit order will trigger a market order,
858
- :param bool [params.reduceOnly]: Set if you wish the order to only reduce an existing position, Any order which increases an existing position will be rejected, Default False,
859
- :param bool [params.postOnly]: Set if you wish to make a postOnly order, Default False
860
- :param str [params.triggerSignal]: If placing a stp or take_profit, the signal used for trigger, One of: 'mark', 'index', 'last', last is market price
861
- :param str [params.cliOrdId]: UUID The order identity that is specified from the user, It must be globally unique
872
+ :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-send-order
873
+ :param str symbol: unified market symbol
874
+ :param str type: 'limit' or 'market'
875
+ :param str side: 'buy' or 'sell'
876
+ :param float amount: number of contracts
877
+ :param float [price]: limit order price
878
+ :param bool [params.reduceOnly]: set if you wish the order to only reduce an existing position, any order which increases an existing position will be rejected, default is False
879
+ :param bool [params.postOnly]: set if you wish to make a postOnly order, default is False
862
880
  :param str [params.clientOrderId]: UUID The order identity that is specified from the user, It must be globally unique
881
+ :param float [params.triggerPrice]: the price that a stop order is triggered at
882
+ :param float [params.stopLossPrice]: the price that a stop loss order is triggered at
883
+ :param float [params.takeProfitPrice]: the price that a take profit order is triggered at
884
+ :param str [params.triggerSignal]: for triggerPrice, stopLossPrice and takeProfitPrice orders, the trigger price type, 'last', 'mark' or 'index', default is 'last'
863
885
  """
864
886
  self.load_markets()
887
+ market = self.market(symbol)
865
888
  orderRequest = self.create_order_request(symbol, type, side, amount, price, params)
866
889
  response = self.privatePostSendorder(orderRequest)
867
890
  #
@@ -897,7 +920,7 @@ class krakenfutures(Exchange, ImplicitAPI):
897
920
  sendStatus = self.safe_value(response, 'sendStatus')
898
921
  status = self.safe_string(sendStatus, 'status')
899
922
  self.verify_order_action_success(status, 'createOrder', ['filled'])
900
- return self.parse_order(sendStatus)
923
+ return self.parse_order(sendStatus, market)
901
924
 
902
925
  def create_orders(self, orders: List[OrderRequest], params={}):
903
926
  """
ccxt/kucoin.py CHANGED
@@ -56,6 +56,9 @@ class kucoin(Exchange, ImplicitAPI):
56
56
  'closeAllPositions': False,
57
57
  'closePosition': False,
58
58
  'createDepositAddress': True,
59
+ 'createMarketBuyOrderWithCost': True,
60
+ 'createMarketOrderWithCost': True,
61
+ 'createMarketSellOrderWithCost': True,
59
62
  'createOrder': True,
60
63
  'createOrders': True,
61
64
  'createPostOnlyOrder': True,
@@ -223,6 +226,10 @@ class kucoin(Exchange, ImplicitAPI):
223
226
  'stop-order': 8, # 8SW
224
227
  'stop-order/{orderId}': 3, # 3SW
225
228
  'stop-order/queryOrderByClientOid': 3, # 3SW
229
+ 'oco/order/{orderId}': 2, # 2SW
230
+ 'oco/order/details/{orderId}': 2, # 2SW
231
+ 'oco/client-order/{clientOid}': 2, # 2SW
232
+ 'oco/orders': 2, # 2SW
226
233
  # margin trading
227
234
  'hf/margin/orders/active': 4, # 4SW
228
235
  'hf/margin/orders/done': 10, # 10SW
@@ -230,7 +237,8 @@ class kucoin(Exchange, ImplicitAPI):
230
237
  'hf/margin/orders/client-order/{clientOid}': 5, # 5SW
231
238
  'hf/margin/fills': 5, # 5SW
232
239
  'etf/info': 25, # 25SW
233
- 'risk/limit/strategy': 20, # 20SW
240
+ 'margin/currencies': 20, # 20SW
241
+ 'risk/limit/strategy': 20, # 20SW(Deprecate)
234
242
  'isolated/symbols': 20, # 20SW
235
243
  'isolated/account/{symbol}': 50, # 50SW
236
244
  'margin/borrow': 15, # 15SW
@@ -265,6 +273,7 @@ class kucoin(Exchange, ImplicitAPI):
265
273
  'orders/test': 2, # 2SW
266
274
  'orders/multi': 3, # 3SW
267
275
  'stop-order': 2, # 2SW
276
+ 'oco/order': 2, # 2SW
268
277
  # margin trading
269
278
  'hf/margin/order': 5, # 5SW
270
279
  'hf/margin/order/test': 5, # 5SW
@@ -290,12 +299,16 @@ class kucoin(Exchange, ImplicitAPI):
290
299
  'hf/orders/sync/client-order/{clientOid}': 1, # 1SW
291
300
  'hf/orders/cancel/{orderId}': 2, # 2SW
292
301
  'hf/orders': 2, # 2SW
302
+ 'hf/orders/cancelAll': 30, # 30SW
293
303
  'orders/{orderId}': 3, # 3SW
294
304
  'order/client-order/{clientOid}': 5, # 5SW
295
305
  'orders': 20, # 20SW
296
306
  'stop-order/{orderId}': 3, # 3SW
297
307
  'stop-order/cancelOrderByClientOid': 5, # 5SW
298
308
  'stop-order/cancel': 3, # 3SW
309
+ 'oco/order/{orderId}': 3, # 3SW
310
+ 'oco/client-order/{clientOid}': 3, # 3SW
311
+ 'oco/orders': 3, # 3SW
299
312
  # margin trading
300
313
  'hf/margin/orders/{orderId}': 5, # 5SW
301
314
  'hf/margin/orders/client-order/{clientOid}': 5, # 5SW
@@ -316,6 +329,7 @@ class kucoin(Exchange, ImplicitAPI):
316
329
  'index/query': 3, # 2PW
317
330
  'mark-price/{symbol}/current': 4.5, # 3PW
318
331
  'premium/query': 4.5, # 3PW
332
+ 'trade-statistics': 4.5, # 3PW
319
333
  'funding-rate/{symbol}/current': 3, # 2PW
320
334
  'timestamp': 3, # 2PW
321
335
  'status': 6, # 4PW
@@ -364,6 +378,7 @@ class kucoin(Exchange, ImplicitAPI):
364
378
  },
365
379
  'delete': {
366
380
  'orders/{orderId}': 1.5, # 1FW
381
+ 'orders/client-order/{clientOid}': 1.5, # 1FW
367
382
  'orders': 45, # 30FW
368
383
  'stopOrders': 22.5, # 15FW
369
384
  },
@@ -551,6 +566,10 @@ class kucoin(Exchange, ImplicitAPI):
551
566
  'market/orderbook/level2': 'v3',
552
567
  'market/orderbook/level3': 'v3',
553
568
  'market/orderbook/level{level}': 'v3',
569
+ 'oco/order/{orderId}': 'v3',
570
+ 'oco/order/details/{orderId}': 'v3',
571
+ 'oco/client-order/{clientOid}': 'v3',
572
+ 'oco/orders': 'v3',
554
573
  # margin trading
555
574
  'hf/margin/orders/active': 'v3',
556
575
  'hf/margin/orders/done': 'v3',
@@ -558,6 +577,7 @@ class kucoin(Exchange, ImplicitAPI):
558
577
  'hf/margin/orders/client-order/{clientOid}': 'v3',
559
578
  'hf/margin/fills': 'v3',
560
579
  'etf/info': 'v3',
580
+ 'margin/currencies': 'v3',
561
581
  'margin/borrow': 'v3',
562
582
  'margin/repay': 'v3',
563
583
  'project/list': 'v3',
@@ -574,6 +594,7 @@ class kucoin(Exchange, ImplicitAPI):
574
594
  'accounts/inner-transfer': 'v2',
575
595
  'transfer-out': 'v3',
576
596
  # spot trading
597
+ 'oco/order': 'v3',
577
598
  # margin trading
578
599
  'hf/margin/order': 'v3',
579
600
  'hf/margin/order/test': 'v3',
@@ -590,6 +611,9 @@ class kucoin(Exchange, ImplicitAPI):
590
611
  'hf/margin/orders/{orderId}': 'v3',
591
612
  'hf/margin/orders/client-order/{clientOid}': 'v3',
592
613
  'hf/margin/orders': 'v3',
614
+ 'oco/order/{orderId}': 'v3',
615
+ 'oco/client-order/{clientOid}': 'v3',
616
+ 'oco/orders': 'v3',
593
617
  # margin trading
594
618
  },
595
619
  },
@@ -1873,6 +1897,44 @@ class kucoin(Exchange, ImplicitAPI):
1873
1897
  data = self.safe_value(response, 'data', {})
1874
1898
  return self.parse_order(data, market)
1875
1899
 
1900
+ def create_market_order_with_cost(self, symbol: str, side: OrderSide, cost, params={}):
1901
+ """
1902
+ create a market order by providing the symbol, side and cost
1903
+ :see: https://www.kucoin.com/docs/rest/spot-trading/orders/place-order
1904
+ :param str symbol: unified symbol of the market to create an order in
1905
+ :param str side: 'buy' or 'sell'
1906
+ :param float cost: how much you want to trade in units of the quote currency
1907
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1908
+ :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1909
+ """
1910
+ self.load_markets()
1911
+ params['cost'] = cost
1912
+ return self.create_order(symbol, 'market', side, cost, None, params)
1913
+
1914
+ def create_market_buy_order_with_cost(self, symbol: str, cost, params={}):
1915
+ """
1916
+ create a market buy order by providing the symbol and cost
1917
+ :see: https://www.kucoin.com/docs/rest/spot-trading/orders/place-order
1918
+ :param str symbol: unified symbol of the market to create an order in
1919
+ :param float cost: how much you want to trade in units of the quote currency
1920
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1921
+ :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1922
+ """
1923
+ self.load_markets()
1924
+ return self.create_market_order_with_cost(symbol, 'buy', cost, params)
1925
+
1926
+ def create_market_sell_order_with_cost(self, symbol: str, cost, params={}):
1927
+ """
1928
+ create a market sell order by providing the symbol and cost
1929
+ :see: https://www.kucoin.com/docs/rest/spot-trading/orders/place-order
1930
+ :param str symbol: unified symbol of the market to create an order in
1931
+ :param float cost: how much you want to trade in units of the quote currency
1932
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1933
+ :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1934
+ """
1935
+ self.load_markets()
1936
+ return self.create_market_order_with_cost(symbol, 'sell', cost, params)
1937
+
1876
1938
  def create_orders(self, orders: List[OrderRequest], params={}):
1877
1939
  """
1878
1940
  create a list of trade orders
@@ -2124,8 +2186,9 @@ class kucoin(Exchange, ImplicitAPI):
2124
2186
  response = self.privateDeleteStopOrderCancel(self.extend(request, query))
2125
2187
  elif hf:
2126
2188
  if symbol is None:
2127
- raise ArgumentsRequired(self.id + ' cancelAllOrders() requires a symbol parameter for hf orders')
2128
- response = self.privateDeleteHfOrders(self.extend(request, query))
2189
+ response = self.privateDeleteHfOrdersCancelAll(self.extend(request, query))
2190
+ else:
2191
+ response = self.privateDeleteHfOrders(self.extend(request, query))
2129
2192
  else:
2130
2193
  response = self.privateDeleteOrders(self.extend(request, query))
2131
2194
  return response
@@ -2244,7 +2307,7 @@ class kucoin(Exchange, ImplicitAPI):
2244
2307
  :see: https://docs.kucoin.com/spot-hf/#obtain-list-of-filled-hf-orders
2245
2308
  :param str symbol: unified market symbol of the market orders were made in
2246
2309
  :param int [since]: the earliest time in ms to fetch orders for
2247
- :param int [limit]: the maximum number of orde structures to retrieve
2310
+ :param int [limit]: the maximum number of order structures to retrieve
2248
2311
  :param dict [params]: extra parameters specific to the exchange API endpoint
2249
2312
  :param int [params.till]: end time in ms
2250
2313
  :param str [params.side]: buy or sell
@@ -2346,7 +2409,7 @@ class kucoin(Exchange, ImplicitAPI):
2346
2409
  response = self.privateGetHfOrdersOrderId(self.extend(request, params))
2347
2410
  else:
2348
2411
  response = self.privateGetOrdersOrderId(self.extend(request, params))
2349
- responseData = self.safe_value(response, 'data')
2412
+ responseData = self.safe_value(response, 'data', {})
2350
2413
  if isinstance(responseData, list):
2351
2414
  responseData = self.safe_value(responseData, 0)
2352
2415
  return self.parse_order(responseData, market)
ccxt/kucoinfutures.py CHANGED
@@ -1497,7 +1497,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
1497
1497
  :see: https://docs.kucoin.com/futures/#get-order-list
1498
1498
  :param str symbol: unified market symbol of the market orders were made in
1499
1499
  :param int [since]: the earliest time in ms to fetch orders for
1500
- :param int [limit]: the maximum number of orde structures to retrieve
1500
+ :param int [limit]: the maximum number of order structures to retrieve
1501
1501
  :param dict [params]: extra parameters specific to the exchange API endpoint
1502
1502
  :param int [params.till]: end time in ms
1503
1503
  :param str [params.side]: buy or sell
@@ -2319,7 +2319,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
2319
2319
  :param str side: not used by kucoinfutures closePositions
2320
2320
  :param dict [params]: extra parameters specific to the okx api endpoint
2321
2321
  :param str [params.clientOrderId]: client order id of the order
2322
- :returns [dict]: `A list of position structures <https://docs.ccxt.com/#/?id=position-structure>`
2322
+ :returns dict[]: `A list of position structures <https://docs.ccxt.com/#/?id=position-structure>`
2323
2323
  """
2324
2324
  self.load_markets()
2325
2325
  market = self.market(symbol)
ccxt/kuna.py CHANGED
@@ -1225,7 +1225,7 @@ class kuna(Exchange, ImplicitAPI):
1225
1225
  :see: https://docs.kuna.io/docs/get-private-orders-history
1226
1226
  :param str symbol: unified market symbol of the market orders were made in
1227
1227
  :param int [since]: the earliest time in ms to fetch orders for
1228
- :param int [limit]: the maximum number of orde structures to retrieve
1228
+ :param int [limit]: the maximum number of order structures to retrieve
1229
1229
  :param dict [params]: extra parameters specific to the exchange API endpoint
1230
1230
  :param int [params.until]: the latest time in ms to fetch orders for
1231
1231
  *
ccxt/latoken.py CHANGED
@@ -1094,7 +1094,7 @@ class latoken(Exchange, ImplicitAPI):
1094
1094
  :see: https://api.latoken.com/doc/v2/#tag/StopOrder/operation/getMyStopOrdersByPair # stop
1095
1095
  :param str symbol: unified market symbol of the market orders were made in
1096
1096
  :param int [since]: the earliest time in ms to fetch orders for
1097
- :param int [limit]: the maximum number of orde structures to retrieve
1097
+ :param int [limit]: the maximum number of order structures to retrieve
1098
1098
  :param dict [params]: extra parameters specific to the exchange API endpoint
1099
1099
  :param boolean [params.trigger]: True if fetching trigger orders
1100
1100
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
ccxt/luno.py CHANGED
@@ -449,7 +449,7 @@ class luno(Exchange, ImplicitAPI):
449
449
  fetches information on multiple orders made by the user
450
450
  :param str symbol: unified market symbol of the market orders were made in
451
451
  :param int [since]: the earliest time in ms to fetch orders for
452
- :param int [limit]: the maximum number of orde structures to retrieve
452
+ :param int [limit]: the maximum number of order structures to retrieve
453
453
  :param dict [params]: extra parameters specific to the exchange API endpoint
454
454
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
455
455
  """
@@ -471,7 +471,7 @@ class luno(Exchange, ImplicitAPI):
471
471
  fetches information on multiple closed orders made by the user
472
472
  :param str symbol: unified market symbol of the market orders were made in
473
473
  :param int [since]: the earliest time in ms to fetch orders for
474
- :param int [limit]: the maximum number of orde structures to retrieve
474
+ :param int [limit]: the maximum number of order structures to retrieve
475
475
  :param dict [params]: extra parameters specific to the exchange API endpoint
476
476
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
477
477
  """
ccxt/lykke.py CHANGED
@@ -943,7 +943,7 @@ class lykke(Exchange, ImplicitAPI):
943
943
  fetches information on multiple closed orders made by the user
944
944
  :param str symbol: unified market symbol of the market orders were made in
945
945
  :param int [since]: the earliest time in ms to fetch orders for
946
- :param int [limit]: the maximum number of orde structures to retrieve
946
+ :param int [limit]: the maximum number of order structures to retrieve
947
947
  :param dict [params]: extra parameters specific to the exchange API endpoint
948
948
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
949
949
  """
ccxt/mexc.py CHANGED
@@ -2375,7 +2375,7 @@ class mexc(Exchange, ImplicitAPI):
2375
2375
  fetches information on multiple orders made by the user
2376
2376
  :param str symbol: unified market symbol of the market orders were made in
2377
2377
  :param int [since]: the earliest time in ms to fetch orders for
2378
- :param int [limit]: the maximum number of orde structures to retrieve
2378
+ :param int [limit]: the maximum number of order structures to retrieve
2379
2379
  :param dict [params]: extra parameters specific to the exchange API endpoint
2380
2380
  :param str [params.marginMode]: only 'isolated' is supported, for spot-margin trading
2381
2381
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
@@ -2670,7 +2670,7 @@ class mexc(Exchange, ImplicitAPI):
2670
2670
  fetches information on multiple closed orders made by the user
2671
2671
  :param str symbol: unified market symbol of the market orders were made in
2672
2672
  :param int [since]: the earliest time in ms to fetch orders for
2673
- :param int [limit]: the maximum number of orde structures to retrieve
2673
+ :param int [limit]: the maximum number of order structures to retrieve
2674
2674
  :param dict [params]: extra parameters specific to the exchange API endpoint
2675
2675
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
2676
2676
  """
ccxt/ndax.py CHANGED
@@ -1609,7 +1609,7 @@ class ndax(Exchange, ImplicitAPI):
1609
1609
  fetches information on multiple orders made by the user
1610
1610
  :param str symbol: unified market symbol of the market orders were made in
1611
1611
  :param int [since]: the earliest time in ms to fetch orders for
1612
- :param int [limit]: the maximum number of orde structures to retrieve
1612
+ :param int [limit]: the maximum number of order structures to retrieve
1613
1613
  :param dict [params]: extra parameters specific to the exchange API endpoint
1614
1614
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1615
1615
  """
ccxt/novadax.py CHANGED
@@ -872,7 +872,7 @@ class novadax(Exchange, ImplicitAPI):
872
872
  :see: https://doc.novadax.com/en-US/#get-order-history
873
873
  :param str symbol: unified market symbol of the market orders were made in
874
874
  :param int [since]: the earliest time in ms to fetch orders for
875
- :param int [limit]: the maximum number of orde structures to retrieve
875
+ :param int [limit]: the maximum number of order structures to retrieve
876
876
  :param dict [params]: extra parameters specific to the exchange API endpoint
877
877
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
878
878
  """
@@ -942,7 +942,7 @@ class novadax(Exchange, ImplicitAPI):
942
942
  :see: https://doc.novadax.com/en-US/#get-order-history
943
943
  :param str symbol: unified market symbol of the market orders were made in
944
944
  :param int [since]: the earliest time in ms to fetch orders for
945
- :param int [limit]: the maximum number of orde structures to retrieve
945
+ :param int [limit]: the maximum number of order structures to retrieve
946
946
  :param dict [params]: extra parameters specific to the exchange API endpoint
947
947
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
948
948
  """
ccxt/oceanex.py CHANGED
@@ -667,7 +667,7 @@ class oceanex(Exchange, ImplicitAPI):
667
667
  :see: https://api.oceanex.pro/doc/v1/#order-status-get
668
668
  :param str symbol: unified market symbol of the market orders were made in
669
669
  :param int [since]: the earliest time in ms to fetch orders for
670
- :param int [limit]: the maximum number of orde structures to retrieve
670
+ :param int [limit]: the maximum number of order structures to retrieve
671
671
  :param dict [params]: extra parameters specific to the exchange API endpoint
672
672
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
673
673
  """
ccxt/okcoin.py CHANGED
@@ -1918,7 +1918,7 @@ class okcoin(Exchange, ImplicitAPI):
1918
1918
  fetches information on multiple closed orders made by the user
1919
1919
  :param str symbol: unified market symbol of the market orders were made in
1920
1920
  :param int [since]: the earliest time in ms to fetch orders for
1921
- :param int [limit]: the maximum number of orde structures to retrieve
1921
+ :param int [limit]: the maximum number of order structures to retrieve
1922
1922
  :param dict [params]: extra parameters specific to the exchange API endpoint
1923
1923
  :param bool [params.stop]: True if fetching trigger or conditional orders
1924
1924
  :param str [params.ordType]: "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
ccxt/okx.py CHANGED
@@ -3675,7 +3675,7 @@ class okx(Exchange, ImplicitAPI):
3675
3675
  :see: https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-get-algo-order-history
3676
3676
  :param str symbol: unified market symbol of the market orders were made in
3677
3677
  :param int [since]: the earliest time in ms to fetch orders for
3678
- :param int [limit]: the maximum number of orde structures to retrieve
3678
+ :param int [limit]: the maximum number of order structures to retrieve
3679
3679
  :param dict [params]: extra parameters specific to the exchange API endpoint
3680
3680
  :param bool [params.stop]: True if fetching trigger or conditional orders
3681
3681
  :param str [params.ordType]: "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
ccxt/poloniexfutures.py CHANGED
@@ -1301,7 +1301,7 @@ class poloniexfutures(Exchange, ImplicitAPI):
1301
1301
  :see: https://futures-docs.poloniex.com/#get-untriggered-stop-order-list
1302
1302
  :param str symbol: unified market symbol of the market orders were made in
1303
1303
  :param int [since]: the earliest time in ms to fetch orders for
1304
- :param int [limit]: the maximum number of orde structures to retrieve
1304
+ :param int [limit]: the maximum number of order structures to retrieve
1305
1305
  :param dict [params]: extra parameters specific to the exchange API endpoint
1306
1306
  :param int [params.till]: end time in ms
1307
1307
  :param str [params.side]: buy or sell
ccxt/pro/__init__.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.1.95'
7
+ __version__ = '4.1.97'
8
8
 
9
9
  # ----------------------------------------------------------------------------
10
10
 
ccxt/pro/alpaca.py CHANGED
@@ -332,7 +332,7 @@ class alpaca(ccxt.async_support.alpaca):
332
332
  watches information on multiple orders made by the user
333
333
  :param str symbol: unified market symbol of the market orders were made in
334
334
  :param int [since]: the earliest time in ms to fetch orders for
335
- :param int [limit]: the maximum number of orde structures to retrieve
335
+ :param int [limit]: the maximum number of order structures to retrieve
336
336
  :param dict [params]: extra parameters specific to the exchange API endpoint
337
337
  :returns dict[]: a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure
338
338
  """
ccxt/pro/ascendex.py CHANGED
@@ -450,7 +450,7 @@ class ascendex(ccxt.async_support.ascendex):
450
450
  watches information on multiple orders made by the user
451
451
  :param str symbol: unified market symbol of the market orders were made in
452
452
  :param int [since]: the earliest time in ms to fetch orders for
453
- :param int [limit]: the maximum number of orde structures to retrieve
453
+ :param int [limit]: the maximum number of order structures to retrieve
454
454
  :param dict [params]: extra parameters specific to the exchange API endpoint
455
455
  :returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
456
456
  """