ccxt 4.4.38__py2.py3-none-any.whl → 4.4.40__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/digifinex.py +1 -0
  3. ccxt/abstract/mexc.py +1 -0
  4. ccxt/abstract/woo.py +2 -2
  5. ccxt/alpaca.py +74 -3
  6. ccxt/ascendex.py +9 -9
  7. ccxt/async_support/__init__.py +1 -1
  8. ccxt/async_support/alpaca.py +74 -3
  9. ccxt/async_support/ascendex.py +9 -9
  10. ccxt/async_support/base/exchange.py +1 -1
  11. ccxt/async_support/base/ws/aiohttp_client.py +2 -2
  12. ccxt/async_support/binance.py +13 -17
  13. ccxt/async_support/bingx.py +1 -2
  14. ccxt/async_support/bit2c.py +0 -1
  15. ccxt/async_support/bitbank.py +0 -1
  16. ccxt/async_support/bitbns.py +0 -1
  17. ccxt/async_support/bitfinex.py +15 -16
  18. ccxt/async_support/bitfinex1.py +0 -1
  19. ccxt/async_support/bitflyer.py +0 -1
  20. ccxt/async_support/bitget.py +1 -2
  21. ccxt/async_support/bithumb.py +0 -1
  22. ccxt/async_support/bitmart.py +3 -4
  23. ccxt/async_support/bitmex.py +5 -6
  24. ccxt/async_support/bitopro.py +4 -5
  25. ccxt/async_support/bitrue.py +5 -7
  26. ccxt/async_support/bitso.py +1 -2
  27. ccxt/async_support/bitstamp.py +1 -2
  28. ccxt/async_support/bitteam.py +1 -3
  29. ccxt/async_support/bitvavo.py +2 -4
  30. ccxt/async_support/blockchaincom.py +5 -5
  31. ccxt/async_support/blofin.py +10 -10
  32. ccxt/async_support/btcalpha.py +0 -1
  33. ccxt/async_support/btcbox.py +0 -1
  34. ccxt/async_support/btcmarkets.py +1 -3
  35. ccxt/async_support/bybit.py +2 -3
  36. ccxt/async_support/cex.py +1 -1
  37. ccxt/async_support/coinbase.py +77 -1
  38. ccxt/async_support/coinbaseexchange.py +1 -1
  39. ccxt/async_support/coinbaseinternational.py +62 -0
  40. ccxt/async_support/coincatch.py +1 -1
  41. ccxt/async_support/coinex.py +9 -9
  42. ccxt/async_support/coinlist.py +1 -1
  43. ccxt/async_support/coinmetro.py +1 -1
  44. ccxt/async_support/cryptocom.py +91 -2
  45. ccxt/async_support/currencycom.py +1 -1
  46. ccxt/async_support/defx.py +1 -2
  47. ccxt/async_support/delta.py +1 -1
  48. ccxt/async_support/digifinex.py +58 -19
  49. ccxt/async_support/exmo.py +2 -2
  50. ccxt/async_support/gate.py +1 -1
  51. ccxt/async_support/hashkey.py +3 -5
  52. ccxt/async_support/htx.py +155 -33
  53. ccxt/async_support/hyperliquid.py +1 -1
  54. ccxt/async_support/kraken.py +1 -1
  55. ccxt/async_support/kucoin.py +25 -24
  56. ccxt/async_support/luno.py +1 -1
  57. ccxt/async_support/mexc.py +173 -26
  58. ccxt/async_support/ndax.py +1 -1
  59. ccxt/async_support/okcoin.py +18 -18
  60. ccxt/async_support/okx.py +22 -21
  61. ccxt/async_support/phemex.py +12 -8
  62. ccxt/async_support/poloniex.py +1 -1
  63. ccxt/async_support/poloniexfutures.py +6 -6
  64. ccxt/async_support/vertex.py +11 -11
  65. ccxt/async_support/woo.py +39 -39
  66. ccxt/async_support/woofipro.py +24 -24
  67. ccxt/async_support/xt.py +26 -26
  68. ccxt/async_support/zonda.py +1 -1
  69. ccxt/base/exchange.py +32 -25
  70. ccxt/binance.py +13 -17
  71. ccxt/bingx.py +1 -2
  72. ccxt/bit2c.py +0 -1
  73. ccxt/bitbank.py +0 -1
  74. ccxt/bitbns.py +0 -1
  75. ccxt/bitfinex.py +15 -16
  76. ccxt/bitfinex1.py +0 -1
  77. ccxt/bitflyer.py +0 -1
  78. ccxt/bitget.py +1 -2
  79. ccxt/bithumb.py +0 -1
  80. ccxt/bitmart.py +3 -4
  81. ccxt/bitmex.py +5 -6
  82. ccxt/bitopro.py +4 -5
  83. ccxt/bitrue.py +5 -7
  84. ccxt/bitso.py +1 -2
  85. ccxt/bitstamp.py +1 -2
  86. ccxt/bitteam.py +1 -3
  87. ccxt/bitvavo.py +2 -4
  88. ccxt/blockchaincom.py +5 -5
  89. ccxt/blofin.py +10 -10
  90. ccxt/btcalpha.py +0 -1
  91. ccxt/btcbox.py +0 -1
  92. ccxt/btcmarkets.py +1 -3
  93. ccxt/bybit.py +2 -3
  94. ccxt/cex.py +1 -1
  95. ccxt/coinbase.py +77 -1
  96. ccxt/coinbaseexchange.py +1 -1
  97. ccxt/coinbaseinternational.py +62 -0
  98. ccxt/coincatch.py +1 -1
  99. ccxt/coinex.py +9 -9
  100. ccxt/coinlist.py +1 -1
  101. ccxt/coinmetro.py +1 -1
  102. ccxt/cryptocom.py +91 -2
  103. ccxt/currencycom.py +1 -1
  104. ccxt/defx.py +1 -2
  105. ccxt/delta.py +1 -1
  106. ccxt/digifinex.py +58 -19
  107. ccxt/exmo.py +2 -2
  108. ccxt/gate.py +1 -1
  109. ccxt/hashkey.py +3 -5
  110. ccxt/htx.py +155 -33
  111. ccxt/hyperliquid.py +1 -1
  112. ccxt/kraken.py +1 -1
  113. ccxt/kucoin.py +25 -24
  114. ccxt/luno.py +1 -1
  115. ccxt/mexc.py +173 -26
  116. ccxt/ndax.py +1 -1
  117. ccxt/okcoin.py +18 -18
  118. ccxt/okx.py +22 -21
  119. ccxt/phemex.py +12 -8
  120. ccxt/poloniex.py +1 -1
  121. ccxt/poloniexfutures.py +6 -6
  122. ccxt/pro/__init__.py +1 -1
  123. ccxt/pro/bitget.py +1 -1
  124. ccxt/pro/bybit.py +12 -1
  125. ccxt/pro/coinex.py +2 -2
  126. ccxt/pro/gate.py +6 -6
  127. ccxt/pro/kucoin.py +3 -3
  128. ccxt/pro/okx.py +11 -11
  129. ccxt/pro/upbit.py +2 -2
  130. ccxt/pro/woo.py +1 -1
  131. ccxt/vertex.py +11 -11
  132. ccxt/woo.py +39 -39
  133. ccxt/woofipro.py +24 -24
  134. ccxt/xt.py +26 -26
  135. ccxt/zonda.py +1 -1
  136. {ccxt-4.4.38.dist-info → ccxt-4.4.40.dist-info}/METADATA +4 -4
  137. {ccxt-4.4.38.dist-info → ccxt-4.4.40.dist-info}/RECORD +140 -140
  138. {ccxt-4.4.38.dist-info → ccxt-4.4.40.dist-info}/LICENSE.txt +0 -0
  139. {ccxt-4.4.38.dist-info → ccxt-4.4.40.dist-info}/WHEEL +0 -0
  140. {ccxt-4.4.38.dist-info → ccxt-4.4.40.dist-info}/top_level.txt +0 -0
@@ -385,6 +385,82 @@ class coinbase(Exchange, ImplicitAPI):
385
385
  'fetchTime': 'v2PublicGetTime', # 'v2PublicGetTime' or 'v3PublicGetBrokerageTime'
386
386
  'user_native_currency': 'USD', # needed to get fees for v3
387
387
  },
388
+ 'features': {
389
+ 'spot': {
390
+ 'sandbox': False,
391
+ 'createOrder': {
392
+ 'marginMode': True,
393
+ 'triggerPrice': True,
394
+ 'triggerPriceType': None,
395
+ 'triggerDirection': True,
396
+ 'stopLossPrice': True,
397
+ 'takeProfitPrice': True,
398
+ 'attachedStopLossTakeProfit': None,
399
+ 'timeInForce': {
400
+ 'IOC': True,
401
+ 'FOK': True,
402
+ 'PO': True,
403
+ 'GTD': True,
404
+ },
405
+ 'hedged': False,
406
+ 'trailing': False,
407
+ },
408
+ 'createOrders': None,
409
+ 'fetchMyTrades': {
410
+ 'marginMode': False,
411
+ 'limit': 3000,
412
+ 'daysBack': None,
413
+ 'untilDays': 10000,
414
+ },
415
+ 'fetchOrder': {
416
+ 'marginMode': False,
417
+ 'trigger': False,
418
+ 'trailing': False,
419
+ },
420
+ 'fetchOpenOrders': {
421
+ 'marginMode': False,
422
+ 'limit': None,
423
+ 'trigger': False,
424
+ 'trailing': False,
425
+ },
426
+ 'fetchOrders': {
427
+ 'marginMode': False,
428
+ 'limit': None,
429
+ 'daysBack': None,
430
+ 'untilDays': 10000,
431
+ 'trigger': False,
432
+ 'trailing': False,
433
+ },
434
+ 'fetchClosedOrders': {
435
+ 'marginMode': False,
436
+ 'limit': None,
437
+ 'daysBackClosed': None,
438
+ 'daysBackCanceled': None,
439
+ 'untilDays': 10000,
440
+ 'trigger': False,
441
+ 'trailing': False,
442
+ },
443
+ 'fetchOHLCV': {
444
+ 'limit': 350,
445
+ },
446
+ },
447
+ 'swap': {
448
+ 'linear': {
449
+ 'extends': 'spot',
450
+ },
451
+ 'inverse': {
452
+ 'extends': 'spot',
453
+ },
454
+ },
455
+ 'future': {
456
+ 'linear': {
457
+ 'extends': 'spot',
458
+ },
459
+ 'inverse': {
460
+ 'extends': 'spot',
461
+ },
462
+ },
463
+ },
388
464
  })
389
465
 
390
466
  async def fetch_time(self, params={}):
@@ -2289,7 +2365,7 @@ class coinbase(Exchange, ImplicitAPI):
2289
2365
  :param int [limit]: max number of ledger entries to return, default is None
2290
2366
  :param dict [params]: extra parameters specific to the exchange API endpoint
2291
2367
  :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
2292
- :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
2368
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
2293
2369
  """
2294
2370
  await self.load_markets()
2295
2371
  paginate = False
@@ -1449,7 +1449,7 @@ class coinbaseexchange(Exchange, ImplicitAPI):
1449
1449
  :param int [limit]: max number of ledger entries to return, default is None
1450
1450
  :param dict [params]: extra parameters specific to the exchange API endpoint
1451
1451
  :param int [params.until]: the latest time in ms to fetch trades for
1452
- :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
1452
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
1453
1453
  """
1454
1454
  # https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccountledger
1455
1455
  if code is None:
@@ -264,6 +264,68 @@ class coinbaseinternational(Exchange, ImplicitAPI):
264
264
  'bitcoin': 'BTC',
265
265
  },
266
266
  },
267
+ 'features': {
268
+ 'spot': {
269
+ 'sandbox': True,
270
+ 'createOrder': {
271
+ 'marginMode': False,
272
+ 'triggerPrice': True,
273
+ 'triggerPriceType': None,
274
+ 'triggerDirection': True,
275
+ 'stopLossPrice': False, # todo implementation
276
+ 'takeProfitPrice': False, # todo implementation
277
+ 'attachedStopLossTakeProfit': None,
278
+ 'timeInForce': {
279
+ 'IOC': True,
280
+ 'FOK': True,
281
+ 'PO': True,
282
+ 'GTD': True,
283
+ 'GTC': True, # has 30 days max
284
+ },
285
+ 'hedged': False,
286
+ 'trailing': False,
287
+ },
288
+ 'createOrders': None,
289
+ 'fetchMyTrades': {
290
+ 'marginMode': False,
291
+ 'limit': 100,
292
+ 'daysBack': None,
293
+ 'untilDays': 10000,
294
+ },
295
+ 'fetchOrder': {
296
+ 'marginMode': False,
297
+ 'trigger': False,
298
+ 'trailing': False,
299
+ },
300
+ 'fetchOpenOrders': {
301
+ 'marginMode': False,
302
+ 'limit': 100,
303
+ 'trigger': False,
304
+ 'trailing': False,
305
+ },
306
+ 'fetchOrders': None,
307
+ 'fetchClosedOrders': None,
308
+ 'fetchOHLCV': {
309
+ 'limit': 300,
310
+ },
311
+ },
312
+ 'swap': {
313
+ 'linear': {
314
+ 'extends': 'spot',
315
+ },
316
+ 'inverse': {
317
+ 'extends': 'spot',
318
+ },
319
+ },
320
+ 'future': {
321
+ 'linear': {
322
+ 'extends': 'spot',
323
+ },
324
+ 'inverse': {
325
+ 'extends': 'spot',
326
+ },
327
+ },
328
+ },
267
329
  })
268
330
 
269
331
  async def handle_portfolio_and_params(self, methodName: str, params={}):
@@ -4783,7 +4783,7 @@ class coincatch(Exchange, ImplicitAPI):
4783
4783
  :param str [params.business]: *swap only*
4784
4784
  :param str [params.lastEndId]: *swap only*
4785
4785
  :param bool [params.next]: *swap only*
4786
- :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
4786
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
4787
4787
  """
4788
4788
  methodName = 'fetchLedger'
4789
4789
  await self.load_markets()
@@ -2543,18 +2543,18 @@ class coinex(Exchange, ImplicitAPI):
2543
2543
  request: dict = {
2544
2544
  'market': market['id'],
2545
2545
  }
2546
- stop = self.safe_bool_2(params, 'stop', 'trigger')
2546
+ trigger = self.safe_bool_2(params, 'stop', 'trigger')
2547
2547
  params = self.omit(params, ['stop', 'trigger'])
2548
2548
  response = None
2549
2549
  requestIds = []
2550
2550
  for i in range(0, len(ids)):
2551
2551
  requestIds.append(int(ids[i]))
2552
- if stop:
2552
+ if trigger:
2553
2553
  request['stop_ids'] = requestIds
2554
2554
  else:
2555
2555
  request['order_ids'] = requestIds
2556
2556
  if market['spot']:
2557
- if stop:
2557
+ if trigger:
2558
2558
  response = await self.v2PrivatePostSpotCancelBatchStopOrder(self.extend(request, params))
2559
2559
  #
2560
2560
  # {
@@ -2623,7 +2623,7 @@ class coinex(Exchange, ImplicitAPI):
2623
2623
  #
2624
2624
  else:
2625
2625
  request['market_type'] = 'FUTURES'
2626
- if stop:
2626
+ if trigger:
2627
2627
  response = await self.v2PrivatePostFuturesCancelBatchStopOrder(self.extend(request, params))
2628
2628
  #
2629
2629
  # {
@@ -3271,7 +3271,7 @@ class coinex(Exchange, ImplicitAPI):
3271
3271
  request['market'] = market['id']
3272
3272
  if limit is not None:
3273
3273
  request['limit'] = limit
3274
- stop = self.safe_bool_2(params, 'stop', 'trigger')
3274
+ trigger = self.safe_bool_2(params, 'stop', 'trigger')
3275
3275
  params = self.omit(params, ['stop', 'trigger'])
3276
3276
  marketType = None
3277
3277
  marketType, params = self.handle_market_type_and_params('fetchOrdersByStatus', market, params)
@@ -3281,7 +3281,7 @@ class coinex(Exchange, ImplicitAPI):
3281
3281
  if marketType == 'swap':
3282
3282
  request['market_type'] = 'FUTURES'
3283
3283
  if isClosed:
3284
- if stop:
3284
+ if trigger:
3285
3285
  response = await self.v2PrivateGetFuturesFinishedStopOrder(self.extend(request, params))
3286
3286
  #
3287
3287
  # {
@@ -3342,7 +3342,7 @@ class coinex(Exchange, ImplicitAPI):
3342
3342
  # }
3343
3343
  #
3344
3344
  elif isOpen:
3345
- if stop:
3345
+ if trigger:
3346
3346
  response = await self.v2PrivateGetFuturesPendingStopOrder(self.extend(request, params))
3347
3347
  #
3348
3348
  # {
@@ -3415,7 +3415,7 @@ class coinex(Exchange, ImplicitAPI):
3415
3415
  else:
3416
3416
  request['market_type'] = 'SPOT'
3417
3417
  if isClosed:
3418
- if stop:
3418
+ if trigger:
3419
3419
  response = await self.v2PrivateGetSpotFinishedStopOrder(self.extend(request, params))
3420
3420
  #
3421
3421
  # {
@@ -3479,7 +3479,7 @@ class coinex(Exchange, ImplicitAPI):
3479
3479
  # }
3480
3480
  #
3481
3481
  elif status == 'pending':
3482
- if stop:
3482
+ if trigger:
3483
3483
  response = await self.v2PrivateGetSpotPendingStopOrder(self.extend(request, params))
3484
3484
  #
3485
3485
  # {
@@ -2046,7 +2046,7 @@ class coinlist(Exchange, ImplicitAPI):
2046
2046
  :param int [limit]: max number of ledger entries to return(default 200, max 500)
2047
2047
  :param dict [params]: extra parameters specific to the exchange API endpoint
2048
2048
  :param int [params.until]: the latest time in ms to fetch entries for
2049
- :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
2049
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
2050
2050
  """
2051
2051
  traderId = self.safe_string_2(params, 'trader_id', 'traderId')
2052
2052
  if traderId is None:
@@ -977,7 +977,7 @@ class coinmetro(Exchange, ImplicitAPI):
977
977
  :param int [limit]: max number of ledger entries to return(default 200, max 500)
978
978
  :param dict [params]: extra parameters specific to the exchange API endpoint
979
979
  :param int [params.until]: the latest time in ms to fetch entries for
980
- :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
980
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
981
981
  """
982
982
  await self.load_markets()
983
983
  request: dict = {}
@@ -366,6 +366,95 @@ class cryptocom(Exchange, ImplicitAPI):
366
366
  },
367
367
  'broker': 'CCXT',
368
368
  },
369
+ 'features': {
370
+ 'default': {
371
+ 'sandbox': True,
372
+ 'createOrder': {
373
+ 'marginMode': True,
374
+ 'triggerPrice': True,
375
+ # todo: implementation fix
376
+ 'triggerPriceType': {
377
+ 'last': True,
378
+ 'mark': True,
379
+ 'index': True,
380
+ },
381
+ 'triggerDirection': False,
382
+ 'stopLossPrice': True,
383
+ 'takeProfitPrice': True,
384
+ 'attachedStopLossTakeProfit': None,
385
+ 'timeInForce': {
386
+ 'IOC': True,
387
+ 'FOK': True,
388
+ 'PO': True,
389
+ 'GTD': False,
390
+ },
391
+ 'hedged': False,
392
+ # exchange-supported features
393
+ 'selfTradePrevention': True,
394
+ 'trailing': False,
395
+ 'iceberg': False,
396
+ },
397
+ 'createOrders': {
398
+ 'max': 10,
399
+ },
400
+ 'fetchMyTrades': {
401
+ 'marginMode': False,
402
+ 'limit': 100,
403
+ 'daysBack': None,
404
+ 'untilDays': 1,
405
+ },
406
+ 'fetchOrder': {
407
+ 'marginMode': False,
408
+ 'trigger': False,
409
+ 'trailing': False,
410
+ },
411
+ 'fetchOpenOrders': {
412
+ 'marginMode': True,
413
+ 'limit': 100,
414
+ 'trigger': False,
415
+ 'trailing': False,
416
+ },
417
+ 'fetchOrders': {
418
+ 'marginMode': False,
419
+ 'limit': 100,
420
+ 'daysBack': None,
421
+ 'untilDays': 1,
422
+ 'trigger': False,
423
+ 'trailing': False,
424
+ },
425
+ 'fetchClosedOrders': {
426
+ 'marginMode': False,
427
+ 'limit': 100,
428
+ 'daysBackClosed': None,
429
+ 'daysBackCanceled': None,
430
+ 'untilDays': 1,
431
+ 'trigger': False,
432
+ 'trailing': False,
433
+ },
434
+ 'fetchOHLCV': {
435
+ 'limit': 300,
436
+ },
437
+ },
438
+ 'spot': {
439
+ 'extends': 'default',
440
+ },
441
+ 'swap': {
442
+ 'linear': {
443
+ 'extends': 'default',
444
+ },
445
+ 'inverse': {
446
+ 'extends': 'default',
447
+ },
448
+ },
449
+ 'future': {
450
+ 'linear': {
451
+ 'extends': 'default',
452
+ },
453
+ 'inverse': {
454
+ 'extends': 'default',
455
+ },
456
+ },
457
+ },
369
458
  # https://exchange-docs.crypto.com/spot/index.html#response-and-reason-codes
370
459
  'commonCurrencies': {
371
460
  'USD_STABLE_COIN': 'USDC',
@@ -1147,7 +1236,7 @@ class cryptocom(Exchange, ImplicitAPI):
1147
1236
  :param dict [params]: extra parameters specific to the exchange API endpoint
1148
1237
  :param str [params.timeInForce]: 'GTC', 'IOC', 'FOK' or 'PO'
1149
1238
  :param str [params.ref_price_type]: 'MARK_PRICE', 'INDEX_PRICE', 'LAST_PRICE' which trigger price type to use, default is MARK_PRICE
1150
- :param float [params.triggerPrice]: price to trigger a stop order
1239
+ :param float [params.triggerPrice]: price to trigger a trigger order
1151
1240
  :param float [params.stopLossPrice]: price to trigger a stop-loss trigger order
1152
1241
  :param float [params.takeProfitPrice]: price to trigger a take-profit trigger order
1153
1242
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
@@ -2283,7 +2372,7 @@ class cryptocom(Exchange, ImplicitAPI):
2283
2372
  :param int [limit]: max number of ledger entries to return
2284
2373
  :param dict [params]: extra parameters specific to the exchange API endpoint
2285
2374
  :param int [params.until]: timestamp in ms for the ending date filter, default is the current time
2286
- :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
2375
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
2287
2376
  """
2288
2377
  await self.load_markets()
2289
2378
  request: dict = {}
@@ -1668,7 +1668,7 @@ class currencycom(Exchange, ImplicitAPI):
1668
1668
  :param int [since]: timestamp in ms of the earliest ledger entry, default is None
1669
1669
  :param int [limit]: max number of ledger entries to return, default is None
1670
1670
  :param dict [params]: extra parameters specific to the exchange API endpoint
1671
- :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
1671
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
1672
1672
  """
1673
1673
  await self.load_markets()
1674
1674
  request: dict = {}
@@ -1317,7 +1317,6 @@ class defx(Exchange, ImplicitAPI):
1317
1317
  :param str id: order id
1318
1318
  :param str symbol: unified symbol of the market the order was made in
1319
1319
  :param dict [params]: extra parameters specific to the exchange API endpoint
1320
- :param boolean [params.stop]: whether the order is a stop/algo order
1321
1320
  :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1322
1321
  """
1323
1322
  await self.load_markets()
@@ -1734,7 +1733,7 @@ class defx(Exchange, ImplicitAPI):
1734
1733
  :param dict [params]: extra parameters specific to the exchange API endpoint
1735
1734
  :param int [params.until]: timestamp in ms of the latest ledger entry
1736
1735
  :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
1737
- :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
1736
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
1738
1737
  """
1739
1738
  await self.load_markets()
1740
1739
  paginate = False
@@ -2152,7 +2152,7 @@ class delta(Exchange, ImplicitAPI):
2152
2152
  :param int [since]: timestamp in ms of the earliest ledger entry, default is None
2153
2153
  :param int [limit]: max number of ledger entries to return, default is None
2154
2154
  :param dict [params]: extra parameters specific to the exchange API endpoint
2155
- :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
2155
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
2156
2156
  """
2157
2157
  await self.load_markets()
2158
2158
  request: dict = {
@@ -231,6 +231,7 @@ class digifinex(Exchange, ImplicitAPI):
231
231
  'trade/order_info',
232
232
  ],
233
233
  'post': [
234
+ 'account/transfer',
234
235
  'account/leverage',
235
236
  'account/position_mode',
236
237
  'account/position_margin',
@@ -2477,7 +2478,7 @@ class digifinex(Exchange, ImplicitAPI):
2477
2478
  :param int [since]: timestamp in ms of the earliest ledger entry, default is None
2478
2479
  :param int [limit]: max number of ledger entries to return, default is None
2479
2480
  :param dict [params]: extra parameters specific to the exchange API endpoint
2480
- :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
2481
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
2481
2482
  """
2482
2483
  await self.load_markets()
2483
2484
  request: dict = {}
@@ -2749,12 +2750,23 @@ class digifinex(Exchange, ImplicitAPI):
2749
2750
 
2750
2751
  def parse_transfer(self, transfer: dict, currency: Currency = None) -> TransferEntry:
2751
2752
  #
2752
- # transfer
2753
+ # transfer between spot, margin and OTC
2753
2754
  #
2754
2755
  # {
2755
2756
  # "code": 0
2756
2757
  # }
2757
2758
  #
2759
+ # transfer between spot and swap
2760
+ #
2761
+ # {
2762
+ # "code": 0,
2763
+ # "data": {
2764
+ # "type": 2,
2765
+ # "currency": "USDT",
2766
+ # "transfer_amount": "5"
2767
+ # }
2768
+ # }
2769
+ #
2758
2770
  # fetchTransfers
2759
2771
  #
2760
2772
  # {
@@ -2767,7 +2779,8 @@ class digifinex(Exchange, ImplicitAPI):
2767
2779
  #
2768
2780
  fromAccount = None
2769
2781
  toAccount = None
2770
- type = self.safe_integer(transfer, 'type')
2782
+ data = self.safe_dict(transfer, 'data', transfer)
2783
+ type = self.safe_integer(data, 'type')
2771
2784
  if type == 1:
2772
2785
  fromAccount = 'spot'
2773
2786
  toAccount = 'swap'
@@ -2780,8 +2793,8 @@ class digifinex(Exchange, ImplicitAPI):
2780
2793
  'id': self.safe_string(transfer, 'transfer_id'),
2781
2794
  'timestamp': timestamp,
2782
2795
  'datetime': self.iso8601(timestamp),
2783
- 'currency': self.safe_currency_code(self.safe_string(transfer, 'currency'), currency),
2784
- 'amount': self.safe_number(transfer, 'amount'),
2796
+ 'currency': self.safe_currency_code(self.safe_string(data, 'currency'), currency),
2797
+ 'amount': self.safe_number_2(data, 'amount', 'transfer_amount'),
2785
2798
  'fromAccount': fromAccount,
2786
2799
  'toAccount': toAccount,
2787
2800
  'status': self.parse_transfer_status(self.safe_string(transfer, 'code')),
@@ -2790,30 +2803,56 @@ class digifinex(Exchange, ImplicitAPI):
2790
2803
  async def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
2791
2804
  """
2792
2805
  transfer currency internally between wallets on the same account
2806
+
2807
+ https://docs.digifinex.com/en-ww/spot/v3/rest.html#transfer-assets-among-accounts
2808
+ https://docs.digifinex.com/en-ww/swap/v2/rest.html#accounttransfer
2809
+
2793
2810
  :param str code: unified currency code
2794
2811
  :param float amount: amount to transfer
2795
- :param str fromAccount: account to transfer from
2796
- :param str toAccount: account to transfer to
2812
+ :param str fromAccount: 'spot', 'swap', 'margin', 'OTC' - account to transfer from
2813
+ :param str toAccount: 'spot', 'swap', 'margin', 'OTC' - account to transfer to
2797
2814
  :param dict [params]: extra parameters specific to the exchange API endpoint
2798
2815
  :returns dict: a `transfer structure <https://docs.ccxt.com/#/?id=transfer-structure>`
2799
2816
  """
2800
2817
  await self.load_markets()
2801
2818
  currency = self.currency(code)
2819
+ currencyId = currency['id']
2802
2820
  accountsByType = self.safe_value(self.options, 'accountsByType', {})
2803
2821
  fromId = self.safe_string(accountsByType, fromAccount, fromAccount)
2804
2822
  toId = self.safe_string(accountsByType, toAccount, toAccount)
2805
- request: dict = {
2806
- 'currency_mark': currency['id'],
2807
- 'num': self.currency_to_precision(code, amount),
2808
- 'from': fromId, # 1 = SPOT, 2 = MARGIN, 3 = OTC
2809
- 'to': toId, # 1 = SPOT, 2 = MARGIN, 3 = OTC
2810
- }
2811
- response = await self.privateSpotPostTransfer(self.extend(request, params))
2812
- #
2813
- # {
2814
- # "code": 0
2815
- # }
2816
- #
2823
+ request = {}
2824
+ fromSwap = (fromAccount == 'swap')
2825
+ toSwap = (toAccount == 'swap')
2826
+ response = None
2827
+ amountString = self.currency_to_precision(code, amount)
2828
+ if fromSwap or toSwap:
2829
+ if (fromId != '1') and (toId != '1'):
2830
+ raise ExchangeError(self.id + ' transfer() supports transferring between spot and swap, spot and margin, spot and OTC only')
2831
+ request['type'] = 1 if toSwap else 2 # 1 = spot to swap, 2 = swap to spot
2832
+ request['currency'] = currencyId
2833
+ request['transfer_amount'] = amountString
2834
+ #
2835
+ # {
2836
+ # "code": 0,
2837
+ # "data": {
2838
+ # "type": 2,
2839
+ # "currency": "USDT",
2840
+ # "transfer_amount": "5"
2841
+ # }
2842
+ # }
2843
+ #
2844
+ response = await self.privateSwapPostAccountTransfer(self.extend(request, params))
2845
+ else:
2846
+ request['currency_mark'] = currencyId
2847
+ request['num'] = amountString
2848
+ request['from'] = fromId # 1 = SPOT, 2 = MARGIN, 3 = OTC
2849
+ request['to'] = toId # 1 = SPOT, 2 = MARGIN, 3 = OTC
2850
+ #
2851
+ # {
2852
+ # "code": 0
2853
+ # }
2854
+ #
2855
+ response = await self.privateSpotPostTransfer(self.extend(request, params))
2817
2856
  return self.parse_transfer(response, currency)
2818
2857
 
2819
2858
  async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
@@ -1463,7 +1463,7 @@ class exmo(Exchange, ImplicitAPI):
1463
1463
  """
1464
1464
  await self.load_markets()
1465
1465
  request: dict = {}
1466
- stop = self.safe_value_2(params, 'trigger', 'stop')
1466
+ trigger = self.safe_value_2(params, 'trigger', 'stop')
1467
1467
  params = self.omit(params, ['trigger', 'stop'])
1468
1468
  marginMode = None
1469
1469
  marginMode, params = self.handle_margin_mode_and_params('cancelOrder', params)
@@ -1477,7 +1477,7 @@ class exmo(Exchange, ImplicitAPI):
1477
1477
  # {}
1478
1478
  #
1479
1479
  else:
1480
- if stop:
1480
+ if trigger:
1481
1481
  request['parent_order_id'] = id
1482
1482
  response = await self.privatePostStopMarketOrderCancel(self.extend(request, params))
1483
1483
  #
@@ -6706,7 +6706,7 @@ class gate(Exchange, ImplicitAPI):
6706
6706
  :param dict [params]: extra parameters specific to the exchange API endpoint
6707
6707
  :param int [params.until]: end time in ms
6708
6708
  :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
6709
- :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
6709
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
6710
6710
  """
6711
6711
  await self.load_markets()
6712
6712
  paginate = False
@@ -2199,7 +2199,7 @@ class hashkey(Exchange, ImplicitAPI):
2199
2199
  :param int [params.until]: the latest time in ms to fetch entries for
2200
2200
  :param int [params.flowType]: trade, fee, transfer, deposit, withdrawal
2201
2201
  :param int [params.accountType]: spot, swap, custody
2202
- :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
2202
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
2203
2203
  """
2204
2204
  methodName = 'fetchLedger'
2205
2205
  if since is None:
@@ -3337,10 +3337,8 @@ class hashkey(Exchange, ImplicitAPI):
3337
3337
  raise BadRequest(self.id + ' ' + methodName + '() type parameter can not be "' + paramsType + '". It should define the type of the market("spot" or "swap"). To define the type of an order use the trigger parameter(True for trigger orders)')
3338
3338
 
3339
3339
  def handle_trigger_option_and_params(self, params: object, methodName: str, defaultValue=None):
3340
- isStop = defaultValue
3341
- isStop, params = self.handle_option_and_params(params, methodName, 'stop', isStop)
3342
- isTrigger = isStop
3343
- isTrigger, params = self.handle_option_and_params(params, methodName, 'trigger', isTrigger)
3340
+ isTrigger = defaultValue
3341
+ isTrigger, params = self.handle_option_and_params_2(params, methodName, 'stop', 'trigger', isTrigger)
3344
3342
  return [isTrigger, params]
3345
3343
 
3346
3344
  def parse_order(self, order: dict, market: Market = None) -> Order: