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
@@ -1745,7 +1745,7 @@ class bitpanda(Exchange, ImplicitAPI):
1745
1745
  fetches information on multiple closed orders made by the user
1746
1746
  :param str symbol: unified market symbol of the market orders were made in
1747
1747
  :param int [since]: the earliest time in ms to fetch orders for
1748
- :param int [limit]: the maximum number of orde structures to retrieve
1748
+ :param int [limit]: the maximum number of order structures to retrieve
1749
1749
  :param dict [params]: extra parameters specific to the exchange API endpoint
1750
1750
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1751
1751
  """
@@ -1208,7 +1208,7 @@ class bitvavo(Exchange, ImplicitAPI):
1208
1208
  fetches information on multiple orders made by the user
1209
1209
  :param str symbol: unified market symbol of the market orders were made in
1210
1210
  :param int [since]: the earliest time in ms to fetch orders for
1211
- :param int [limit]: the maximum number of orde structures to retrieve
1211
+ :param int [limit]: the maximum number of order structures to retrieve
1212
1212
  :param dict [params]: extra parameters specific to the exchange API endpoint
1213
1213
  :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)
1214
1214
  :param int [params.until]: the latest time in ms to fetch entries for
@@ -654,7 +654,7 @@ class blockchaincom(Exchange, ImplicitAPI):
654
654
  fetches information on multiple closed orders made by the user
655
655
  :param str symbol: unified market symbol of the market orders were made in
656
656
  :param int [since]: the earliest time in ms to fetch orders for
657
- :param int [limit]: the maximum number of orde structures to retrieve
657
+ :param int [limit]: the maximum number of order structures to retrieve
658
658
  :param dict [params]: extra parameters specific to the exchange API endpoint
659
659
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
660
660
  """
@@ -761,7 +761,7 @@ class btcalpha(Exchange, ImplicitAPI):
761
761
  fetches information on multiple orders made by the user
762
762
  :param str symbol: unified market symbol of the market orders were made in
763
763
  :param int [since]: the earliest time in ms to fetch orders for
764
- :param int [limit]: the maximum number of orde structures to retrieve
764
+ :param int [limit]: the maximum number of order structures to retrieve
765
765
  :param dict [params]: extra parameters specific to the exchange API endpoint
766
766
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
767
767
  """
@@ -795,7 +795,7 @@ class btcalpha(Exchange, ImplicitAPI):
795
795
  fetches information on multiple closed orders made by the user
796
796
  :param str symbol: unified market symbol of the market orders were made in
797
797
  :param int [since]: the earliest time in ms to fetch orders for
798
- :param int [limit]: the maximum number of orde structures to retrieve
798
+ :param int [limit]: the maximum number of order structures to retrieve
799
799
  :param dict [params]: extra parameters specific to the exchange API endpoint
800
800
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
801
801
  """
@@ -177,13 +177,12 @@ class btcbox(Exchange, ImplicitAPI):
177
177
  return self.parse_order_book(response, market['symbol'])
178
178
 
179
179
  def parse_ticker(self, ticker, market: Market = None) -> Ticker:
180
- timestamp = self.milliseconds()
181
180
  symbol = self.safe_symbol(None, market)
182
181
  last = self.safe_string(ticker, 'last')
183
182
  return self.safe_ticker({
184
183
  'symbol': symbol,
185
- 'timestamp': timestamp,
186
- 'datetime': self.iso8601(timestamp),
184
+ 'timestamp': None,
185
+ 'datetime': None,
187
186
  'high': self.safe_string(ticker, 'high'),
188
187
  'low': self.safe_string(ticker, 'low'),
189
188
  'bid': self.safe_string(ticker, 'buy'),
@@ -467,7 +466,7 @@ class btcbox(Exchange, ImplicitAPI):
467
466
  fetches information on multiple orders made by the user
468
467
  :param str symbol: unified market symbol of the market orders were made in
469
468
  :param int [since]: the earliest time in ms to fetch orders for
470
- :param int [limit]: the maximum number of orde structures to retrieve
469
+ :param int [limit]: the maximum number of order structures to retrieve
471
470
  :param dict [params]: extra parameters specific to the exchange API endpoint
472
471
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
473
472
  """
@@ -970,7 +970,7 @@ class btcmarkets(Exchange, ImplicitAPI):
970
970
  fetches information on multiple orders made by the user
971
971
  :param str symbol: unified market symbol of the market orders were made in
972
972
  :param int [since]: the earliest time in ms to fetch orders for
973
- :param int [limit]: the maximum number of orde structures to retrieve
973
+ :param int [limit]: the maximum number of order structures to retrieve
974
974
  :param dict [params]: extra parameters specific to the exchange API endpoint
975
975
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
976
976
  """
@@ -1006,7 +1006,7 @@ class btcmarkets(Exchange, ImplicitAPI):
1006
1006
  fetches information on multiple closed orders made by the user
1007
1007
  :param str symbol: unified market symbol of the market orders were made in
1008
1008
  :param int [since]: the earliest time in ms to fetch orders for
1009
- :param int [limit]: the maximum number of orde structures to retrieve
1009
+ :param int [limit]: the maximum number of order structures to retrieve
1010
1010
  :param dict [params]: extra parameters specific to the exchange API endpoint
1011
1011
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1012
1012
  """
@@ -696,7 +696,7 @@ class btcturk(Exchange, ImplicitAPI):
696
696
  fetches information on multiple orders made by the user
697
697
  :param str symbol: unified market symbol of the market orders were made in
698
698
  :param int [since]: the earliest time in ms to fetch orders for
699
- :param int [limit]: the maximum number of orde structures to retrieve
699
+ :param int [limit]: the maximum number of order structures to retrieve
700
700
  :param dict [params]: extra parameters specific to the exchange API endpoint
701
701
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
702
702
  """
@@ -4141,7 +4141,7 @@ class bybit(Exchange, ImplicitAPI):
4141
4141
  :see: https://bybit-exchange.github.io/docs/v5/order/order-list
4142
4142
  :param str symbol: unified market symbol of the market orders were made in
4143
4143
  :param int [since]: the earliest time in ms to fetch orders for
4144
- :param int [limit]: the maximum number of orde structures to retrieve
4144
+ :param int [limit]: the maximum number of order structures to retrieve
4145
4145
  :param dict [params]: extra parameters specific to the exchange API endpoint
4146
4146
  :param boolean [params.stop]: True if stop order
4147
4147
  :param str [params.type]: market type, ['swap', 'option', 'spot']
@@ -4246,7 +4246,7 @@ class bybit(Exchange, ImplicitAPI):
4246
4246
  :see: https://bybit-exchange.github.io/docs/v5/order/order-list
4247
4247
  :param str symbol: unified market symbol of the market orders were made in
4248
4248
  :param int [since]: the earliest time in ms to fetch orders for
4249
- :param int [limit]: the maximum number of orde structures to retrieve
4249
+ :param int [limit]: the maximum number of order structures to retrieve
4250
4250
  :param dict [params]: extra parameters specific to the exchange API endpoint
4251
4251
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
4252
4252
  """
ccxt/async_support/cex.py CHANGED
@@ -1261,7 +1261,7 @@ class cex(Exchange, ImplicitAPI):
1261
1261
  fetches information on multiple orders made by the user
1262
1262
  :param str symbol: unified market symbol of the market orders were made in
1263
1263
  :param int [since]: the earliest time in ms to fetch orders for
1264
- :param int [limit]: the maximum number of orde structures to retrieve
1264
+ :param int [limit]: the maximum number of order structures to retrieve
1265
1265
  :param dict [params]: extra parameters specific to the exchange API endpoint
1266
1266
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1267
1267
  """
@@ -2261,6 +2261,12 @@ class coinbase(Exchange, ImplicitAPI):
2261
2261
  # "base_size": "0.2",
2262
2262
  # "limit_price": "0.006",
2263
2263
  # "post_only": False
2264
+ # },
2265
+ # "stop_limit_stop_limit_gtc": {
2266
+ # "base_size": "48.54",
2267
+ # "limit_price": "6.998",
2268
+ # "stop_price": "7.0687",
2269
+ # "stop_direction": "STOP_DIRECTION_STOP_DOWN"
2264
2270
  # }
2265
2271
  # },
2266
2272
  # "side": "SELL",
@@ -2293,11 +2299,11 @@ class coinbase(Exchange, ImplicitAPI):
2293
2299
  if symbol is not None:
2294
2300
  market = self.market(symbol)
2295
2301
  orderConfiguration = self.safe_value(order, 'order_configuration', {})
2296
- limitGTC = self.safe_value(orderConfiguration, 'limit_limit_gtc', {})
2297
- limitGTD = self.safe_value(orderConfiguration, 'limit_limit_gtd', {})
2298
- stopLimitGTC = self.safe_value(orderConfiguration, 'stop_limit_stop_limit_gtc', {})
2299
- stopLimitGTD = self.safe_value(orderConfiguration, 'stop_limit_stop_limit_gtd', {})
2300
- marketIOC = self.safe_value(orderConfiguration, 'market_market_ioc', {})
2302
+ limitGTC = self.safe_value(orderConfiguration, 'limit_limit_gtc')
2303
+ limitGTD = self.safe_value(orderConfiguration, 'limit_limit_gtd')
2304
+ stopLimitGTC = self.safe_value(orderConfiguration, 'stop_limit_stop_limit_gtc')
2305
+ stopLimitGTD = self.safe_value(orderConfiguration, 'stop_limit_stop_limit_gtd')
2306
+ marketIOC = self.safe_value(orderConfiguration, 'market_market_ioc')
2301
2307
  isLimit = ((limitGTC is not None) or (limitGTD is not None))
2302
2308
  isStop = ((stopLimitGTC is not None) or (stopLimitGTD is not None))
2303
2309
  price = None
@@ -1083,7 +1083,7 @@ class coinbasepro(Exchange, ImplicitAPI):
1083
1083
  fetches information on multiple orders made by the user
1084
1084
  :param str symbol: unified market symbol of the market orders were made in
1085
1085
  :param int [since]: the earliest time in ms to fetch orders for
1086
- :param int [limit]: the maximum number of orde structures to retrieve
1086
+ :param int [limit]: the maximum number of order structures to retrieve
1087
1087
  :param dict [params]: extra parameters specific to the exchange API endpoint
1088
1088
  :param int [params.until]: the latest time in ms to fetch open orders for
1089
1089
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
@@ -1132,7 +1132,7 @@ class coinbasepro(Exchange, ImplicitAPI):
1132
1132
  fetches information on multiple closed orders made by the user
1133
1133
  :param str symbol: unified market symbol of the market orders were made in
1134
1134
  :param int [since]: the earliest time in ms to fetch orders for
1135
- :param int [limit]: the maximum number of orde structures to retrieve
1135
+ :param int [limit]: the maximum number of order structures to retrieve
1136
1136
  :param dict [params]: extra parameters specific to the exchange API endpoint
1137
1137
  :param int [params.until]: the latest time in ms to fetch open orders for
1138
1138
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
@@ -2990,7 +2990,7 @@ class coinex(Exchange, ImplicitAPI):
2990
2990
  :see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade012_finished_order
2991
2991
  :param str symbol: unified market symbol of the market orders were made in
2992
2992
  :param int [since]: the earliest time in ms to fetch orders for
2993
- :param int [limit]: the maximum number of orde structures to retrieve
2993
+ :param int [limit]: the maximum number of order structures to retrieve
2994
2994
  :param dict [params]: extra parameters specific to the exchange API endpoint
2995
2995
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
2996
2996
  """
@@ -1179,7 +1179,7 @@ class coinlist(Exchange, ImplicitAPI):
1179
1179
  :see: https://trade-docs.coinlist.co/?javascript--nodejs#list-orders
1180
1180
  :param str symbol: unified market symbol of the market orders were made in
1181
1181
  :param int [since]: the earliest time in ms to fetch orders for
1182
- :param int [limit]: the maximum number of orde structures to retrieve(default 200, max 500)
1182
+ :param int [limit]: the maximum number of order structures to retrieve(default 200, max 500)
1183
1183
  :param dict [params]: extra parameters specific to the exchange API endpoint
1184
1184
  :param int [params.until]: the latest time in ms to fetch entries for
1185
1185
  :param string|str[] [params.status]: the status of the order - 'accepted', 'done', 'canceled', 'rejected', 'pending'(default ['accepted', 'done', 'canceled', 'rejected', 'pending'])
@@ -1760,6 +1760,7 @@ class cryptocom(Exchange, ImplicitAPI):
1760
1760
  timestamp = self.safe_integer(ticker, 't')
1761
1761
  marketId = self.safe_string(ticker, 'i')
1762
1762
  market = self.safe_market(marketId, market, '_')
1763
+ quote = self.safe_string(market, 'quote')
1763
1764
  last = self.safe_string(ticker, 'a')
1764
1765
  return self.safe_ticker({
1765
1766
  'symbol': market['symbol'],
@@ -1780,7 +1781,7 @@ class cryptocom(Exchange, ImplicitAPI):
1780
1781
  'percentage': self.safe_string(ticker, 'c'),
1781
1782
  'average': None,
1782
1783
  'baseVolume': self.safe_string(ticker, 'v'),
1783
- 'quoteVolume': self.safe_string(ticker, 'vv'),
1784
+ 'quoteVolume': self.safe_string(ticker, 'vv') if (quote == 'USD') else None,
1784
1785
  'info': ticker,
1785
1786
  }, market)
1786
1787
 
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.delta import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, Greeks, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade
9
+ from ccxt.base.types import Balances, Currency, Greeks, Int, Market, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import ArgumentsRequired
@@ -41,6 +41,8 @@ class delta(Exchange, ImplicitAPI):
41
41
  'addMargin': True,
42
42
  'cancelAllOrders': True,
43
43
  'cancelOrder': True,
44
+ 'closeAllPositions': True,
45
+ 'closePosition': False,
44
46
  'createOrder': True,
45
47
  'createReduceOnlyOrder': True,
46
48
  'editOrder': True,
@@ -3061,6 +3063,27 @@ class delta(Exchange, ImplicitAPI):
3061
3063
  'info': greeks,
3062
3064
  }
3063
3065
 
3066
+ async def close_all_positions(self, params={}) -> List[Position]:
3067
+ """
3068
+ closes all open positions for a market type
3069
+ :see: https://docs.delta.exchange/#close-all-positions
3070
+ :param dict [params]: extra parameters specific to the exchange API endpoint
3071
+ :param int [params.user_id]: the users id
3072
+ :returns dict[]: A list of `position structures <https://docs.ccxt.com/#/?id=position-structure>`
3073
+ """
3074
+ await self.load_markets()
3075
+ request = {
3076
+ 'close_all_portfolio': True,
3077
+ 'close_all_isolated': True,
3078
+ # 'user_id': 12345,
3079
+ }
3080
+ response = await self.privatePostPositionsCloseAll(self.extend(request, params))
3081
+ #
3082
+ # {"result":{},"success":true}
3083
+ #
3084
+ position = self.parse_position(self.safe_value(response, 'result', {}))
3085
+ return [position]
3086
+
3064
3087
  def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
3065
3088
  requestPath = '/' + self.version + '/' + self.implode_params(path, params)
3066
3089
  url = self.urls['api'][api] + requestPath
@@ -1898,7 +1898,7 @@ class deribit(Exchange, ImplicitAPI):
1898
1898
  fetches information on multiple closed orders made by the user
1899
1899
  :param str symbol: unified market symbol of the market orders were made in
1900
1900
  :param int [since]: the earliest time in ms to fetch orders for
1901
- :param int [limit]: the maximum number of orde structures to retrieve
1901
+ :param int [limit]: the maximum number of order structures to retrieve
1902
1902
  :param dict [params]: extra parameters specific to the exchange API endpoint
1903
1903
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1904
1904
  """
@@ -2085,7 +2085,7 @@ class digifinex(Exchange, ImplicitAPI):
2085
2085
  :see: https://docs.digifinex.com/en-ww/swap/v2/rest.html#historyorder
2086
2086
  :param str symbol: unified market symbol of the market orders were made in
2087
2087
  :param int [since]: the earliest time in ms to fetch orders for
2088
- :param int [limit]: the maximum number of orde structures to retrieve
2088
+ :param int [limit]: the maximum number of order structures to retrieve
2089
2089
  :param dict [params]: extra parameters specific to the exchange API endpoint
2090
2090
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
2091
2091
  """
@@ -4334,7 +4334,7 @@ class gate(Exchange, ImplicitAPI):
4334
4334
  :see: https://www.gate.io/docs/developers/apiv4/en/#list-options-orders
4335
4335
  :param str symbol: unified market symbol of the market orders were made in
4336
4336
  :param int [since]: the earliest time in ms to fetch orders for
4337
- :param int [limit]: the maximum number of orde structures to retrieve
4337
+ :param int [limit]: the maximum number of order structures to retrieve
4338
4338
  :param dict [params]: extra parameters specific to the exchange API endpoint
4339
4339
  :param bool [params.stop]: True for fetching stop orders
4340
4340
  :param str [params.type]: spot, swap or future, if not provided self.options['defaultType'] is used
@@ -6503,7 +6503,7 @@ class gate(Exchange, ImplicitAPI):
6503
6503
  :param str symbol: Unified CCXT market symbol
6504
6504
  :param str side: 'buy' or 'sell'
6505
6505
  :param dict [params]: extra parameters specific to the okx api endpoint
6506
- :returns [dict]: `A list of position structures <https://docs.ccxt.com/#/?id=position-structure>`
6506
+ :returns dict[]: `A list of position structures <https://docs.ccxt.com/#/?id=position-structure>`
6507
6507
  """
6508
6508
  request = {
6509
6509
  'close': True,
@@ -1729,7 +1729,7 @@ class hitbtc(Exchange, ImplicitAPI):
1729
1729
  :see: https://api.hitbtc.com/#margin-orders-history
1730
1730
  :param str symbol: unified market symbol of the market orders were made in
1731
1731
  :param int [since]: the earliest time in ms to fetch orders for
1732
- :param int [limit]: the maximum number of orde structures to retrieve
1732
+ :param int [limit]: the maximum number of order structures to retrieve
1733
1733
  :param dict [params]: extra parameters specific to the exchange API endpoint
1734
1734
  :param str [params.marginMode]: 'cross' or 'isolated' only 'isolated' is supported
1735
1735
  :param bool [params.margin]: True for fetching margin orders
@@ -892,7 +892,7 @@ class hollaex(Exchange, ImplicitAPI):
892
892
  fetches information on multiple closed orders made by the user
893
893
  :param str symbol: unified market symbol of the market orders were made in
894
894
  :param int [since]: the earliest time in ms to fetch orders for
895
- :param int [limit]: the maximum number of orde structures to retrieve
895
+ :param int [limit]: the maximum number of order structures to retrieve
896
896
  :param dict [params]: extra parameters specific to the exchange API endpoint
897
897
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
898
898
  """
@@ -945,7 +945,7 @@ class hollaex(Exchange, ImplicitAPI):
945
945
  fetches information on multiple orders made by the user
946
946
  :param str symbol: unified market symbol of the market orders were made in
947
947
  :param int [since]: the earliest time in ms to fetch orders for
948
- :param int [limit]: the maximum number of orde structures to retrieve
948
+ :param int [limit]: the maximum number of order structures to retrieve
949
949
  :param dict [params]: extra parameters specific to the exchange API endpoint
950
950
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
951
951
  """
ccxt/async_support/htx.py CHANGED
@@ -3861,7 +3861,7 @@ class htx(Exchange, ImplicitAPI):
3861
3861
  fetches information on multiple closed orders made by the user
3862
3862
  :param str symbol: unified market symbol of the market orders were made in
3863
3863
  :param int [since]: the earliest time in ms to fetch orders for
3864
- :param int [limit]: the maximum number of orde structures to retrieve
3864
+ :param int [limit]: the maximum number of order structures to retrieve
3865
3865
  :param dict [params]: extra parameters specific to the exchange API endpoint
3866
3866
  :param int [params.until]: the latest time in ms to fetch entries for
3867
3867
  :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)
@@ -1133,7 +1133,7 @@ class huobijp(Exchange, ImplicitAPI):
1133
1133
  fetches information on multiple orders made by the user
1134
1134
  :param str symbol: unified market symbol of the market orders were made in
1135
1135
  :param int [since]: the earliest time in ms to fetch orders for
1136
- :param int [limit]: the maximum number of orde structures to retrieve
1136
+ :param int [limit]: the maximum number of order structures to retrieve
1137
1137
  :param dict [params]: extra parameters specific to the exchange API endpoint
1138
1138
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1139
1139
  """
@@ -1161,7 +1161,7 @@ class huobijp(Exchange, ImplicitAPI):
1161
1161
  fetches information on multiple closed orders made by the user
1162
1162
  :param str symbol: unified market symbol of the market orders were made in
1163
1163
  :param int [since]: the earliest time in ms to fetch orders for
1164
- :param int [limit]: the maximum number of orde structures to retrieve
1164
+ :param int [limit]: the maximum number of order structures to retrieve
1165
1165
  :param dict [params]: extra parameters specific to the exchange API endpoint
1166
1166
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1167
1167
  """
@@ -885,7 +885,7 @@ class idex(Exchange, ImplicitAPI):
885
885
  fetches information on multiple closed orders made by the user
886
886
  :param str symbol: unified market symbol of the market orders were made in
887
887
  :param int [since]: the earliest time in ms to fetch orders for
888
- :param int [limit]: the maximum number of orde structures to retrieve
888
+ :param int [limit]: the maximum number of order structures to retrieve
889
889
  :param dict [params]: extra parameters specific to the exchange API endpoint
890
890
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
891
891
  """
@@ -485,7 +485,7 @@ class independentreserve(Exchange, ImplicitAPI):
485
485
  fetches information on multiple closed orders made by the user
486
486
  :param str symbol: unified market symbol of the market orders were made in
487
487
  :param int [since]: the earliest time in ms to fetch orders for
488
- :param int [limit]: the maximum number of orde structures to retrieve
488
+ :param int [limit]: the maximum number of order structures to retrieve
489
489
  :param dict [params]: extra parameters specific to the exchange API endpoint
490
490
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
491
491
  """
@@ -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
  await 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
  async 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
  await 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>`