ccxt 4.4.95__py2.py3-none-any.whl → 4.4.96__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 (72) hide show
  1. ccxt/__init__.py +3 -1
  2. ccxt/abstract/foxbit.py +26 -0
  3. ccxt/abstract/hyperliquid.py +1 -1
  4. ccxt/apex.py +3 -3
  5. ccxt/ascendex.py +2 -2
  6. ccxt/async_support/__init__.py +3 -1
  7. ccxt/async_support/apex.py +3 -3
  8. ccxt/async_support/ascendex.py +2 -2
  9. ccxt/async_support/base/exchange.py +5 -3
  10. ccxt/async_support/base/ws/future.py +5 -3
  11. ccxt/async_support/bitget.py +30 -143
  12. ccxt/async_support/bitmart.py +2 -2
  13. ccxt/async_support/bitrue.py +13 -8
  14. ccxt/async_support/bybit.py +14 -5
  15. ccxt/async_support/coinbaseexchange.py +4 -2
  16. ccxt/async_support/coinbaseinternational.py +2 -2
  17. ccxt/async_support/coinspot.py +36 -1
  18. ccxt/async_support/cryptocom.py +2 -1
  19. ccxt/async_support/cryptomus.py +41 -1
  20. ccxt/async_support/defx.py +1 -1
  21. ccxt/async_support/derive.py +1 -1
  22. ccxt/async_support/ellipx.py +40 -0
  23. ccxt/async_support/foxbit.py +1935 -0
  24. ccxt/async_support/hyperliquid.py +2 -2
  25. ccxt/async_support/kucoin.py +1 -1
  26. ccxt/async_support/kucoinfutures.py +3 -2
  27. ccxt/async_support/mexc.py +28 -13
  28. ccxt/async_support/modetrade.py +3 -3
  29. ccxt/async_support/okcoin.py +1 -1
  30. ccxt/async_support/okx.py +10 -3
  31. ccxt/async_support/onetrading.py +1 -1
  32. ccxt/async_support/oxfun.py +2 -1
  33. ccxt/async_support/paradex.py +2 -2
  34. ccxt/async_support/vertex.py +3 -2
  35. ccxt/async_support/woo.py +6 -2
  36. ccxt/async_support/woofipro.py +2 -2
  37. ccxt/base/errors.py +6 -0
  38. ccxt/base/exchange.py +6 -3
  39. ccxt/bitget.py +30 -143
  40. ccxt/bitmart.py +2 -2
  41. ccxt/bitrue.py +13 -8
  42. ccxt/bybit.py +14 -5
  43. ccxt/coinbaseexchange.py +4 -2
  44. ccxt/coinbaseinternational.py +2 -2
  45. ccxt/coinspot.py +36 -1
  46. ccxt/cryptocom.py +2 -1
  47. ccxt/cryptomus.py +41 -1
  48. ccxt/defx.py +1 -1
  49. ccxt/derive.py +1 -1
  50. ccxt/ellipx.py +40 -0
  51. ccxt/foxbit.py +1935 -0
  52. ccxt/hyperliquid.py +2 -2
  53. ccxt/kucoin.py +1 -1
  54. ccxt/kucoinfutures.py +3 -2
  55. ccxt/mexc.py +28 -13
  56. ccxt/modetrade.py +3 -3
  57. ccxt/okcoin.py +1 -1
  58. ccxt/okx.py +10 -3
  59. ccxt/onetrading.py +1 -1
  60. ccxt/oxfun.py +2 -1
  61. ccxt/paradex.py +2 -2
  62. ccxt/pro/__init__.py +1 -1
  63. ccxt/test/tests_async.py +15 -0
  64. ccxt/test/tests_sync.py +15 -0
  65. ccxt/vertex.py +3 -2
  66. ccxt/woo.py +6 -2
  67. ccxt/woofipro.py +2 -2
  68. {ccxt-4.4.95.dist-info → ccxt-4.4.96.dist-info}/METADATA +8 -8
  69. {ccxt-4.4.95.dist-info → ccxt-4.4.96.dist-info}/RECORD +72 -69
  70. {ccxt-4.4.95.dist-info → ccxt-4.4.96.dist-info}/LICENSE.txt +0 -0
  71. {ccxt-4.4.95.dist-info → ccxt-4.4.96.dist-info}/WHEEL +0 -0
  72. {ccxt-4.4.95.dist-info → ccxt-4.4.96.dist-info}/top_level.txt +0 -0
@@ -174,7 +174,7 @@ class hyperliquid(Exchange, ImplicitAPI):
174
174
  'orderStatus': 2,
175
175
  'spotClearinghouseState': 2,
176
176
  'exchangeStatus': 2,
177
- 'candleSnapshot': 3,
177
+ 'candleSnapshot': 4,
178
178
  },
179
179
  },
180
180
  },
@@ -1811,7 +1811,7 @@ class hyperliquid(Exchange, ImplicitAPI):
1811
1811
  # }
1812
1812
  # }
1813
1813
  #
1814
- return response
1814
+ return [self.safe_order({'info': response})]
1815
1815
 
1816
1816
  async def cancel_all_orders_after(self, timeout: Int, params={}):
1817
1817
  """
@@ -2647,7 +2647,7 @@ class kucoin(Exchange, ImplicitAPI):
2647
2647
  response = await self.privateDeleteHfOrders(self.extend(request, query))
2648
2648
  else:
2649
2649
  response = await self.privateDeleteOrders(self.extend(request, query))
2650
- return response
2650
+ return [self.safe_order({'info': response})]
2651
2651
 
2652
2652
  async def fetch_orders_by_status(self, status, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
2653
2653
  """
@@ -1719,7 +1719,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
1719
1719
  # },
1720
1720
  # }
1721
1721
  #
1722
- return self.safe_value(response, 'data')
1722
+ return self.safe_order({'info': response})
1723
1723
 
1724
1724
  async def cancel_orders(self, ids, symbol: Str = None, params={}):
1725
1725
  """
@@ -1811,7 +1811,8 @@ class kucoinfutures(kucoin, ImplicitAPI):
1811
1811
  # },
1812
1812
  # }
1813
1813
  #
1814
- return self.safe_value(response, 'data')
1814
+ data = self.safe_dict(response, 'data')
1815
+ return [self.safe_order({'info': data})]
1815
1816
 
1816
1817
  async def add_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
1817
1818
  """
@@ -4652,11 +4652,14 @@ class mexc(Exchange, ImplicitAPI):
4652
4652
  # "network": "TRX",
4653
4653
  # "status": "5",
4654
4654
  # "address": "TSMcEDDvkqY9dz8RkFnrS86U59GwEZjfvh",
4655
- # "txId": "51a8f49e6f03f2c056e71fe3291aa65e1032880be855b65cecd0595a1b8af95b",
4655
+ # "txId": "51a8f49e6f03f2c056e71fe3291aa65e1032880be855b65cecd0595a1b8af95b:0",
4656
4656
  # "insertTime": "1664805021000",
4657
4657
  # "unlockConfirm": "200",
4658
4658
  # "confirmTimes": "203",
4659
- # "memo": "xxyy1122"
4659
+ # "memo": "xxyy1122",
4660
+ # "transHash": "51a8f49e6f03f2c056e71fe3291aa65e1032880be855b65cecd0595a1b8af95b",
4661
+ # "updateTime": "1664805621000",
4662
+ # "netWork: "TRX"
4660
4663
  # }
4661
4664
  # ]
4662
4665
  #
@@ -4697,7 +4700,7 @@ class mexc(Exchange, ImplicitAPI):
4697
4700
  # [
4698
4701
  # {
4699
4702
  # "id": "adcd1c8322154de691b815eedcd10c42",
4700
- # "txId": "0xc8c918cd69b2246db493ef6225a72ffdc664f15b08da3e25c6879b271d05e9d0",
4703
+ # "txId": "0xc8c918cd69b2246db493ef6225a72ffdc664f15b08da3e25c6879b271d05e9d0:0",
4701
4704
  # "coin": "USDC-MATIC",
4702
4705
  # "network": "MATIC",
4703
4706
  # "address": "0xeE6C7a415995312ED52c53a0f8f03e165e0A5D62",
@@ -4708,7 +4711,11 @@ class mexc(Exchange, ImplicitAPI):
4708
4711
  # "confirmNo": null,
4709
4712
  # "applyTime": "1664882739000",
4710
4713
  # "remark": '',
4711
- # "memo": null
4714
+ # "memo": null,
4715
+ # "explorerUrl": "https://etherscan.io/tx/0xc8c918cd69b2246db493ef6225a72ffdc664f15b08da3e25c6879b271d05e9d0",
4716
+ # "transHash": "0xc8c918cd69b2246db493ef6225a72ffdc664f15b08da3e25c6879b271d05e9d0",
4717
+ # "updateTime": "1664882799000",
4718
+ # "netWork: "MATIC"
4712
4719
  # }
4713
4720
  # ]
4714
4721
  #
@@ -4724,18 +4731,21 @@ class mexc(Exchange, ImplicitAPI):
4724
4731
  # "network": "TRX",
4725
4732
  # "status": "5",
4726
4733
  # "address": "TSMcEDDvkqY9dz8RkFnrS86U59GwEZjfvh",
4727
- # "txId": "51a8f49e6f03f2c056e71fe3291aa65e1032880be855b65cecd0595a1b8af95b",
4734
+ # "txId": "51a8f49e6f03f2c056e71fe3291aa65e1032880be855b65cecd0595a1b8af95b:0",
4728
4735
  # "insertTime": "1664805021000",
4729
4736
  # "unlockConfirm": "200",
4730
4737
  # "confirmTimes": "203",
4731
- # "memo": "xxyy1122"
4738
+ # "memo": "xxyy1122",
4739
+ # "transHash": "51a8f49e6f03f2c056e71fe3291aa65e1032880be855b65cecd0595a1b8af95b",
4740
+ # "updateTime": "1664805621000",
4741
+ # "netWork: "TRX"
4732
4742
  # }
4733
4743
  #
4734
4744
  # fetchWithdrawals
4735
4745
  #
4736
4746
  # {
4737
4747
  # "id": "adcd1c8322154de691b815eedcd10c42",
4738
- # "txId": "0xc8c918cd69b2246db493ef6225a72ffdc664f15b08da3e25c6879b271d05e9d0",
4748
+ # "txId": "0xc8c918cd69b2246db493ef6225a72ffdc664f15b08da3e25c6879b271d05e9d0:0",
4739
4749
  # "coin": "USDC-MATIC",
4740
4750
  # "network": "MATIC",
4741
4751
  # "address": "0xeE6C7a415995312ED52c53a0f8f03e165e0A5D62",
@@ -4745,8 +4755,12 @@ class mexc(Exchange, ImplicitAPI):
4745
4755
  # "transactionFee": "1",
4746
4756
  # "confirmNo": null,
4747
4757
  # "applyTime": "1664882739000",
4748
- # "remark": '',
4749
- # "memo": null
4758
+ # "remark": "",
4759
+ # "memo": null,
4760
+ # "explorerUrl": "https://etherscan.io/tx/0xc8c918cd69b2246db493ef6225a72ffdc664f15b08da3e25c6879b271d05e9d0",
4761
+ # "transHash": "0xc8c918cd69b2246db493ef6225a72ffdc664f15b08da3e25c6879b271d05e9d0",
4762
+ # "updateTime": "1664882799000",
4763
+ # "netWork: "MATIC"
4750
4764
  # }
4751
4765
  #
4752
4766
  # withdraw
@@ -4758,6 +4772,7 @@ class mexc(Exchange, ImplicitAPI):
4758
4772
  id = self.safe_string(transaction, 'id')
4759
4773
  type = 'deposit' if (id is None) else 'withdrawal'
4760
4774
  timestamp = self.safe_integer_2(transaction, 'insertTime', 'applyTime')
4775
+ updated = self.safe_integer(transaction, 'updateTime')
4761
4776
  currencyId = None
4762
4777
  currencyWithNetwork = self.safe_string(transaction, 'coin')
4763
4778
  if currencyWithNetwork is not None:
@@ -4770,7 +4785,7 @@ class mexc(Exchange, ImplicitAPI):
4770
4785
  status = self.parse_transaction_status_by_type(self.safe_string(transaction, 'status'), type)
4771
4786
  amountString = self.safe_string(transaction, 'amount')
4772
4787
  address = self.safe_string(transaction, 'address')
4773
- txid = self.safe_string(transaction, 'txId')
4788
+ txid = self.safe_string_2(transaction, 'transHash', 'txId')
4774
4789
  fee = None
4775
4790
  feeCostString = self.safe_string(transaction, 'transactionFee')
4776
4791
  if feeCostString is not None:
@@ -4798,8 +4813,8 @@ class mexc(Exchange, ImplicitAPI):
4798
4813
  'amount': self.parse_number(amountString),
4799
4814
  'currency': code,
4800
4815
  'status': status,
4801
- 'updated': None,
4802
- 'comment': None,
4816
+ 'updated': updated,
4817
+ 'comment': self.safe_string(transaction, 'remark'),
4803
4818
  'internal': None,
4804
4819
  'fee': fee,
4805
4820
  }
@@ -5705,7 +5720,7 @@ class mexc(Exchange, ImplicitAPI):
5705
5720
  #
5706
5721
  # {success: True, code: '0'}
5707
5722
  #
5708
- return self.parse_leverage(response, market)
5723
+ return self.parse_leverage(response, market) # tmp revert type
5709
5724
 
5710
5725
  def nonce(self):
5711
5726
  return self.milliseconds() - self.safe_integer(self.options, 'timeDifference', 0)
@@ -29,7 +29,7 @@ class modetrade(Exchange, ImplicitAPI):
29
29
  'countries': ['KY'], # Cayman Islands
30
30
  'rateLimit': 100,
31
31
  'version': 'v1',
32
- 'certified': True,
32
+ 'certified': False,
33
33
  'pro': True,
34
34
  'dex': True,
35
35
  'hostname': 'trade.mode.network',
@@ -1750,9 +1750,9 @@ class modetrade(Exchange, ImplicitAPI):
1750
1750
  # }
1751
1751
  #
1752
1752
  return [
1753
- {
1753
+ self.safe_order({
1754
1754
  'info': response,
1755
- },
1755
+ }),
1756
1756
  ]
1757
1757
 
1758
1758
  async def fetch_order(self, id: str, symbol: Str = None, params={}):
@@ -1650,7 +1650,7 @@ class okcoin(Exchange, ImplicitAPI):
1650
1650
  advanced = self.safe_value(params, 'advanced')
1651
1651
  if trigger or advanced:
1652
1652
  orderInner = await self.cancel_orders([id], symbol, params)
1653
- return self.safe_value(orderInner, 0)
1653
+ return self.safe_dict(orderInner, 0)
1654
1654
  market = self.market(symbol)
1655
1655
  request: dict = {
1656
1656
  'instId': market['id'],
ccxt/async_support/okx.py CHANGED
@@ -1173,7 +1173,9 @@ class okx(Exchange, ImplicitAPI):
1173
1173
  },
1174
1174
  'createOrder': 'privatePostTradeBatchOrders', # or 'privatePostTradeOrder' or 'privatePostTradeOrderAlgo'
1175
1175
  'createMarketBuyOrderRequiresPrice': False,
1176
- 'fetchMarkets': ['spot', 'future', 'swap', 'option'], # spot, future, swap, option
1176
+ 'fetchMarkets': {
1177
+ 'types': ['spot', 'future', 'swap', 'option'], # spot, future, swap, option
1178
+ },
1177
1179
  'timeDifference': 0, # the difference between system clock and exchange server clock
1178
1180
  'adjustForTimeDifference': False, # controls the adjustment logic upon instantiation
1179
1181
  'defaultType': 'spot', # 'funding', 'spot', 'margin', 'future', 'swap', 'option'
@@ -1559,7 +1561,12 @@ class okx(Exchange, ImplicitAPI):
1559
1561
  """
1560
1562
  if self.options['adjustForTimeDifference']:
1561
1563
  await self.load_time_difference()
1562
- types = self.safe_list(self.options, 'fetchMarkets', [])
1564
+ types = ['spot', 'future', 'swap', 'option']
1565
+ fetchMarketsOption = self.safe_dict(self.options, 'fetchMarkets')
1566
+ if fetchMarketsOption is not None:
1567
+ types = self.safe_list(fetchMarketsOption, 'types', types)
1568
+ else:
1569
+ types = self.safe_list(self.options, 'fetchMarkets', types) # backward-support
1563
1570
  promises = []
1564
1571
  result = []
1565
1572
  for i in range(0, len(types)):
@@ -3325,7 +3332,7 @@ class okx(Exchange, ImplicitAPI):
3325
3332
  trailing = self.safe_bool(params, 'trailing', False)
3326
3333
  if trigger or trailing:
3327
3334
  orderInner = await self.cancel_orders([id], symbol, params)
3328
- return self.safe_value(orderInner, 0)
3335
+ return self.safe_dict(orderInner, 0)
3329
3336
  await self.load_markets()
3330
3337
  market = self.market(symbol)
3331
3338
  request: dict = {
@@ -1321,7 +1321,7 @@ class onetrading(Exchange, ImplicitAPI):
1321
1321
  # "a10e9bd1-8f72-4cfe-9f1b-7f1c8a9bd8ee"
1322
1322
  # ]
1323
1323
  #
1324
- return response
1324
+ return [self.safe_order({'info': response})]
1325
1325
 
1326
1326
  async def cancel_orders(self, ids, symbol: Str = None, params={}):
1327
1327
  """
@@ -2585,7 +2585,8 @@ class oxfun(Exchange, ImplicitAPI):
2585
2585
  # "data": {"notice": "No working orders found"}
2586
2586
  # }
2587
2587
  #
2588
- return await self.privateDeleteV3OrdersCancelAll(self.extend(request, params))
2588
+ response = await self.privateDeleteV3OrdersCancelAll(self.extend(request, params))
2589
+ return [self.safe_order({'info': response})]
2589
2590
 
2590
2591
  async def cancel_orders(self, ids: List[str], symbol: Str = None, params={}):
2591
2592
  """
@@ -1249,7 +1249,7 @@ class paradex(Exchange, ImplicitAPI):
1249
1249
  cancelReason = self.safe_string(order, 'cancel_reason')
1250
1250
  status = self.safe_string(order, 'status')
1251
1251
  if cancelReason is not None:
1252
- if cancelReason == 'NOT_ENOUGH_MARGIN':
1252
+ if cancelReason == 'NOT_ENOUGH_MARGIN' or cancelReason == 'ORDER_EXCEEDS_POSITION_LIMIT':
1253
1253
  status = 'rejected'
1254
1254
  else:
1255
1255
  status = 'canceled'
@@ -1527,7 +1527,7 @@ class paradex(Exchange, ImplicitAPI):
1527
1527
  #
1528
1528
  # if success, no response...
1529
1529
  #
1530
- return response
1530
+ return [self.safe_order({'info': response})]
1531
1531
 
1532
1532
  async def fetch_order(self, id: str, symbol: Str = None, params={}):
1533
1533
  """
@@ -2351,7 +2351,7 @@ class vertex(Exchange, ImplicitAPI):
2351
2351
  # "request_type": "execute_cancel_product_orders"
2352
2352
  # }
2353
2353
  #
2354
- return response
2354
+ return [self.safe_order({'info': response})]
2355
2355
 
2356
2356
  async def cancel_order(self, id: str, symbol: Str = None, params={}):
2357
2357
  """
@@ -2365,7 +2365,8 @@ class vertex(Exchange, ImplicitAPI):
2365
2365
  :param dict [params]: extra parameters specific to the exchange API endpoint
2366
2366
  :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
2367
2367
  """
2368
- return await self.cancel_orders([id], symbol, params)
2368
+ order = await self.cancel_orders([id], symbol, params)
2369
+ return self.safe_order({'info': order})
2369
2370
 
2370
2371
  async def cancel_orders(self, ids: List[str], symbol: Str = None, params={}):
2371
2372
  """
ccxt/async_support/woo.py CHANGED
@@ -1503,8 +1503,11 @@ class woo(Exchange, ImplicitAPI):
1503
1503
  if symbol is not None:
1504
1504
  market = self.market(symbol)
1505
1505
  request['symbol'] = market['id']
1506
+ response = None
1506
1507
  if trigger:
1507
- return await self.v3PrivateDeleteTradeAlgoOrders(params)
1508
+ response = await self.v3PrivateDeleteTradeAlgoOrders(params)
1509
+ else:
1510
+ response = await self.v3PrivateDeleteTradeOrders(self.extend(request, params))
1508
1511
  #
1509
1512
  # {
1510
1513
  # "success": True,
@@ -1514,7 +1517,8 @@ class woo(Exchange, ImplicitAPI):
1514
1517
  # "timestamp": 1751941988134
1515
1518
  # }
1516
1519
  #
1517
- return await self.v3PrivateDeleteTradeOrders(self.extend(request, params))
1520
+ data = self.safe_dict(response, 'data', {})
1521
+ return [self.safe_order({'info': data})]
1518
1522
 
1519
1523
  async def cancel_all_orders_after(self, timeout: Int, params={}):
1520
1524
  """
@@ -1761,9 +1761,9 @@ class woofipro(Exchange, ImplicitAPI):
1761
1761
  # }
1762
1762
  #
1763
1763
  return [
1764
- {
1764
+ self.safe_order({
1765
1765
  'info': response,
1766
- },
1766
+ }),
1767
1767
  ]
1768
1768
 
1769
1769
  async def fetch_order(self, id: str, symbol: Str = None, params={}):
ccxt/base/errors.py CHANGED
@@ -1,3 +1,9 @@
1
+ # ----------------------------------------------------------------------------
2
+
3
+ # PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
+ # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
+ # EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
+
1
7
  error_hierarchy = {
2
8
  'BaseError': {
3
9
  'ExchangeError': {
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.95'
7
+ __version__ = '4.4.96'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -229,6 +229,7 @@ class Exchange(object):
229
229
  'chrome100': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36',
230
230
  }
231
231
  headers = None
232
+ returnResponseHeaders = False
232
233
  origin = '*' # CORS origin
233
234
  MAX_VALUE = float('inf')
234
235
  #
@@ -579,6 +580,8 @@ class Exchange(object):
579
580
  if self.verbose:
580
581
  self.log("\nfetch Response:", self.id, method, url, http_status_code, "ResponseHeaders:", headers, "ResponseBody:", http_response)
581
582
  self.logger.debug("%s %s, Response: %s %s %s", method, url, http_status_code, headers, http_response)
583
+ if json_response and not isinstance(json_response, list) and self.returnResponseHeaders:
584
+ json_response['responseHeaders'] = headers
582
585
  response.raise_for_status()
583
586
 
584
587
  except Timeout as e:
@@ -5495,10 +5498,10 @@ class Exchange(object):
5495
5498
  """
5496
5499
  raise NotSupported(self.id + ' fetchDepositsWithdrawals() is not supported yet')
5497
5500
 
5498
- def fetch_deposits(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
5501
+ def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
5499
5502
  raise NotSupported(self.id + ' fetchDeposits() is not supported yet')
5500
5503
 
5501
- def fetch_withdrawals(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
5504
+ def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
5502
5505
  raise NotSupported(self.id + ' fetchWithdrawals() is not supported yet')
5503
5506
 
5504
5507
  def fetch_deposits_ws(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
ccxt/bitget.py CHANGED
@@ -4111,82 +4111,35 @@ class bitget(Exchange, ImplicitAPI):
4111
4111
  # "result": "success"
4112
4112
  # }
4113
4113
  #
4114
- # spot: fetchOrder
4115
- #
4116
- # {
4117
- # "userId": "7264631750",
4118
- # "symbol": "BTCUSDT",
4119
- # "orderId": "1111461743123927040",
4120
- # "clientOid": "63f95110-93b5-4309-8f77-46339f1bcf3c",
4121
- # "price": "25000.0000000000000000",
4122
- # "size": "0.0002000000000000",
4123
- # "orderType": "limit",
4124
- # "side": "buy",
4125
- # "status": "live",
4126
- # "priceAvg": "0",
4127
- # "baseVolume": "0.0000000000000000",
4128
- # "quoteVolume": "0.0000000000000000",
4129
- # "enterPointSource": "API",
4130
- # "feeDetail": "",
4131
- # "orderSource": "normal",
4132
- # "cTime": "1700719050198",
4133
- # "uTime": "1700719050198"
4134
- # }
4135
- #
4136
- # swap and future: fetchOrder
4137
- #
4138
- # {
4139
- # "symbol": "BTCUSDT",
4140
- # "size": "0.001",
4141
- # "orderId": "1111465253393825792",
4142
- # "clientOid": "1111465253431574529",
4143
- # "baseVolume": "0",
4144
- # "fee": "0",
4145
- # "price": "27000",
4146
- # "priceAvg": "",
4147
- # "state": "live",
4148
- # "side": "buy",
4149
- # "force": "gtc",
4150
- # "totalProfits": "0",
4151
- # "posSide": "long",
4152
- # "marginCoin": "USDT",
4153
- # "presetStopSurplusPrice": "",
4154
- # "presetStopLossPrice": "",
4155
- # "quoteVolume": "0",
4156
- # "orderType": "limit",
4157
- # "leverage": "20",
4158
- # "marginMode": "crossed",
4159
- # "reduceOnly": "NO",
4160
- # "enterPointSource": "API",
4161
- # "tradeSide": "open",
4162
- # "posMode": "hedge_mode",
4163
- # "orderSource": "normal",
4164
- # "cTime": "1700719887120",
4165
- # "uTime": "1700719887120"
4166
- # }
4167
- #
4168
- # spot: fetchOpenOrders
4114
+ # spot: fetchOrder, fetchOpenOrders, fetchCanceledAndClosedOrders
4169
4115
  #
4170
4116
  # {
4171
4117
  # "userId": "7264631750",
4172
4118
  # "symbol": "BTCUSDT",
4173
4119
  # "orderId": "1111499608327360513",
4174
4120
  # "clientOid": "d0d4dad5-18d0-4869-a074-ec40bb47cba6",
4175
- # "priceAvg": "25000.0000000000000000",
4176
- # "size": "0.0002000000000000",
4121
+ # "size": "0.0002000000000000", # COST for 'buy market' order! AMOUNT in all other cases
4122
+ # "price": "0", # in fetchOrder: 0 for market order, otherwise limit price(field not present in fetchOpenOrders
4177
4123
  # "orderType": "limit",
4178
4124
  # "side": "buy",
4179
4125
  # "status": "live",
4180
4126
  # "basePrice": "0",
4181
- # "baseVolume": "0.0000000000000000",
4182
- # "quoteVolume": "0.0000000000000000",
4127
+ # "priceAvg": "25000.0000000000000000", # 0 if nothing filled
4128
+ # "baseVolume": "0.0000000000000000", # 0 if nothing filled
4129
+ # "quoteVolume": "0.0000000000000000", # 0 if nothing filled
4183
4130
  # "enterPointSource": "WEB",
4184
4131
  # "orderSource": "normal",
4185
4132
  # "cTime": "1700728077966",
4186
4133
  # "uTime": "1700728077966"
4134
+ # "feeDetail": "{\\"newFees\\":{\\"c\\":0,\\"d\\":0,\\"deduction\\":false,\\"r\\":-0.0064699886,\\"t\\":-0.0064699886,\\"totalDeductionFee\\":0},\\"USDT\\":{\\"deduction\\":false,\\"feeCoinCode\\":\\"USDT\\",\\"totalDeductionFee\\":0,\\"totalFee\\":-0.0064699886000000}}", # might not be present in fetchOpenOrders
4135
+ # "triggerPrice": null,
4136
+ # "tpslType": "normal",
4137
+ # "quoteCoin": "USDT", # not present in fetchOpenOrders
4138
+ # "baseCoin": "DOT", # not present in fetchOpenOrders
4139
+ # "cancelReason": "", # not present in fetchOpenOrders
4187
4140
  # }
4188
4141
  #
4189
- # spot stop: fetchOpenOrders, fetchCanceledAndClosedOrders
4142
+ # spot trigger: fetchOpenOrders, fetchCanceledAndClosedOrders
4190
4143
  #
4191
4144
  # {
4192
4145
  # "orderId": "1111503385931620352",
@@ -4227,18 +4180,19 @@ class bitget(Exchange, ImplicitAPI):
4227
4180
  # "uTime": "1700729691866"
4228
4181
  # }
4229
4182
  #
4230
- # swap: fetchOpenOrders, fetchCanceledAndClosedOrders
4183
+ # swap and future: fetchOrder, fetchOpenOrders, fetchCanceledAndClosedOrders
4231
4184
  #
4232
4185
  # {
4233
4186
  # "symbol": "BTCUSDT",
4234
- # "size": "0.002",
4235
- # "orderId": "1111488897767604224",
4236
- # "clientOid": "1111488897805352960",
4187
+ # "size": "0.001",
4188
+ # "orderId": "1111465253393825792",
4189
+ # "clientOid": "1111465253431574529",
4237
4190
  # "baseVolume": "0",
4238
4191
  # "fee": "0",
4239
- # "price": "25000",
4192
+ # "price": "27000",
4240
4193
  # "priceAvg": "",
4241
- # "status": "live",
4194
+ # "state": "live",
4195
+ # # "status": "live", # key for fetchOpenOrders, fetchClosedOrders
4242
4196
  # "side": "buy",
4243
4197
  # "force": "gtc",
4244
4198
  # "totalProfits": "0",
@@ -4247,7 +4201,7 @@ class bitget(Exchange, ImplicitAPI):
4247
4201
  # "quoteVolume": "0",
4248
4202
  # "leverage": "20",
4249
4203
  # "marginMode": "crossed",
4250
- # "enterPointSource": "web",
4204
+ # "enterPointSource": "API",
4251
4205
  # "tradeSide": "open",
4252
4206
  # "posMode": "hedge_mode",
4253
4207
  # "orderType": "limit",
@@ -4255,94 +4209,22 @@ class bitget(Exchange, ImplicitAPI):
4255
4209
  # "presetStopSurplusPrice": "",
4256
4210
  # "presetStopLossPrice": "",
4257
4211
  # "reduceOnly": "NO",
4258
- # "cTime": "1700725524378",
4259
- # "uTime": "1700725524378"
4260
- # }
4212
+ # "cTime": "1700719887120",
4213
+ # "uTime": "1700719887120"
4261
4214
  #
4262
- # swap stop: fetchOpenOrders
4215
+ # for swap trigger order, the additional below fields are present:
4263
4216
  #
4264
- # {
4265
4217
  # "planType": "normal_plan",
4266
- # "symbol": "BTCUSDT",
4267
- # "size": "0.001",
4268
- # "orderId": "1111491399869075457",
4269
- # "clientOid": "1111491399869075456",
4270
- # "price": "27000",
4271
4218
  # "callbackRatio": "",
4272
4219
  # "triggerPrice": "24000",
4273
4220
  # "triggerType": "mark_price",
4274
4221
  # "planStatus": "live",
4275
- # "side": "buy",
4276
- # "posSide": "long",
4277
- # "marginCoin": "USDT",
4278
- # "marginMode": "crossed",
4279
- # "enterPointSource": "API",
4280
- # "tradeSide": "open",
4281
- # "posMode": "hedge_mode",
4282
- # "orderType": "limit",
4283
- # "stopSurplusTriggerPrice": "",
4284
- # "stopSurplusExecutePrice": "",
4285
- # "stopSurplusTriggerType": "fill_price",
4286
- # "stopLossTriggerPrice": "",
4287
- # "stopLossExecutePrice": "",
4288
- # "stopLossTriggerType": "fill_price",
4289
- # "cTime": "1700726120917",
4290
- # "uTime": "1700726120917"
4291
- # }
4292
- #
4293
- # spot: fetchCanceledAndClosedOrders
4294
- #
4295
- # {
4296
- # "userId": "7264631750",
4297
- # "symbol": "BTCUSDT",
4298
- # "orderId": "1111499608327360513",
4299
- # "clientOid": "d0d4dad5-18d0-4869-a074-ec40bb47cba6",
4300
- # "price": "25000.0000000000000000",
4301
- # "size": "0.0002000000000000",
4302
- # "orderType": "limit",
4303
- # "side": "buy",
4304
- # "status": "cancelled",
4305
- # "priceAvg": "0",
4306
- # "baseVolume": "0.0000000000000000",
4307
- # "quoteVolume": "0.0000000000000000",
4308
- # "enterPointSource": "WEB",
4309
- # "feeDetail": "",
4310
- # "orderSource": "normal",
4311
- # "cTime": "1700728077966",
4312
- # "uTime": "1700728911471"
4313
- # }
4314
- #
4315
- # swap stop: fetchCanceledAndClosedOrders
4316
- #
4317
- # {
4318
- # "planType": "normal_plan",
4319
- # "symbol": "BTCUSDT",
4320
- # "size": "0.001",
4321
- # "orderId": "1111491399869075457",
4322
- # "clientOid": "1111491399869075456",
4323
- # "planStatus": "cancelled",
4324
- # "price": "27000",
4325
- # "feeDetail": null,
4326
- # "baseVolume": "0",
4327
- # "callbackRatio": "",
4328
- # "triggerPrice": "24000",
4329
- # "triggerType": "mark_price",
4330
- # "side": "buy",
4331
- # "posSide": "long",
4332
- # "marginCoin": "USDT",
4333
- # "marginMode": "crossed",
4334
- # "enterPointSource": "API",
4335
- # "tradeSide": "open",
4336
- # "posMode": "hedge_mode",
4337
- # "orderType": "limit",
4338
4222
  # "stopSurplusTriggerPrice": "",
4339
4223
  # "stopSurplusExecutePrice": "",
4340
4224
  # "stopSurplusTriggerType": "fill_price",
4341
4225
  # "stopLossTriggerPrice": "",
4342
4226
  # "stopLossExecutePrice": "",
4343
4227
  # "stopLossTriggerType": "fill_price",
4344
- # "cTime": "1700726120917",
4345
- # "uTime": "1700727879652"
4346
4228
  # }
4347
4229
  #
4348
4230
  errorMessage = self.safe_string(order, 'errorMsg')
@@ -4420,6 +4302,11 @@ class bitget(Exchange, ImplicitAPI):
4420
4302
  side = 'sell' if (side == 'buy') else 'buy'
4421
4303
  # on bitget hedge mode if the position is long the side is always buy, and if the position is short the side is always sell
4422
4304
  # so the side of the reduceOnly order is inversed
4305
+ orderType = self.safe_string(order, 'orderType')
4306
+ isBuyMarket = (side == 'buy') and (orderType == 'market')
4307
+ if market['spot'] and isBuyMarket:
4308
+ # in top comment, for 'buy market' the 'size' field is COST, not AMOUNT
4309
+ size = self.safe_string(order, 'baseVolume')
4423
4310
  return self.safe_order({
4424
4311
  'info': order,
4425
4312
  'id': self.safe_string_2(order, 'orderId', 'data'),
@@ -4429,7 +4316,7 @@ class bitget(Exchange, ImplicitAPI):
4429
4316
  'lastTradeTimestamp': updateTimestamp,
4430
4317
  'lastUpdateTimestamp': updateTimestamp,
4431
4318
  'symbol': market['symbol'],
4432
- 'type': self.safe_string(order, 'orderType'),
4319
+ 'type': orderType,
4433
4320
  'side': side,
4434
4321
  'price': price,
4435
4322
  'amount': size,
ccxt/bitmart.py CHANGED
@@ -3083,7 +3083,7 @@ class bitmart(Exchange, ImplicitAPI):
3083
3083
  # }
3084
3084
  #
3085
3085
  if market['swap']:
3086
- return response
3086
+ return self.safe_order({'info': response})
3087
3087
  data = self.safe_value(response, 'data')
3088
3088
  if data is True:
3089
3089
  return self.safe_order({'id': id}, market)
@@ -3200,7 +3200,7 @@ class bitmart(Exchange, ImplicitAPI):
3200
3200
  # "trace": "7f9c94e10f9d4513bc08a7bfc2a5559a.70.16954131323145323"
3201
3201
  # }
3202
3202
  #
3203
- return response
3203
+ return [self.safe_order({'info': response})]
3204
3204
 
3205
3205
  def fetch_orders_by_status(self, status, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
3206
3206
  if symbol is None: