ccxt 4.4.40__py2.py3-none-any.whl → 4.4.42__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 (173) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/binance.py +3 -0
  3. ccxt/abstract/binancecoinm.py +3 -0
  4. ccxt/abstract/binanceus.py +3 -0
  5. ccxt/abstract/binanceusdm.py +3 -0
  6. ccxt/abstract/bitmart.py +2 -0
  7. ccxt/abstract/okx.py +5 -0
  8. ccxt/ace.py +1 -1
  9. ccxt/alpaca.py +0 -1
  10. ccxt/ascendex.py +0 -1
  11. ccxt/async_support/__init__.py +1 -1
  12. ccxt/async_support/ace.py +1 -1
  13. ccxt/async_support/alpaca.py +0 -1
  14. ccxt/async_support/ascendex.py +0 -1
  15. ccxt/async_support/base/exchange.py +24 -17
  16. ccxt/async_support/bigone.py +0 -1
  17. ccxt/async_support/binance.py +27 -24
  18. ccxt/async_support/bingx.py +5 -1
  19. ccxt/async_support/bitfinex.py +123 -1
  20. ccxt/async_support/bitget.py +1 -0
  21. ccxt/async_support/bitmart.py +243 -2
  22. ccxt/async_support/blofin.py +16 -7
  23. ccxt/async_support/bybit.py +8 -8
  24. ccxt/async_support/cex.py +1 -1
  25. ccxt/async_support/coinbase.py +8 -9
  26. ccxt/async_support/coinbaseexchange.py +5 -6
  27. ccxt/async_support/coinbaseinternational.py +7 -8
  28. ccxt/async_support/coincatch.py +0 -1
  29. ccxt/async_support/coincheck.py +0 -1
  30. ccxt/async_support/coinex.py +91 -6
  31. ccxt/async_support/coinlist.py +3 -4
  32. ccxt/async_support/coinmate.py +1 -3
  33. ccxt/async_support/coinmetro.py +4 -5
  34. ccxt/async_support/coinone.py +0 -1
  35. ccxt/async_support/coinsph.py +7 -8
  36. ccxt/async_support/cryptocom.py +3 -0
  37. ccxt/async_support/currencycom.py +3 -4
  38. ccxt/async_support/defx.py +6 -7
  39. ccxt/async_support/deribit.py +1 -3
  40. ccxt/async_support/digifinex.py +0 -1
  41. ccxt/async_support/ellipx.py +0 -2
  42. ccxt/async_support/exmo.py +61 -6
  43. ccxt/async_support/gate.py +2 -3
  44. ccxt/async_support/gemini.py +4 -5
  45. ccxt/async_support/hashkey.py +79 -67
  46. ccxt/async_support/hitbtc.py +47 -5
  47. ccxt/async_support/hollaex.py +4 -6
  48. ccxt/async_support/htx.py +2 -4
  49. ccxt/async_support/huobijp.py +0 -1
  50. ccxt/async_support/hyperliquid.py +60 -1
  51. ccxt/async_support/idex.py +8 -8
  52. ccxt/async_support/independentreserve.py +0 -1
  53. ccxt/async_support/indodax.py +0 -1
  54. ccxt/async_support/kraken.py +186 -28
  55. ccxt/async_support/krakenfutures.py +75 -3
  56. ccxt/async_support/kucoin.py +6 -4
  57. ccxt/async_support/kucoinfutures.py +10 -9
  58. ccxt/async_support/kuna.py +1 -3
  59. ccxt/async_support/latoken.py +1 -3
  60. ccxt/async_support/lbank.py +0 -1
  61. ccxt/async_support/luno.py +0 -1
  62. ccxt/async_support/lykke.py +0 -1
  63. ccxt/async_support/mercado.py +0 -1
  64. ccxt/async_support/mexc.py +6 -7
  65. ccxt/async_support/ndax.py +1 -1
  66. ccxt/async_support/novadax.py +4 -6
  67. ccxt/async_support/oceanex.py +0 -1
  68. ccxt/async_support/okcoin.py +1 -3
  69. ccxt/async_support/okx.py +7 -4
  70. ccxt/async_support/onetrading.py +1 -3
  71. ccxt/async_support/p2b.py +1 -1
  72. ccxt/async_support/paradex.py +5 -7
  73. ccxt/async_support/phemex.py +8 -10
  74. ccxt/async_support/poloniex.py +1 -3
  75. ccxt/async_support/poloniexfutures.py +6 -6
  76. ccxt/async_support/probit.py +0 -1
  77. ccxt/async_support/timex.py +0 -1
  78. ccxt/async_support/tokocrypto.py +11 -14
  79. ccxt/async_support/tradeogre.py +1 -1
  80. ccxt/async_support/upbit.py +0 -1
  81. ccxt/async_support/wavesexchange.py +4 -5
  82. ccxt/async_support/whitebit.py +8 -9
  83. ccxt/async_support/woo.py +98 -12
  84. ccxt/async_support/woofipro.py +96 -15
  85. ccxt/async_support/xt.py +6 -3
  86. ccxt/async_support/yobit.py +0 -1
  87. ccxt/async_support/zaif.py +0 -1
  88. ccxt/async_support/zonda.py +1 -2
  89. ccxt/base/exchange.py +39 -20
  90. ccxt/base/types.py +10 -0
  91. ccxt/bigone.py +0 -1
  92. ccxt/binance.py +27 -24
  93. ccxt/bingx.py +5 -1
  94. ccxt/bitfinex.py +123 -1
  95. ccxt/bitget.py +1 -0
  96. ccxt/bitmart.py +243 -2
  97. ccxt/blofin.py +16 -7
  98. ccxt/bybit.py +8 -8
  99. ccxt/cex.py +1 -1
  100. ccxt/coinbase.py +8 -9
  101. ccxt/coinbaseexchange.py +5 -6
  102. ccxt/coinbaseinternational.py +7 -8
  103. ccxt/coincatch.py +0 -1
  104. ccxt/coincheck.py +0 -1
  105. ccxt/coinex.py +91 -6
  106. ccxt/coinlist.py +3 -4
  107. ccxt/coinmate.py +1 -3
  108. ccxt/coinmetro.py +4 -5
  109. ccxt/coinone.py +0 -1
  110. ccxt/coinsph.py +7 -8
  111. ccxt/cryptocom.py +3 -0
  112. ccxt/currencycom.py +3 -4
  113. ccxt/defx.py +6 -7
  114. ccxt/deribit.py +1 -3
  115. ccxt/digifinex.py +0 -1
  116. ccxt/ellipx.py +0 -2
  117. ccxt/exmo.py +61 -6
  118. ccxt/gate.py +2 -3
  119. ccxt/gemini.py +4 -5
  120. ccxt/hashkey.py +79 -67
  121. ccxt/hitbtc.py +47 -5
  122. ccxt/hollaex.py +4 -6
  123. ccxt/htx.py +2 -4
  124. ccxt/huobijp.py +0 -1
  125. ccxt/hyperliquid.py +60 -1
  126. ccxt/idex.py +8 -8
  127. ccxt/independentreserve.py +0 -1
  128. ccxt/indodax.py +0 -1
  129. ccxt/kraken.py +186 -28
  130. ccxt/krakenfutures.py +75 -3
  131. ccxt/kucoin.py +6 -4
  132. ccxt/kucoinfutures.py +10 -9
  133. ccxt/kuna.py +1 -3
  134. ccxt/latoken.py +1 -3
  135. ccxt/lbank.py +0 -1
  136. ccxt/luno.py +0 -1
  137. ccxt/lykke.py +0 -1
  138. ccxt/mercado.py +0 -1
  139. ccxt/mexc.py +6 -7
  140. ccxt/ndax.py +1 -1
  141. ccxt/novadax.py +4 -6
  142. ccxt/oceanex.py +0 -1
  143. ccxt/okcoin.py +1 -3
  144. ccxt/okx.py +7 -4
  145. ccxt/onetrading.py +1 -3
  146. ccxt/p2b.py +1 -1
  147. ccxt/paradex.py +5 -7
  148. ccxt/phemex.py +8 -10
  149. ccxt/poloniex.py +1 -3
  150. ccxt/poloniexfutures.py +6 -6
  151. ccxt/pro/__init__.py +1 -1
  152. ccxt/probit.py +0 -1
  153. ccxt/timex.py +0 -1
  154. ccxt/tokocrypto.py +11 -14
  155. ccxt/tradeogre.py +1 -1
  156. ccxt/upbit.py +0 -1
  157. ccxt/wavesexchange.py +4 -5
  158. ccxt/whitebit.py +8 -9
  159. ccxt/woo.py +98 -12
  160. ccxt/woofipro.py +96 -15
  161. ccxt/xt.py +6 -3
  162. ccxt/yobit.py +0 -1
  163. ccxt/zaif.py +0 -1
  164. ccxt/zonda.py +1 -2
  165. {ccxt-4.4.40.dist-info → ccxt-4.4.42.dist-info}/METADATA +5 -5
  166. {ccxt-4.4.40.dist-info → ccxt-4.4.42.dist-info}/RECORD +169 -173
  167. ccxt/bitbay.py +0 -17
  168. ccxt/bitfinex2.py +0 -3624
  169. ccxt/hitbtc3.py +0 -16
  170. ccxt/pro/bitfinex2.py +0 -1086
  171. {ccxt-4.4.40.dist-info → ccxt-4.4.42.dist-info}/LICENSE.txt +0 -0
  172. {ccxt-4.4.40.dist-info → ccxt-4.4.42.dist-info}/WHEEL +0 -0
  173. {ccxt-4.4.40.dist-info → ccxt-4.4.42.dist-info}/top_level.txt +0 -0
ccxt/async_support/woo.py CHANGED
@@ -321,6 +321,92 @@ class woo(Exchange, ImplicitAPI):
321
321
  },
322
322
  'brokerId': 'bc830de7-50f3-460b-9ee0-f430f83f9dad',
323
323
  },
324
+ 'features': {
325
+ 'default': {
326
+ 'sandbox': True,
327
+ 'createOrder': {
328
+ 'marginMode': True,
329
+ 'triggerPrice': True,
330
+ 'triggerPriceType': {
331
+ 'last': True,
332
+ 'mark': True,
333
+ 'index': False,
334
+ },
335
+ 'triggerDirection': False,
336
+ 'stopLossPrice': False, # todo by triggerPrice
337
+ 'takeProfitPrice': False, # todo by triggerPrice
338
+ 'attachedStopLossTakeProfit': None,
339
+ 'timeInForce': {
340
+ 'IOC': True,
341
+ 'FOK': True,
342
+ 'PO': True,
343
+ 'GTD': True,
344
+ },
345
+ 'hedged': False,
346
+ 'trailing': True,
347
+ # exchange specific params:
348
+ # 'iceberg': True,
349
+ # 'oco': True,
350
+ },
351
+ 'createOrders': None,
352
+ 'fetchMyTrades': {
353
+ 'marginMode': False,
354
+ 'limit': 500,
355
+ 'daysBack': 90,
356
+ 'untilDays': 10000,
357
+ },
358
+ 'fetchOrder': {
359
+ 'marginMode': False,
360
+ 'trigger': True,
361
+ 'trailing': False,
362
+ },
363
+ 'fetchOpenOrders': {
364
+ 'marginMode': False,
365
+ 'limit': 500,
366
+ 'trigger': True,
367
+ 'trailing': True,
368
+ },
369
+ 'fetchOrders': {
370
+ 'marginMode': False,
371
+ 'limit': 500,
372
+ 'daysBack': None,
373
+ 'untilDays': 100000,
374
+ 'trigger': True,
375
+ 'trailing': True,
376
+ },
377
+ 'fetchClosedOrders': {
378
+ 'marginMode': False,
379
+ 'limit': 500,
380
+ 'daysBackClosed': None,
381
+ 'daysBackCanceled': None,
382
+ 'untilDays': 100000,
383
+ 'trigger': True,
384
+ 'trailing': True,
385
+ },
386
+ 'fetchOHLCV': {
387
+ 'limit': 1000,
388
+ },
389
+ },
390
+ 'spot': {
391
+ 'extends': 'default',
392
+ },
393
+ 'forSwap': {
394
+ 'extends': 'default',
395
+ 'createOrder': {
396
+ 'hedged': True,
397
+ },
398
+ },
399
+ 'swap': {
400
+ 'linear': {
401
+ 'extends': 'forSwap',
402
+ },
403
+ 'inverse': None,
404
+ },
405
+ 'future': {
406
+ 'linear': None,
407
+ 'inverse': None,
408
+ },
409
+ },
324
410
  'commonCurrencies': {},
325
411
  'exceptions': {
326
412
  'exact': {
@@ -965,7 +1051,7 @@ class woo(Exchange, ImplicitAPI):
965
1051
  marginMode, params = self.handle_margin_mode_and_params('createOrder', params)
966
1052
  if marginMode is not None:
967
1053
  request['margin_mode'] = self.encode_margin_mode(marginMode)
968
- stopPrice = self.safe_number_2(params, 'triggerPrice', 'stopPrice')
1054
+ triggerPrice = self.safe_number_2(params, 'triggerPrice', 'stopPrice')
969
1055
  stopLoss = self.safe_value(params, 'stopLoss')
970
1056
  takeProfit = self.safe_value(params, 'takeProfit')
971
1057
  algoType = self.safe_string(params, 'algoType')
@@ -975,7 +1061,7 @@ class woo(Exchange, ImplicitAPI):
975
1061
  isTrailingAmountOrder = trailingAmount is not None
976
1062
  isTrailingPercentOrder = trailingPercent is not None
977
1063
  isTrailing = isTrailingAmountOrder or isTrailingPercentOrder
978
- isConditional = isTrailing or stopPrice is not None or stopLoss is not None or takeProfit is not None or (self.safe_value(params, 'childOrders') is not None)
1064
+ isConditional = isTrailing or triggerPrice is not None or stopLoss is not None or takeProfit is not None or (self.safe_value(params, 'childOrders') is not None)
979
1065
  isMarket = orderType == 'MARKET'
980
1066
  timeInForce = self.safe_string_lower(params, 'timeInForce')
981
1067
  postOnly = self.is_post_only(isMarket, None, params)
@@ -1028,9 +1114,9 @@ class woo(Exchange, ImplicitAPI):
1028
1114
  elif isTrailingPercentOrder:
1029
1115
  convertedTrailingPercent = Precise.string_div(trailingPercent, '100')
1030
1116
  request['callbackRate'] = convertedTrailingPercent
1031
- elif stopPrice is not None:
1117
+ elif triggerPrice is not None:
1032
1118
  if algoType != 'TRAILING_STOP':
1033
- request['triggerPrice'] = self.price_to_precision(symbol, stopPrice)
1119
+ request['triggerPrice'] = self.price_to_precision(symbol, triggerPrice)
1034
1120
  request['algoType'] = 'STOP'
1035
1121
  elif (stopLoss is not None) or (takeProfit is not None):
1036
1122
  request['algoType'] = 'BRACKET'
@@ -1145,9 +1231,9 @@ class woo(Exchange, ImplicitAPI):
1145
1231
  clientOrderIdUnified = self.safe_string_2(params, 'clOrdID', 'clientOrderId')
1146
1232
  clientOrderIdExchangeSpecific = self.safe_string(params, 'client_order_id', clientOrderIdUnified)
1147
1233
  isByClientOrder = clientOrderIdExchangeSpecific is not None
1148
- stopPrice = self.safe_number_n(params, ['triggerPrice', 'stopPrice', 'takeProfitPrice', 'stopLossPrice'])
1149
- if stopPrice is not None:
1150
- request['triggerPrice'] = self.price_to_precision(symbol, stopPrice)
1234
+ triggerPrice = self.safe_number_n(params, ['triggerPrice', 'stopPrice', 'takeProfitPrice', 'stopLossPrice'])
1235
+ if triggerPrice is not None:
1236
+ request['triggerPrice'] = self.price_to_precision(symbol, triggerPrice)
1151
1237
  trailingTriggerPrice = self.safe_string_2(params, 'trailingTriggerPrice', 'activatedPrice', self.number_to_string(price))
1152
1238
  trailingAmount = self.safe_string_2(params, 'trailingAmount', 'callbackValue')
1153
1239
  trailingPercent = self.safe_string_2(params, 'trailingPercent', 'callbackRate')
@@ -1163,7 +1249,7 @@ class woo(Exchange, ImplicitAPI):
1163
1249
  convertedTrailingPercent = Precise.string_div(trailingPercent, '100')
1164
1250
  request['callbackRate'] = convertedTrailingPercent
1165
1251
  params = self.omit(params, ['clOrdID', 'clientOrderId', 'client_order_id', 'stopPrice', 'triggerPrice', 'takeProfitPrice', 'stopLossPrice', 'trailingTriggerPrice', 'trailingAmount', 'trailingPercent'])
1166
- isConditional = isTrailing or (stopPrice is not None) or (self.safe_value(params, 'childOrders') is not None)
1252
+ isConditional = isTrailing or (triggerPrice is not None) or (self.safe_value(params, 'childOrders') is not None)
1167
1253
  response = None
1168
1254
  if isByClientOrder:
1169
1255
  request['client_order_id'] = clientOrderIdExchangeSpecific
@@ -1570,7 +1656,7 @@ class woo(Exchange, ImplicitAPI):
1570
1656
  fee = self.safe_number_2(order, 'total_fee', 'totalFee')
1571
1657
  feeCurrency = self.safe_string_2(order, 'fee_asset', 'feeAsset')
1572
1658
  transactions = self.safe_value(order, 'Transactions')
1573
- stopPrice = self.safe_number(order, 'triggerPrice')
1659
+ triggerPrice = self.safe_number(order, 'triggerPrice')
1574
1660
  takeProfitPrice: Num = None
1575
1661
  stopLossPrice: Num = None
1576
1662
  childOrders = self.safe_value(order, 'childOrders')
@@ -1599,8 +1685,7 @@ class woo(Exchange, ImplicitAPI):
1599
1685
  'reduceOnly': self.safe_bool(order, 'reduce_only'),
1600
1686
  'side': side,
1601
1687
  'price': price,
1602
- 'stopPrice': stopPrice,
1603
- 'triggerPrice': stopPrice,
1688
+ 'triggerPrice': triggerPrice,
1604
1689
  'takeProfitPrice': takeProfitPrice,
1605
1690
  'stopLossPrice': stopLossPrice,
1606
1691
  'average': average,
@@ -1808,7 +1893,7 @@ class woo(Exchange, ImplicitAPI):
1808
1893
  """
1809
1894
  fetch all trades made by the user
1810
1895
 
1811
- https://docs.woox.io/#get-trades
1896
+ https://docs.woox.io/#get-trade-history
1812
1897
 
1813
1898
  :param str symbol: unified market symbol
1814
1899
  :param int [since]: the earliest time in ms to fetch trades for
@@ -1829,6 +1914,7 @@ class woo(Exchange, ImplicitAPI):
1829
1914
  request['symbol'] = market['id']
1830
1915
  if since is not None:
1831
1916
  request['start_t'] = since
1917
+ request, params = self.handle_until_option('end_t', request, params)
1832
1918
  if limit is not None:
1833
1919
  request['size'] = limit
1834
1920
  else:
@@ -308,6 +308,88 @@ class woofipro(Exchange, ImplicitAPI):
308
308
  'brokerId': 'CCXT',
309
309
  'verifyingContractAddress': '0x6F7a338F2aA472838dEFD3283eB360d4Dff5D203',
310
310
  },
311
+ 'features': {
312
+ 'default': {
313
+ 'sandbox': True,
314
+ 'createOrder': {
315
+ 'marginMode': False,
316
+ 'triggerPrice': True,
317
+ 'triggerPriceType': None,
318
+ 'triggerDirection': False,
319
+ 'stopLossPrice': False, # todo by triggerPrice
320
+ 'takeProfitPrice': False, # todo by triggerPrice
321
+ 'attachedStopLossTakeProfit': None,
322
+ 'timeInForce': {
323
+ 'IOC': True,
324
+ 'FOK': True,
325
+ 'PO': True,
326
+ 'GTD': False,
327
+ },
328
+ 'hedged': False,
329
+ 'trailing': True,
330
+ # exchange specific
331
+ # 'iceberg': True,
332
+ },
333
+ 'createOrders': {
334
+ 'max': 10,
335
+ },
336
+ 'fetchMyTrades': {
337
+ 'marginMode': False,
338
+ 'limit': 500,
339
+ 'daysBack': None,
340
+ 'untilDays': 100000,
341
+ },
342
+ 'fetchOrder': {
343
+ 'marginMode': False,
344
+ 'trigger': True,
345
+ 'trailing': False,
346
+ },
347
+ 'fetchOpenOrders': {
348
+ 'marginMode': False,
349
+ 'limit': 500,
350
+ 'trigger': True,
351
+ 'trailing': False,
352
+ },
353
+ 'fetchOrders': None,
354
+ 'fetchClosedOrders': {
355
+ 'marginMode': False,
356
+ 'limit': 500,
357
+ 'daysBackClosed': None,
358
+ 'daysBackCanceled': None,
359
+ 'untilDays': 100000,
360
+ 'trigger': True,
361
+ 'trailing': False,
362
+ },
363
+ 'fetchOHLCV': {
364
+ 'limit': 1000,
365
+ },
366
+ },
367
+ 'spot': {
368
+ 'extends': 'default',
369
+ },
370
+ 'forDerivatives': {
371
+ 'extends': 'default',
372
+ 'createOrder': {
373
+ # todo: implementation needs unification
374
+ 'triggerPriceType': None,
375
+ 'attachedStopLossTakeProfit': {
376
+ # todo: implementation needs unification
377
+ 'triggerPriceType': None,
378
+ 'limitPrice': False,
379
+ },
380
+ },
381
+ },
382
+ 'swap': {
383
+ 'linear': {
384
+ 'extends': 'forDerivatives',
385
+ },
386
+ 'inverse': None,
387
+ },
388
+ 'future': {
389
+ 'linear': None,
390
+ 'inverse': None,
391
+ },
392
+ },
311
393
  'commonCurrencies': {},
312
394
  'exceptions': {
313
395
  'exact': {
@@ -1162,7 +1244,7 @@ class woofipro(Exchange, ImplicitAPI):
1162
1244
  fee = self.safe_value_2(order, 'total_fee', 'totalFee')
1163
1245
  feeCurrency = self.safe_string_2(order, 'fee_asset', 'feeAsset')
1164
1246
  transactions = self.safe_value(order, 'Transactions')
1165
- stopPrice = self.safe_number(order, 'triggerPrice')
1247
+ triggerPrice = self.safe_number(order, 'triggerPrice')
1166
1248
  takeProfitPrice: Num = None
1167
1249
  stopLossPrice: Num = None
1168
1250
  childOrders = self.safe_value(order, 'childOrders')
@@ -1191,8 +1273,7 @@ class woofipro(Exchange, ImplicitAPI):
1191
1273
  'reduceOnly': self.safe_bool(order, 'reduce_only'),
1192
1274
  'side': side,
1193
1275
  'price': price,
1194
- 'stopPrice': stopPrice,
1195
- 'triggerPrice': stopPrice,
1276
+ 'triggerPrice': triggerPrice,
1196
1277
  'takeProfitPrice': takeProfitPrice,
1197
1278
  'stopLossPrice': stopLossPrice,
1198
1279
  'average': average,
@@ -1260,11 +1341,11 @@ class woofipro(Exchange, ImplicitAPI):
1260
1341
  'symbol': market['id'],
1261
1342
  'side': orderSide,
1262
1343
  }
1263
- stopPrice = self.safe_string_2(params, 'triggerPrice', 'stopPrice')
1344
+ triggerPrice = self.safe_string_2(params, 'triggerPrice', 'stopPrice')
1264
1345
  stopLoss = self.safe_value(params, 'stopLoss')
1265
1346
  takeProfit = self.safe_value(params, 'takeProfit')
1266
1347
  algoType = self.safe_string(params, 'algoType')
1267
- isConditional = stopPrice is not None or stopLoss is not None or takeProfit is not None or (self.safe_value(params, 'childOrders') is not None)
1348
+ isConditional = triggerPrice is not None or stopLoss is not None or takeProfit is not None or (self.safe_value(params, 'childOrders') is not None)
1268
1349
  isMarket = orderType == 'MARKET'
1269
1350
  timeInForce = self.safe_string_lower(params, 'timeInForce')
1270
1351
  postOnly = self.is_post_only(isMarket, None, params)
@@ -1290,8 +1371,8 @@ class woofipro(Exchange, ImplicitAPI):
1290
1371
  clientOrderId = self.safe_string_n(params, ['clOrdID', 'clientOrderId', 'client_order_id'])
1291
1372
  if clientOrderId is not None:
1292
1373
  request['client_order_id'] = clientOrderId
1293
- if stopPrice is not None:
1294
- request['trigger_price'] = self.price_to_precision(symbol, stopPrice)
1374
+ if triggerPrice is not None:
1375
+ request['trigger_price'] = self.price_to_precision(symbol, triggerPrice)
1295
1376
  request['algo_type'] = 'STOP'
1296
1377
  elif (stopLoss is not None) or (takeProfit is not None):
1297
1378
  request['algo_type'] = 'TP_SL'
@@ -1352,10 +1433,10 @@ class woofipro(Exchange, ImplicitAPI):
1352
1433
  await self.load_markets()
1353
1434
  market = self.market(symbol)
1354
1435
  request = self.create_order_request(symbol, type, side, amount, price, params)
1355
- stopPrice = self.safe_string_2(params, 'triggerPrice', 'stopPrice')
1436
+ triggerPrice = self.safe_string_2(params, 'triggerPrice', 'stopPrice')
1356
1437
  stopLoss = self.safe_value(params, 'stopLoss')
1357
1438
  takeProfit = self.safe_value(params, 'takeProfit')
1358
- isConditional = stopPrice is not None or stopLoss is not None or takeProfit is not None or (self.safe_value(params, 'childOrders') is not None)
1439
+ isConditional = triggerPrice is not None or stopLoss is not None or takeProfit is not None or (self.safe_value(params, 'childOrders') is not None)
1359
1440
  response = None
1360
1441
  if isConditional:
1361
1442
  response = await self.v1PrivatePostAlgoOrder(request)
@@ -1414,10 +1495,10 @@ class woofipro(Exchange, ImplicitAPI):
1414
1495
  amount = self.safe_value(rawOrder, 'amount')
1415
1496
  price = self.safe_value(rawOrder, 'price')
1416
1497
  orderParams = self.safe_dict(rawOrder, 'params', {})
1417
- stopPrice = self.safe_string_2(orderParams, 'triggerPrice', 'stopPrice')
1498
+ triggerPrice = self.safe_string_2(orderParams, 'triggerPrice', 'stopPrice')
1418
1499
  stopLoss = self.safe_value(orderParams, 'stopLoss')
1419
1500
  takeProfit = self.safe_value(orderParams, 'takeProfit')
1420
- isConditional = stopPrice is not None or stopLoss is not None or takeProfit is not None or (self.safe_value(orderParams, 'childOrders') is not None)
1501
+ isConditional = triggerPrice is not None or stopLoss is not None or takeProfit is not None or (self.safe_value(orderParams, 'childOrders') is not None)
1421
1502
  if isConditional:
1422
1503
  raise NotSupported(self.id + 'createOrders() only support non-stop order')
1423
1504
  orderRequest = self.create_order_request(marketId, type, side, amount, price, orderParams)
@@ -1471,10 +1552,10 @@ class woofipro(Exchange, ImplicitAPI):
1471
1552
  request: dict = {
1472
1553
  'order_id': id,
1473
1554
  }
1474
- stopPrice = self.safe_string_n(params, ['triggerPrice', 'stopPrice', 'takeProfitPrice', 'stopLossPrice'])
1475
- if stopPrice is not None:
1476
- request['triggerPrice'] = self.price_to_precision(symbol, stopPrice)
1477
- isConditional = (stopPrice is not None) or (self.safe_value(params, 'childOrders') is not None)
1555
+ triggerPrice = self.safe_string_n(params, ['triggerPrice', 'stopPrice', 'takeProfitPrice', 'stopLossPrice'])
1556
+ if triggerPrice is not None:
1557
+ request['triggerPrice'] = self.price_to_precision(symbol, triggerPrice)
1558
+ isConditional = (triggerPrice is not None) or (self.safe_value(params, 'childOrders') is not None)
1478
1559
  orderQtyKey = 'quantity' if isConditional else 'order_quantity'
1479
1560
  priceKey = 'price' if isConditional else 'order_price'
1480
1561
  if price is not None:
ccxt/async_support/xt.py CHANGED
@@ -2232,7 +2232,8 @@ class xt(Exchange, ImplicitAPI):
2232
2232
  :param str [params.timeInForce]: 'GTC', 'IOC', 'FOK' or 'GTX'
2233
2233
  :param str [params.entrustType]: 'TAKE_PROFIT', 'STOP', 'TAKE_PROFIT_MARKET', 'STOP_MARKET', 'TRAILING_STOP_MARKET', required if stopPrice is defined, currently isn't functioning on xt's side
2234
2234
  :param str [params.triggerPriceType]: 'INDEX_PRICE', 'MARK_PRICE', 'LATEST_PRICE', required if stopPrice is defined
2235
- :param float [params.stopPrice]: price to trigger a stop order
2235
+ :param float [params.triggerPrice]: price to trigger a stop order
2236
+ :param float [params.stopPrice]: alias for triggerPrice
2236
2237
  :param float [params.stopLoss]: price to set a stop-loss on an open position
2237
2238
  :param float [params.takeProfit]: price to set a take-profit on an open position
2238
2239
  :returns dict: an `order structure <https://docs.ccxt.com/en/latest/manual.html#order-structure>`
@@ -3334,7 +3335,7 @@ class xt(Exchange, ImplicitAPI):
3334
3335
  'postOnly': None,
3335
3336
  'side': self.safe_string_lower_2(order, 'side', 'orderSide'),
3336
3337
  'price': self.safe_number(order, 'price'),
3337
- 'stopPrice': self.safe_number(order, 'stopPrice'),
3338
+ 'triggerPrice': self.safe_number(order, 'stopPrice'),
3338
3339
  'stopLoss': self.safe_number(order, 'triggerStopPrice'),
3339
3340
  'takeProfit': self.safe_number(order, 'triggerProfitPrice'),
3340
3341
  'amount': amount,
@@ -4175,6 +4176,8 @@ class xt(Exchange, ImplicitAPI):
4175
4176
  symbol = self.safe_symbol(marketId, market, '_', 'swap')
4176
4177
  timestamp = self.safe_integer(contract, 'nextCollectionTime')
4177
4178
  interval = self.safe_string(contract, 'collectionInternal')
4179
+ if interval is not None:
4180
+ interval = interval + 'h'
4178
4181
  return {
4179
4182
  'info': contract,
4180
4183
  'symbol': symbol,
@@ -4193,7 +4196,7 @@ class xt(Exchange, ImplicitAPI):
4193
4196
  'previousFundingRate': None,
4194
4197
  'previousFundingTimestamp': None,
4195
4198
  'previousFundingDatetime': None,
4196
- 'interval': interval + 'h',
4199
+ 'interval': interval,
4197
4200
  }
4198
4201
 
4199
4202
  async def fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
@@ -1005,7 +1005,6 @@ class yobit(Exchange, ImplicitAPI):
1005
1005
  'postOnly': None,
1006
1006
  'side': side,
1007
1007
  'price': price,
1008
- 'stopPrice': None,
1009
1008
  'triggerPrice': None,
1010
1009
  'cost': None,
1011
1010
  'amount': amount,
@@ -537,7 +537,6 @@ class zaif(Exchange, ImplicitAPI):
537
537
  'postOnly': None,
538
538
  'side': side,
539
539
  'price': price,
540
- 'stopPrice': None,
541
540
  'triggerPrice': None,
542
541
  'cost': None,
543
542
  'amount': amount,
@@ -505,7 +505,6 @@ class zonda(Exchange, ImplicitAPI):
505
505
  'postOnly': postOnly,
506
506
  'side': self.safe_string_lower(order, 'offerType'),
507
507
  'price': self.safe_string(order, 'rate'),
508
- 'stopPrice': None,
509
508
  'triggerPrice': None,
510
509
  'amount': amount,
511
510
  'cost': None,
@@ -1400,7 +1399,7 @@ class zonda(Exchange, ImplicitAPI):
1400
1399
  response = None
1401
1400
  if isStopOrder:
1402
1401
  if not isStopLossPrice:
1403
- raise ExchangeError(self.id + ' createOrder() zonda requires `triggerPrice` or `stopPrice` parameter for stop-limit or stop-market orders')
1402
+ raise ExchangeError(self.id + ' createOrder() zonda requires `triggerPrice` parameter for stop-limit or stop-market orders')
1404
1403
  request['stopRate'] = self.price_to_precision(symbol, stopLossPrice)
1405
1404
  response = await self.v1_01PrivatePostTradingStopOfferSymbol(self.extend(request, params))
1406
1405
  else:
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.40'
7
+ __version__ = '4.4.42'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -1940,6 +1940,7 @@ class Exchange(object):
1940
1940
  'fetchOHLCV': None,
1941
1941
  'fetchOHLCVWs': None,
1942
1942
  'fetchOpenInterest': None,
1943
+ 'fetchOpenInterests': None,
1943
1944
  'fetchOpenInterestHistory': None,
1944
1945
  'fetchOpenOrder': None,
1945
1946
  'fetchOpenOrders': None,
@@ -2691,6 +2692,9 @@ class Exchange(object):
2691
2692
  def fetch_open_interest(self, symbol: str, params={}):
2692
2693
  raise NotSupported(self.id + ' fetchOpenInterest() is not supported yet')
2693
2694
 
2695
+ def fetch_open_interests(self, symbols: Strings = None, params={}):
2696
+ raise NotSupported(self.id + ' fetchOpenInterests() is not supported yet')
2697
+
2694
2698
  def sign_in(self, params={}):
2695
2699
  raise NotSupported(self.id + ' signIn() is not supported yet')
2696
2700
 
@@ -4546,10 +4550,14 @@ class Exchange(object):
4546
4550
 
4547
4551
  def handle_option_and_params_2(self, params: object, methodName1: str, optionName1: str, optionName2: str, defaultValue=None):
4548
4552
  value = None
4549
- value, params = self.handle_option_and_params(params, methodName1, optionName1, defaultValue)
4553
+ value, params = self.handle_option_and_params(params, methodName1, optionName1)
4554
+ if value is not None:
4555
+ # omit optionName2 too from params
4556
+ params = self.omit(params, optionName2)
4557
+ return [value, params]
4550
4558
  # if still None, try optionName2
4551
4559
  value2 = None
4552
- value2, params = self.handle_option_and_params(params, methodName1, optionName2, value)
4560
+ value2, params = self.handle_option_and_params(params, methodName1, optionName2, defaultValue)
4553
4561
  return [value2, params]
4554
4562
 
4555
4563
  def handle_option(self, methodName: str, optionName: str, defaultValue=None):
@@ -5450,44 +5458,44 @@ class Exchange(object):
5450
5458
  query = self.extend(params, {'reduceOnly': True})
5451
5459
  return self.create_order_ws(symbol, type, side, amount, price, query)
5452
5460
 
5453
- def create_stop_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, stopPrice: Num = None, params={}):
5461
+ def create_stop_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, triggerPrice: Num = None, params={}):
5454
5462
  if not self.has['createStopOrder']:
5455
5463
  raise NotSupported(self.id + ' createStopOrder() is not supported yet')
5456
- if stopPrice is None:
5464
+ if triggerPrice is None:
5457
5465
  raise ArgumentsRequired(self.id + ' create_stop_order() requires a stopPrice argument')
5458
- query = self.extend(params, {'stopPrice': stopPrice})
5466
+ query = self.extend(params, {'stopPrice': triggerPrice})
5459
5467
  return self.create_order(symbol, type, side, amount, price, query)
5460
5468
 
5461
- def create_stop_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, stopPrice: Num = None, params={}):
5469
+ def create_stop_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, triggerPrice: Num = None, params={}):
5462
5470
  if not self.has['createStopOrderWs']:
5463
5471
  raise NotSupported(self.id + ' createStopOrderWs() is not supported yet')
5464
- if stopPrice is None:
5472
+ if triggerPrice is None:
5465
5473
  raise ArgumentsRequired(self.id + ' createStopOrderWs() requires a stopPrice argument')
5466
- query = self.extend(params, {'stopPrice': stopPrice})
5474
+ query = self.extend(params, {'stopPrice': triggerPrice})
5467
5475
  return self.create_order_ws(symbol, type, side, amount, price, query)
5468
5476
 
5469
- def create_stop_limit_order(self, symbol: str, side: OrderSide, amount: float, price: float, stopPrice: float, params={}):
5477
+ def create_stop_limit_order(self, symbol: str, side: OrderSide, amount: float, price: float, triggerPrice: float, params={}):
5470
5478
  if not self.has['createStopLimitOrder']:
5471
5479
  raise NotSupported(self.id + ' createStopLimitOrder() is not supported yet')
5472
- query = self.extend(params, {'stopPrice': stopPrice})
5480
+ query = self.extend(params, {'stopPrice': triggerPrice})
5473
5481
  return self.create_order(symbol, 'limit', side, amount, price, query)
5474
5482
 
5475
- def create_stop_limit_order_ws(self, symbol: str, side: OrderSide, amount: float, price: float, stopPrice: float, params={}):
5483
+ def create_stop_limit_order_ws(self, symbol: str, side: OrderSide, amount: float, price: float, triggerPrice: float, params={}):
5476
5484
  if not self.has['createStopLimitOrderWs']:
5477
5485
  raise NotSupported(self.id + ' createStopLimitOrderWs() is not supported yet')
5478
- query = self.extend(params, {'stopPrice': stopPrice})
5486
+ query = self.extend(params, {'stopPrice': triggerPrice})
5479
5487
  return self.create_order_ws(symbol, 'limit', side, amount, price, query)
5480
5488
 
5481
- def create_stop_market_order(self, symbol: str, side: OrderSide, amount: float, stopPrice: float, params={}):
5489
+ def create_stop_market_order(self, symbol: str, side: OrderSide, amount: float, triggerPrice: float, params={}):
5482
5490
  if not self.has['createStopMarketOrder']:
5483
5491
  raise NotSupported(self.id + ' createStopMarketOrder() is not supported yet')
5484
- query = self.extend(params, {'stopPrice': stopPrice})
5492
+ query = self.extend(params, {'stopPrice': triggerPrice})
5485
5493
  return self.create_order(symbol, 'market', side, amount, None, query)
5486
5494
 
5487
- def create_stop_market_order_ws(self, symbol: str, side: OrderSide, amount: float, stopPrice: float, params={}):
5495
+ def create_stop_market_order_ws(self, symbol: str, side: OrderSide, amount: float, triggerPrice: float, params={}):
5488
5496
  if not self.has['createStopMarketOrderWs']:
5489
5497
  raise NotSupported(self.id + ' createStopMarketOrderWs() is not supported yet')
5490
- query = self.extend(params, {'stopPrice': stopPrice})
5498
+ query = self.extend(params, {'stopPrice': triggerPrice})
5491
5499
  return self.create_order_ws(symbol, 'market', side, amount, None, query)
5492
5500
 
5493
5501
  def safe_currency_code(self, currencyId: Str, currency: Currency = None):
@@ -5639,6 +5647,13 @@ class Exchange(object):
5639
5647
  result[parsed['symbol']] = parsed
5640
5648
  return result
5641
5649
 
5650
+ def parse_open_interests(self, response, market: Market = None):
5651
+ result = {}
5652
+ for i in range(0, len(response)):
5653
+ parsed = self.parse_open_interest(response[i], market)
5654
+ result[parsed['symbol']] = parsed
5655
+ return result
5656
+
5642
5657
  def parse_long_short_ratio(self, info: dict, market: Market = None):
5643
5658
  raise NotSupported(self.id + ' parseLongShortRatio() is not supported yet')
5644
5659
 
@@ -5733,7 +5748,7 @@ class Exchange(object):
5733
5748
  def parse_open_interest(self, interest, market: Market = None):
5734
5749
  raise NotSupported(self.id + ' parseOpenInterest() is not supported yet')
5735
5750
 
5736
- def parse_open_interests(self, response, market=None, since: Int = None, limit: Int = None):
5751
+ def parse_open_interests_history(self, response, market=None, since: Int = None, limit: Int = None):
5737
5752
  interests = []
5738
5753
  for i in range(0, len(response)):
5739
5754
  entry = response[i]
@@ -6029,7 +6044,7 @@ class Exchange(object):
6029
6044
  maxEntriesPerRequest = 1000 # default to 1000
6030
6045
  return [maxEntriesPerRequest, params]
6031
6046
 
6032
- def fetch_paginated_call_dynamic(self, method: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}, maxEntriesPerRequest: Int = None):
6047
+ def fetch_paginated_call_dynamic(self, method: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}, maxEntriesPerRequest: Int = None, removeRepeated=True):
6033
6048
  maxCalls = None
6034
6049
  maxCalls, params = self.handle_option_and_params(params, method, 'paginationCalls', 10)
6035
6050
  maxRetries = None
@@ -6037,6 +6052,8 @@ class Exchange(object):
6037
6052
  paginationDirection = None
6038
6053
  paginationDirection, params = self.handle_option_and_params(params, method, 'paginationDirection', 'backward')
6039
6054
  paginationTimestamp = None
6055
+ removeRepeatedOption = removeRepeated
6056
+ removeRepeatedOption, params = self.handle_option_and_params(params, method, 'removeRepeated', removeRepeated)
6040
6057
  calls = 0
6041
6058
  result = []
6042
6059
  errors = 0
@@ -6090,7 +6107,9 @@ class Exchange(object):
6090
6107
  errors += 1
6091
6108
  if errors > maxRetries:
6092
6109
  raise e
6093
- uniqueResults = self.remove_repeated_elements_from_array(result)
6110
+ uniqueResults = result
6111
+ if removeRepeatedOption:
6112
+ uniqueResults = self.remove_repeated_elements_from_array(result)
6094
6113
  key = 0 if (method == 'fetchOHLCV') else 'timestamp'
6095
6114
  return self.filter_by_since_limit(uniqueResults, since, limit, key)
6096
6115
 
ccxt/base/types.py CHANGED
@@ -496,6 +496,15 @@ class FundingRate(TypedDict):
496
496
  info: Dict[str, Any]
497
497
  interval: Str
498
498
 
499
+ class OpenInterest(TypedDict):
500
+ symbol: Str
501
+ openInterestAmount: Num
502
+ openInterestValue: Num
503
+ baseVolume: Num
504
+ quoteVolume: Num
505
+ timestamp: Int
506
+ datetime: Str
507
+ info: Dict[str, Any]
499
508
 
500
509
  class LeverageTier:
501
510
  tier: Num
@@ -556,6 +565,7 @@ class BorrowInterest:
556
565
 
557
566
 
558
567
  FundingRates = Dict[Str, FundingRate]
568
+ OpenInterests = Dict[Str, OpenInterest]
559
569
  LastPrices = Dict[Str, LastPrice]
560
570
  Currencies = Dict[Str, CurrencyInterface]
561
571
  TradingFees = Dict[Str, TradingFeeInterface]
ccxt/bigone.py CHANGED
@@ -1333,7 +1333,6 @@ class bigone(Exchange, ImplicitAPI):
1333
1333
  'postOnly': self.safe_bool(order, 'post_only'),
1334
1334
  'side': side,
1335
1335
  'price': price,
1336
- 'stopPrice': triggerPrice,
1337
1336
  'triggerPrice': triggerPrice,
1338
1337
  'amount': amount,
1339
1338
  'cost': cost,