mexc-exchange-api 0.0.91__py3-none-any.whl → 0.0.93__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of mexc-exchange-api might be problematic. Click here for more details.

mexc/ccxt/__init__.py CHANGED
@@ -26,7 +26,7 @@ sys.modules['ccxt'] = ccxt_module
26
26
 
27
27
  # ----------------------------------------------------------------------------
28
28
 
29
- __version__ = '4.5.6'
29
+ __version__ = '4.5.8'
30
30
 
31
31
  # ----------------------------------------------------------------------------
32
32
 
@@ -58,6 +58,7 @@ class ImplicitAPI:
58
58
  spot_private_get_mxdeduct_enable = spotPrivateGetMxDeductEnable = Entry('mxDeduct/enable', ['spot', 'private'], 'GET', {'cost': 1})
59
59
  spot_private_get_userdatastream = spotPrivateGetUserDataStream = Entry('userDataStream', ['spot', 'private'], 'GET', {'cost': 1})
60
60
  spot_private_get_selfsymbols = spotPrivateGetSelfSymbols = Entry('selfSymbols', ['spot', 'private'], 'GET', {'cost': 1})
61
+ spot_private_get_asset_internal_transfer_record = spotPrivateGetAssetInternalTransferRecord = Entry('asset/internal/transfer/record', ['spot', 'private'], 'GET', {'cost': 10})
61
62
  spot_private_post_order = spotPrivatePostOrder = Entry('order', ['spot', 'private'], 'POST', {'cost': 1})
62
63
  spot_private_post_order_test = spotPrivatePostOrderTest = Entry('order/test', ['spot', 'private'], 'POST', {'cost': 1})
63
64
  spot_private_post_sub_account_virtualsubaccount = spotPrivatePostSubAccountVirtualSubAccount = Entry('sub-account/virtualSubAccount', ['spot', 'private'], 'POST', {'cost': 1})
@@ -8,7 +8,7 @@ sys.modules['ccxt'] = ccxt_module
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
11
- __version__ = '4.5.6'
11
+ __version__ = '4.5.8'
12
12
 
13
13
  # -----------------------------------------------------------------------------
14
14
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '4.5.6'
5
+ __version__ = '4.5.8'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8
 
@@ -245,6 +245,7 @@ class mexc(Exchange, ImplicitAPI):
245
245
  'mxDeduct/enable': 1,
246
246
  'userDataStream': 1,
247
247
  'selfSymbols': 1,
248
+ 'asset/internal/transfer/record': 10,
248
249
  },
249
250
  'post': {
250
251
  'order': 1,
@@ -5030,7 +5031,7 @@ class mexc(Exchange, ImplicitAPI):
5030
5031
  request: dict = {
5031
5032
  'transact_id': id,
5032
5033
  }
5033
- response = await self.spot2PrivateGetAssetInternalTransferInfo(self.extend(request, query))
5034
+ response = await self.spotPrivateGetAssetInternalTransferRecord(self.extend(request, query))
5034
5035
  #
5035
5036
  # {
5036
5037
  # "code": "200",
@@ -5056,54 +5057,74 @@ class mexc(Exchange, ImplicitAPI):
5056
5057
 
5057
5058
  https://mexcdevelop.github.io/apidocs/spot_v2_en/#get-internal-assets-transfer-records
5058
5059
  https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-user-39-s-asset-transfer-records
5060
+ https://www.mexc.com/api-docs/spot-v3/wallet-endpoints#query-user-universal-transfer-history :param str code: unified currency code of the currency transferred
5059
5061
 
5060
- :param str code: unified currency code of the currency transferred
5062
+ @param code
5061
5063
  :param int [since]: the earliest time in ms to fetch transfers for
5062
5064
  :param int [limit]: the maximum number of transfers structures to retrieve
5063
5065
  :param dict [params]: extra parameters specific to the exchange API endpoint
5066
+ :param str [params.fromAccountType]: 'SPOT' for spot wallet, 'FUTURES' for contract wallet
5067
+ :param str [params.toAccountType]: 'SPOT' for spot wallet, 'FUTURES' for contract wallet
5064
5068
  :returns dict[]: a list of `transfer structures <https://docs.ccxt.com/#/?id=transfer-structure>`
5065
5069
  """
5066
- marketType, query = self.handle_market_type_and_params('fetchTransfers', None, params)
5070
+ marketType = None
5071
+ marketType, params = self.handle_market_type_and_params('fetchTransfers', None, params)
5067
5072
  await self.load_markets()
5068
5073
  request: dict = {}
5069
5074
  currency = None
5070
- resultList = None
5071
5075
  if code is not None:
5072
5076
  currency = self.currency(code)
5073
- request['currency'] = currency['id']
5077
+ fromAccountType = None
5078
+ fromAccountType, params = self.handle_option_and_params(params, 'fetchTransfers', 'fromAccountType')
5079
+ accountTypes = {
5080
+ 'spot': 'SPOT',
5081
+ 'swap': 'FUTURES',
5082
+ 'futures': 'FUTURES',
5083
+ 'future': 'FUTURES',
5084
+ 'margin': 'SPOT',
5085
+ }
5086
+ if fromAccountType is not None:
5087
+ request['fromAccountType'] = self.safe_string(accountTypes, fromAccountType, fromAccountType)
5088
+ else:
5089
+ raise ArgumentsRequired(self.id + ' fetchTransfers() requires a fromAccountType parameter, one of "SPOT", "FUTURES"')
5090
+ toAccountType = None
5091
+ toAccountType, params = self.handle_option_and_params(params, 'fetchTransfers', 'toAccountType')
5092
+ if toAccountType is not None:
5093
+ request['toAccountType'] = self.safe_string(accountTypes, toAccountType, toAccountType)
5094
+ else:
5095
+ raise ArgumentsRequired(self.id + ' fetchTransfers() requires a toAccountType parameter, one of "SPOT", "FUTURES"')
5096
+ resultList = []
5074
5097
  if marketType == 'spot':
5075
5098
  if since is not None:
5076
- request['start_time'] = since
5099
+ request['startTime'] = since
5077
5100
  if limit is not None:
5078
- if limit > 50:
5101
+ if limit > 100:
5079
5102
  raise ExchangeError('This exchange supports a maximum limit of 50')
5080
- request['page-size'] = limit
5081
- response = await self.spot2PrivateGetAssetInternalTransferRecord(self.extend(request, query))
5103
+ request['size'] = limit
5104
+ response = await self.spotPrivateGetCapitalTransfer(self.extend(request, params))
5082
5105
  #
5083
- # {
5084
- # "code": "200",
5085
- # "data": {
5086
- # "total_page": "1",
5087
- # "total_size": "5",
5088
- # "result_list": [{
5089
- # "currency": "USDT",
5090
- # "amount": "1",
5091
- # "transact_id": "954877a2ef54499db9b28a7cf9ebcf41",
5092
- # "from": "MAIN",
5093
- # "to": "CONTRACT",
5094
- # "transact_state": "SUCCESS"
5095
- # },
5096
- # ...
5097
- # ]
5098
- # }
5099
- # }
5100
5106
  #
5101
- data = self.safe_value(response, 'data', {})
5102
- resultList = self.safe_value(data, 'result_list', [])
5107
+ # {
5108
+ # "rows": [
5109
+ # {
5110
+ # "tranId": "cdf0d2a618b5458c965baefe6b1d0859",
5111
+ # "clientTranId": null,
5112
+ # "asset": "USDT",
5113
+ # "amount": "1",
5114
+ # "fromAccountType": "FUTURES",
5115
+ # "toAccountType": "SPOT",
5116
+ # "symbol": null,
5117
+ # "status": "SUCCESS",
5118
+ # "timestamp": 1759328309000
5119
+ # }
5120
+ # ],
5121
+ # "total": 1
5122
+ # }
5123
+ resultList = self.safe_list(response, 'rows', [])
5103
5124
  elif marketType == 'swap':
5104
5125
  if limit is not None:
5105
5126
  request['page_size'] = limit
5106
- response = await self.contractPrivateGetAccountTransferRecord(self.extend(request, query))
5127
+ response = await self.contractPrivateGetAccountTransferRecord(self.extend(request, params))
5107
5128
  data = self.safe_value(response, 'data')
5108
5129
  resultList = self.safe_value(data, 'resultList')
5109
5130
  #
@@ -5151,10 +5172,10 @@ class mexc(Exchange, ImplicitAPI):
5151
5172
  accounts: dict = {
5152
5173
  'spot': 'SPOT',
5153
5174
  'swap': 'FUTURES',
5154
- 'margin': 'ISOLATED_MARGIN',
5175
+ 'future': 'FUTURES',
5155
5176
  }
5156
- fromId = self.safe_string(accounts, fromAccount)
5157
- toId = self.safe_string(accounts, toAccount)
5177
+ fromId = self.safe_string(accounts, fromAccount, fromAccount)
5178
+ toId = self.safe_string(accounts, toAccount, toAccount)
5158
5179
  if fromId is None:
5159
5180
  keys = list(accounts.keys())
5160
5181
  raise ExchangeError(self.id + ' fromAccount must be one of ' + ', '.join(keys))
@@ -5212,6 +5233,17 @@ class mexc(Exchange, ImplicitAPI):
5212
5233
  # "createTime": "1648849076000",
5213
5234
  # "updateTime": "1648849076000"
5214
5235
  # }
5236
+ # {
5237
+ # "tranId": "cdf0d2a618b5458c965baefe6b1d0859",
5238
+ # "clientTranId": null,
5239
+ # "asset": "USDT",
5240
+ # "amount": "1",
5241
+ # "fromAccountType": "FUTURES",
5242
+ # "toAccountType": "SPOT",
5243
+ # "symbol": null,
5244
+ # "status": "SUCCESS",
5245
+ # "timestamp": 1759328309000
5246
+ # }
5215
5247
  #
5216
5248
  # transfer
5217
5249
  #
@@ -5219,14 +5251,19 @@ class mexc(Exchange, ImplicitAPI):
5219
5251
  # "tranId": "ebb06123e6a64f4ab234b396c548d57e"
5220
5252
  # }
5221
5253
  #
5222
- currencyId = self.safe_string(transfer, 'currency')
5254
+ currencyId = self.safe_string_2(transfer, 'currency', 'asset')
5223
5255
  id = self.safe_string_n(transfer, ['transact_id', 'txid', 'tranId'])
5224
- timestamp = self.safe_integer(transfer, 'createTime')
5256
+ timestamp = self.safe_integer_2(transfer, 'createTime', 'timestamp')
5225
5257
  datetime = self.iso8601(timestamp) if (timestamp is not None) else None
5226
5258
  direction = self.safe_string(transfer, 'type')
5227
5259
  accountFrom = None
5228
5260
  accountTo = None
5229
- if direction is not None:
5261
+ fromAccountType = self.safe_string(transfer, 'fromAccountType')
5262
+ toAccountType = self.safe_string(transfer, 'toAccountType')
5263
+ if (fromAccountType is not None) and (toAccountType is not None):
5264
+ accountFrom = fromAccountType
5265
+ accountTo = toAccountType
5266
+ elif direction is not None:
5230
5267
  accountFrom = 'MAIN' if (direction == 'IN') else 'CONTRACT'
5231
5268
  accountTo = 'CONTRACT' if (direction == 'IN') else 'MAIN'
5232
5269
  else:
@@ -5241,11 +5278,13 @@ class mexc(Exchange, ImplicitAPI):
5241
5278
  'amount': self.safe_number(transfer, 'amount'),
5242
5279
  'fromAccount': self.parse_account_id(accountFrom),
5243
5280
  'toAccount': self.parse_account_id(accountTo),
5244
- 'status': self.parse_transfer_status(self.safe_string_2(transfer, 'transact_state', 'state')),
5281
+ 'status': self.parse_transfer_status(self.safe_string_n(transfer, ['transact_state', 'state', 'status'])),
5245
5282
  }
5246
5283
 
5247
5284
  def parse_account_id(self, status):
5248
5285
  statuses: dict = {
5286
+ 'SPOT': 'spot',
5287
+ 'FUTURES': 'swap',
5249
5288
  'MAIN': 'spot',
5250
5289
  'CONTRACT': 'swap',
5251
5290
  }
mexc/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': {
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.5.6'
7
+ __version__ = '4.5.8'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -4739,9 +4739,12 @@ class Exchange(object):
4739
4739
  i_count = 6
4740
4740
  tradesLength = len(trades)
4741
4741
  oldest = min(tradesLength, limit)
4742
+ options = self.safe_dict(self.options, 'buildOHLCVC', {})
4743
+ skipZeroPrices = self.safe_bool(options, 'skipZeroPrices', True)
4742
4744
  for i in range(0, oldest):
4743
4745
  trade = trades[i]
4744
4746
  ts = trade['timestamp']
4747
+ price = trade['price']
4745
4748
  if ts < since:
4746
4749
  continue
4747
4750
  openingTime = int(math.floor(ts / ms)) * ms # shift to the edge of m/h/d(but not M)
@@ -4749,22 +4752,25 @@ class Exchange(object):
4749
4752
  continue
4750
4753
  ohlcv_length = len(ohlcvs)
4751
4754
  candle = ohlcv_length - 1
4752
- if (candle == -1) or (openingTime >= self.sum(ohlcvs[candle][i_timestamp], ms)):
4755
+ if skipZeroPrices and not (price > 0) and not (price < 0):
4756
+ continue
4757
+ isFirstCandle = candle == -1
4758
+ if isFirstCandle or openingTime >= self.sum(ohlcvs[candle][i_timestamp], ms):
4753
4759
  # moved to a new timeframe -> create a new candle from opening trade
4754
4760
  ohlcvs.append([
4755
4761
  openingTime, # timestamp
4756
- trade['price'], # O
4757
- trade['price'], # H
4758
- trade['price'], # L
4759
- trade['price'], # C
4762
+ price, # O
4763
+ price, # H
4764
+ price, # L
4765
+ price, # C
4760
4766
  trade['amount'], # V
4761
4767
  1, # count
4762
4768
  ])
4763
4769
  else:
4764
4770
  # still processing the same timeframe -> update opening trade
4765
- ohlcvs[candle][i_high] = max(ohlcvs[candle][i_high], trade['price'])
4766
- ohlcvs[candle][i_low] = min(ohlcvs[candle][i_low], trade['price'])
4767
- ohlcvs[candle][i_close] = trade['price']
4771
+ ohlcvs[candle][i_high] = max(ohlcvs[candle][i_high], price)
4772
+ ohlcvs[candle][i_low] = min(ohlcvs[candle][i_low], price)
4773
+ ohlcvs[candle][i_close] = price
4768
4774
  ohlcvs[candle][i_volume] = self.sum(ohlcvs[candle][i_volume], trade['amount'])
4769
4775
  ohlcvs[candle][i_count] = self.sum(ohlcvs[candle][i_count], 1)
4770
4776
  return ohlcvs
@@ -7186,9 +7192,9 @@ class Exchange(object):
7186
7192
  symbols = self.safe_list(subscription, 'symbols', [])
7187
7193
  symbolsLength = len(symbols)
7188
7194
  if topic == 'ohlcv':
7189
- symbolsAndTimeFrames = self.safe_list(subscription, 'symbolsAndTimeframes', [])
7190
- for i in range(0, len(symbolsAndTimeFrames)):
7191
- symbolAndTimeFrame = symbolsAndTimeFrames[i]
7195
+ symbolsAndTimeframes = self.safe_list(subscription, 'symbolsAndTimeframes', [])
7196
+ for i in range(0, len(symbolsAndTimeframes)):
7197
+ symbolAndTimeFrame = symbolsAndTimeframes[i]
7192
7198
  symbol = self.safe_string(symbolAndTimeFrame, 0)
7193
7199
  timeframe = self.safe_string(symbolAndTimeFrame, 1)
7194
7200
  if (self.ohlcvs is not None) and (symbol in self.ohlcvs):
@@ -7206,6 +7212,9 @@ class Exchange(object):
7206
7212
  elif topic == 'ticker':
7207
7213
  if symbol in self.tickers:
7208
7214
  del self.tickers[symbol]
7215
+ elif topic == 'bidsasks':
7216
+ if symbol in self.bidsasks:
7217
+ del self.bidsasks[symbol]
7209
7218
  else:
7210
7219
  if topic == 'myTrades' and (self.myTrades is not None):
7211
7220
  self.myTrades = None
@@ -7225,3 +7234,9 @@ class Exchange(object):
7225
7234
  tickerSymbol = tickerSymbols[i]
7226
7235
  if tickerSymbol in self.tickers:
7227
7236
  del self.tickers[tickerSymbol]
7237
+ elif topic == 'bidsasks' and (self.bidsasks is not None):
7238
+ bidsaskSymbols = list(self.bidsasks.keys())
7239
+ for i in range(0, len(bidsaskSymbols)):
7240
+ bidsaskSymbol = bidsaskSymbols[i]
7241
+ if bidsaskSymbol in self.bidsasks:
7242
+ del self.bidsasks[bidsaskSymbol]
mexc/ccxt/mexc.py CHANGED
@@ -244,6 +244,7 @@ class mexc(Exchange, ImplicitAPI):
244
244
  'mxDeduct/enable': 1,
245
245
  'userDataStream': 1,
246
246
  'selfSymbols': 1,
247
+ 'asset/internal/transfer/record': 10,
247
248
  },
248
249
  'post': {
249
250
  'order': 1,
@@ -5029,7 +5030,7 @@ class mexc(Exchange, ImplicitAPI):
5029
5030
  request: dict = {
5030
5031
  'transact_id': id,
5031
5032
  }
5032
- response = self.spot2PrivateGetAssetInternalTransferInfo(self.extend(request, query))
5033
+ response = self.spotPrivateGetAssetInternalTransferRecord(self.extend(request, query))
5033
5034
  #
5034
5035
  # {
5035
5036
  # "code": "200",
@@ -5055,54 +5056,74 @@ class mexc(Exchange, ImplicitAPI):
5055
5056
 
5056
5057
  https://mexcdevelop.github.io/apidocs/spot_v2_en/#get-internal-assets-transfer-records
5057
5058
  https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-user-39-s-asset-transfer-records
5059
+ https://www.mexc.com/api-docs/spot-v3/wallet-endpoints#query-user-universal-transfer-history :param str code: unified currency code of the currency transferred
5058
5060
 
5059
- :param str code: unified currency code of the currency transferred
5061
+ @param code
5060
5062
  :param int [since]: the earliest time in ms to fetch transfers for
5061
5063
  :param int [limit]: the maximum number of transfers structures to retrieve
5062
5064
  :param dict [params]: extra parameters specific to the exchange API endpoint
5065
+ :param str [params.fromAccountType]: 'SPOT' for spot wallet, 'FUTURES' for contract wallet
5066
+ :param str [params.toAccountType]: 'SPOT' for spot wallet, 'FUTURES' for contract wallet
5063
5067
  :returns dict[]: a list of `transfer structures <https://docs.ccxt.com/#/?id=transfer-structure>`
5064
5068
  """
5065
- marketType, query = self.handle_market_type_and_params('fetchTransfers', None, params)
5069
+ marketType = None
5070
+ marketType, params = self.handle_market_type_and_params('fetchTransfers', None, params)
5066
5071
  self.load_markets()
5067
5072
  request: dict = {}
5068
5073
  currency = None
5069
- resultList = None
5070
5074
  if code is not None:
5071
5075
  currency = self.currency(code)
5072
- request['currency'] = currency['id']
5076
+ fromAccountType = None
5077
+ fromAccountType, params = self.handle_option_and_params(params, 'fetchTransfers', 'fromAccountType')
5078
+ accountTypes = {
5079
+ 'spot': 'SPOT',
5080
+ 'swap': 'FUTURES',
5081
+ 'futures': 'FUTURES',
5082
+ 'future': 'FUTURES',
5083
+ 'margin': 'SPOT',
5084
+ }
5085
+ if fromAccountType is not None:
5086
+ request['fromAccountType'] = self.safe_string(accountTypes, fromAccountType, fromAccountType)
5087
+ else:
5088
+ raise ArgumentsRequired(self.id + ' fetchTransfers() requires a fromAccountType parameter, one of "SPOT", "FUTURES"')
5089
+ toAccountType = None
5090
+ toAccountType, params = self.handle_option_and_params(params, 'fetchTransfers', 'toAccountType')
5091
+ if toAccountType is not None:
5092
+ request['toAccountType'] = self.safe_string(accountTypes, toAccountType, toAccountType)
5093
+ else:
5094
+ raise ArgumentsRequired(self.id + ' fetchTransfers() requires a toAccountType parameter, one of "SPOT", "FUTURES"')
5095
+ resultList = []
5073
5096
  if marketType == 'spot':
5074
5097
  if since is not None:
5075
- request['start_time'] = since
5098
+ request['startTime'] = since
5076
5099
  if limit is not None:
5077
- if limit > 50:
5100
+ if limit > 100:
5078
5101
  raise ExchangeError('This exchange supports a maximum limit of 50')
5079
- request['page-size'] = limit
5080
- response = self.spot2PrivateGetAssetInternalTransferRecord(self.extend(request, query))
5102
+ request['size'] = limit
5103
+ response = self.spotPrivateGetCapitalTransfer(self.extend(request, params))
5081
5104
  #
5082
- # {
5083
- # "code": "200",
5084
- # "data": {
5085
- # "total_page": "1",
5086
- # "total_size": "5",
5087
- # "result_list": [{
5088
- # "currency": "USDT",
5089
- # "amount": "1",
5090
- # "transact_id": "954877a2ef54499db9b28a7cf9ebcf41",
5091
- # "from": "MAIN",
5092
- # "to": "CONTRACT",
5093
- # "transact_state": "SUCCESS"
5094
- # },
5095
- # ...
5096
- # ]
5097
- # }
5098
- # }
5099
5105
  #
5100
- data = self.safe_value(response, 'data', {})
5101
- resultList = self.safe_value(data, 'result_list', [])
5106
+ # {
5107
+ # "rows": [
5108
+ # {
5109
+ # "tranId": "cdf0d2a618b5458c965baefe6b1d0859",
5110
+ # "clientTranId": null,
5111
+ # "asset": "USDT",
5112
+ # "amount": "1",
5113
+ # "fromAccountType": "FUTURES",
5114
+ # "toAccountType": "SPOT",
5115
+ # "symbol": null,
5116
+ # "status": "SUCCESS",
5117
+ # "timestamp": 1759328309000
5118
+ # }
5119
+ # ],
5120
+ # "total": 1
5121
+ # }
5122
+ resultList = self.safe_list(response, 'rows', [])
5102
5123
  elif marketType == 'swap':
5103
5124
  if limit is not None:
5104
5125
  request['page_size'] = limit
5105
- response = self.contractPrivateGetAccountTransferRecord(self.extend(request, query))
5126
+ response = self.contractPrivateGetAccountTransferRecord(self.extend(request, params))
5106
5127
  data = self.safe_value(response, 'data')
5107
5128
  resultList = self.safe_value(data, 'resultList')
5108
5129
  #
@@ -5150,10 +5171,10 @@ class mexc(Exchange, ImplicitAPI):
5150
5171
  accounts: dict = {
5151
5172
  'spot': 'SPOT',
5152
5173
  'swap': 'FUTURES',
5153
- 'margin': 'ISOLATED_MARGIN',
5174
+ 'future': 'FUTURES',
5154
5175
  }
5155
- fromId = self.safe_string(accounts, fromAccount)
5156
- toId = self.safe_string(accounts, toAccount)
5176
+ fromId = self.safe_string(accounts, fromAccount, fromAccount)
5177
+ toId = self.safe_string(accounts, toAccount, toAccount)
5157
5178
  if fromId is None:
5158
5179
  keys = list(accounts.keys())
5159
5180
  raise ExchangeError(self.id + ' fromAccount must be one of ' + ', '.join(keys))
@@ -5211,6 +5232,17 @@ class mexc(Exchange, ImplicitAPI):
5211
5232
  # "createTime": "1648849076000",
5212
5233
  # "updateTime": "1648849076000"
5213
5234
  # }
5235
+ # {
5236
+ # "tranId": "cdf0d2a618b5458c965baefe6b1d0859",
5237
+ # "clientTranId": null,
5238
+ # "asset": "USDT",
5239
+ # "amount": "1",
5240
+ # "fromAccountType": "FUTURES",
5241
+ # "toAccountType": "SPOT",
5242
+ # "symbol": null,
5243
+ # "status": "SUCCESS",
5244
+ # "timestamp": 1759328309000
5245
+ # }
5214
5246
  #
5215
5247
  # transfer
5216
5248
  #
@@ -5218,14 +5250,19 @@ class mexc(Exchange, ImplicitAPI):
5218
5250
  # "tranId": "ebb06123e6a64f4ab234b396c548d57e"
5219
5251
  # }
5220
5252
  #
5221
- currencyId = self.safe_string(transfer, 'currency')
5253
+ currencyId = self.safe_string_2(transfer, 'currency', 'asset')
5222
5254
  id = self.safe_string_n(transfer, ['transact_id', 'txid', 'tranId'])
5223
- timestamp = self.safe_integer(transfer, 'createTime')
5255
+ timestamp = self.safe_integer_2(transfer, 'createTime', 'timestamp')
5224
5256
  datetime = self.iso8601(timestamp) if (timestamp is not None) else None
5225
5257
  direction = self.safe_string(transfer, 'type')
5226
5258
  accountFrom = None
5227
5259
  accountTo = None
5228
- if direction is not None:
5260
+ fromAccountType = self.safe_string(transfer, 'fromAccountType')
5261
+ toAccountType = self.safe_string(transfer, 'toAccountType')
5262
+ if (fromAccountType is not None) and (toAccountType is not None):
5263
+ accountFrom = fromAccountType
5264
+ accountTo = toAccountType
5265
+ elif direction is not None:
5229
5266
  accountFrom = 'MAIN' if (direction == 'IN') else 'CONTRACT'
5230
5267
  accountTo = 'CONTRACT' if (direction == 'IN') else 'MAIN'
5231
5268
  else:
@@ -5240,11 +5277,13 @@ class mexc(Exchange, ImplicitAPI):
5240
5277
  'amount': self.safe_number(transfer, 'amount'),
5241
5278
  'fromAccount': self.parse_account_id(accountFrom),
5242
5279
  'toAccount': self.parse_account_id(accountTo),
5243
- 'status': self.parse_transfer_status(self.safe_string_2(transfer, 'transact_state', 'state')),
5280
+ 'status': self.parse_transfer_status(self.safe_string_n(transfer, ['transact_state', 'state', 'status'])),
5244
5281
  }
5245
5282
 
5246
5283
  def parse_account_id(self, status):
5247
5284
  statuses: dict = {
5285
+ 'SPOT': 'spot',
5286
+ 'FUTURES': 'swap',
5248
5287
  'MAIN': 'spot',
5249
5288
  'CONTRACT': 'swap',
5250
5289
  }
mexc/ccxt/pro/__init__.py CHANGED
@@ -8,7 +8,7 @@ sys.modules['ccxt'] = ccxt_module
8
8
 
9
9
  # ----------------------------------------------------------------------------
10
10
 
11
- __version__ = '4.5.6'
11
+ __version__ = '4.5.8'
12
12
 
13
13
  # ----------------------------------------------------------------------------
14
14
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mexc-exchange-api
3
- Version: 0.0.91
3
+ Version: 0.0.93
4
4
  Summary: mexc crypto exchange api client
5
5
  Project-URL: Homepage, https://github.com/ccxt/ccxt
6
6
  Project-URL: Issues, https://github.com/ccxt/ccxt
@@ -251,6 +251,7 @@ You can also construct custom requests to available "implicit" endpoints
251
251
  - `spot_private_get_mxdeduct_enable(request)`
252
252
  - `spot_private_get_userdatastream(request)`
253
253
  - `spot_private_get_selfsymbols(request)`
254
+ - `spot_private_get_asset_internal_transfer_record(request)`
254
255
  - `spot_private_post_order(request)`
255
256
  - `spot_private_post_order_test(request)`
256
257
  - `spot_private_post_sub_account_virtualsubaccount(request)`
@@ -1,11 +1,11 @@
1
1
  mexc/__init__.py,sha256=bFV_Nfz_k-lfB_ImsHGpFnJuVMUXLBRbttugnPV7c4A,222
2
- mexc/ccxt/__init__.py,sha256=sartpwjq6SmCLOjUw8p0JA91ftrXZ2kibsxxT2wyvt0,6126
3
- mexc/ccxt/mexc.py,sha256=wywyK6g7MmCsiZtcA_eaCdk6sh0wDGZJJDBWZLHSt5Y,261126
4
- mexc/ccxt/abstract/mexc.py,sha256=oyg0sZFYs1d77F-_9QAatqMSQJ8h-1u1wWb-d1DX2zQ,26434
5
- mexc/ccxt/async_support/__init__.py,sha256=8XjZxlbil-DxpD2H3rUlZr5r8jjNGj2wYRaeOBz8Isc,4859
6
- mexc/ccxt/async_support/mexc.py,sha256=KfoCfbCAKptK9fVeD31FX_oEjXUOjuZfSZPVwmv0bBM,262396
2
+ mexc/ccxt/__init__.py,sha256=ZsbtoLwU1lhBK7F4VUXk8QwaXigehws2fe8tuVMnT4E,6126
3
+ mexc/ccxt/mexc.py,sha256=jMADkRZIqSuX3S0iLEUrN2xJ9gh7teYqM9-l-ld3WoI,263123
4
+ mexc/ccxt/abstract/mexc.py,sha256=whLPllbBePbIrCwhJBWp4M7XPvz4PhheTlbcQExV_aY,26614
5
+ mexc/ccxt/async_support/__init__.py,sha256=rzwjZZj4o18ObirCpMhfGNp27MK92mu_48-JNhcScwc,4859
6
+ mexc/ccxt/async_support/mexc.py,sha256=H7yNnH9lzQ_7ahs9CvV8cJk7iNpp8iGyDLMjyI1T8f4,264393
7
7
  mexc/ccxt/async_support/base/__init__.py,sha256=aVYSsFi--b4InRs9zDN_wtCpj8odosAB726JdUHavrk,67
8
- mexc/ccxt/async_support/base/exchange.py,sha256=6Zi61lSs9WMY3guxZ3kHr8pzDe6du_Sg2h2OS76CBXw,121432
8
+ mexc/ccxt/async_support/base/exchange.py,sha256=tZkYR9xQuda7xih3SWPb06AY060rzSNvChWAUGVLijE,121432
9
9
  mexc/ccxt/async_support/base/throttler.py,sha256=tvDVcdRUVYi8fZRlEcnqtgzcgB_KMUMRs5Pu8tuU-tU,1847
10
10
  mexc/ccxt/async_support/base/ws/__init__.py,sha256=uockzpLuwntKGZbs5EOWFe-Zg-k6Cj7GhNJLc_RX0so,1791
11
11
  mexc/ccxt/async_support/base/ws/cache.py,sha256=xf2VOtfUwloxSlIQ39M1RGZHWQzyS9IGhB5NX6cDcAc,8370
@@ -16,11 +16,11 @@ mexc/ccxt/async_support/base/ws/order_book.py,sha256=uBUaIHhzMRykpmo4BCsdJ-t_Hoz
16
16
  mexc/ccxt/async_support/base/ws/order_book_side.py,sha256=GhnGUt78pJ-AYL_Dq9produGjmBJLCI5FHIRdMz1O-g,6551
17
17
  mexc/ccxt/base/__init__.py,sha256=eTx1OE3HJjspFUQjGm6LBhaQiMKJnXjkdP-JUXknyQ0,1320
18
18
  mexc/ccxt/base/decimal_to_precision.py,sha256=3XI30u9YudHbTA438397u5rkdlXa3atxwZEfUus3C4k,6803
19
- mexc/ccxt/base/errors.py,sha256=LdTTHPmxpeFHJze93mGl7I3maqTgN0y_1mJ6coWkXmA,4734
20
- mexc/ccxt/base/exchange.py,sha256=wn_4H8fZPOLHhDnWSZEpCMrQA2hzpPckzT2CuEfPEyk,343891
19
+ mexc/ccxt/base/errors.py,sha256=OGhWNvNtRlJOzFx-n1x3ZjTnaPpfWH0Vc0xACS-MeDw,5012
20
+ mexc/ccxt/base/exchange.py,sha256=yuPRnQ4rLdYg1JcwVKCjF-7dnQX1p328wCWdHXgALvQ,344628
21
21
  mexc/ccxt/base/precise.py,sha256=koce64Yrp6vFbGijJtUt-QQ6XhJgeGTCksZ871FPp_A,8886
22
22
  mexc/ccxt/base/types.py,sha256=Gvbogh9i7pPH7Z18xesYeDPribqqwq8uKpOv-YODFBs,11505
23
- mexc/ccxt/pro/__init__.py,sha256=Zi0Fz694B3uRRWoJkDAABfWP6SfNJNQXFY3r75kOaNY,4173
23
+ mexc/ccxt/pro/__init__.py,sha256=YBuXcfG3WKd9Z8TcA5TWPFu1NIXk_vIGLYE1X4OHU5E,4173
24
24
  mexc/ccxt/pro/mexc.py,sha256=F-GKatxBc-Z_R5Bxh_gtUt9gWDLtvSTg7RUGau5wB0s,77152
25
25
  mexc/ccxt/static_dependencies/README.md,sha256=3TCvhhn09_Cqf9BDDpao1V7EfKHDpQ6k9oWRsLFixpU,18
26
26
  mexc/ccxt/static_dependencies/__init__.py,sha256=tzFje8cloqmiIE6kola3EaYC0SnD1izWnri69hzHsSw,168
@@ -281,6 +281,6 @@ mexc/ccxt/static_dependencies/toolz/curried/exceptions.py,sha256=gKFOHDIayAWnX2u
281
281
  mexc/ccxt/static_dependencies/toolz/curried/operator.py,sha256=ML92mknkAwzBl2NCm-4werSUmJEtSHNY9NSzhseNM9s,525
282
282
  mexc/ccxt/static_dependencies/typing_inspect/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
283
283
  mexc/ccxt/static_dependencies/typing_inspect/typing_inspect.py,sha256=5gIWomLPfuDpgd3gX1GlnX0MuXM3VorR4j2W2qXORiQ,28269
284
- mexc_exchange_api-0.0.91.dist-info/METADATA,sha256=q_h2gCcQ7260FExPDfDH-z4hdyn57U_3-kwGMSi0avE,18072
285
- mexc_exchange_api-0.0.91.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
286
- mexc_exchange_api-0.0.91.dist-info/RECORD,,
284
+ mexc_exchange_api-0.0.93.dist-info/METADATA,sha256=1QXXN8T3ox73-nKFU5b4r98oU6M6G6N9wNTd-OpHMZM,18133
285
+ mexc_exchange_api-0.0.93.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
286
+ mexc_exchange_api-0.0.93.dist-info/RECORD,,