ccxt 4.4.85__py2.py3-none-any.whl → 4.4.87__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 (92) hide show
  1. ccxt/__init__.py +7 -5
  2. ccxt/abstract/modetrade.py +119 -0
  3. ccxt/abstract/myokx.py +2 -0
  4. ccxt/abstract/okx.py +2 -0
  5. ccxt/abstract/okxus.py +349 -0
  6. ccxt/ascendex.py +187 -151
  7. ccxt/async_support/__init__.py +7 -5
  8. ccxt/async_support/ascendex.py +187 -151
  9. ccxt/async_support/base/exchange.py +30 -26
  10. ccxt/async_support/bequant.py +1 -1
  11. ccxt/async_support/binance.py +1 -1
  12. ccxt/async_support/bitget.py +4 -4
  13. ccxt/async_support/bitmart.py +1 -1
  14. ccxt/async_support/bitteam.py +31 -0
  15. ccxt/async_support/{huobijp.py → bittrade.py} +11 -11
  16. ccxt/async_support/coinbase.py +2 -5
  17. ccxt/async_support/coinmetro.py +3 -0
  18. ccxt/async_support/deribit.py +4 -5
  19. ccxt/async_support/gate.py +91 -73
  20. ccxt/async_support/hollaex.py +106 -49
  21. ccxt/async_support/htx.py +30 -51
  22. ccxt/async_support/hyperliquid.py +36 -20
  23. ccxt/async_support/kraken.py +5 -8
  24. ccxt/async_support/mexc.py +2 -2
  25. ccxt/async_support/modetrade.py +2727 -0
  26. ccxt/async_support/ndax.py +25 -24
  27. ccxt/async_support/okcoin.py +12 -29
  28. ccxt/async_support/okx.py +99 -3
  29. ccxt/async_support/okxus.py +54 -0
  30. ccxt/async_support/onetrading.py +10 -7
  31. ccxt/async_support/oxfun.py +40 -110
  32. ccxt/async_support/paradex.py +6 -0
  33. ccxt/async_support/phemex.py +4 -6
  34. ccxt/async_support/poloniex.py +172 -159
  35. ccxt/async_support/probit.py +18 -47
  36. ccxt/async_support/timex.py +5 -10
  37. ccxt/async_support/vertex.py +3 -4
  38. ccxt/async_support/whitebit.py +41 -11
  39. ccxt/async_support/woo.py +101 -75
  40. ccxt/async_support/woofipro.py +25 -20
  41. ccxt/async_support/xt.py +31 -41
  42. ccxt/base/exchange.py +12 -9
  43. ccxt/bequant.py +1 -1
  44. ccxt/binance.py +1 -1
  45. ccxt/bitget.py +4 -4
  46. ccxt/bitmart.py +1 -1
  47. ccxt/bitteam.py +31 -0
  48. ccxt/{huobijp.py → bittrade.py} +11 -11
  49. ccxt/coinbase.py +2 -5
  50. ccxt/coinmetro.py +3 -0
  51. ccxt/deribit.py +4 -5
  52. ccxt/gate.py +91 -73
  53. ccxt/hollaex.py +106 -49
  54. ccxt/htx.py +30 -51
  55. ccxt/hyperliquid.py +36 -20
  56. ccxt/kraken.py +5 -8
  57. ccxt/mexc.py +2 -2
  58. ccxt/modetrade.py +2727 -0
  59. ccxt/ndax.py +25 -24
  60. ccxt/okcoin.py +12 -29
  61. ccxt/okx.py +99 -3
  62. ccxt/okxus.py +54 -0
  63. ccxt/onetrading.py +10 -7
  64. ccxt/oxfun.py +40 -110
  65. ccxt/paradex.py +6 -0
  66. ccxt/phemex.py +4 -6
  67. ccxt/poloniex.py +172 -159
  68. ccxt/pro/__init__.py +101 -3
  69. ccxt/pro/binance.py +1 -0
  70. ccxt/pro/{huobijp.py → bittrade.py} +3 -3
  71. ccxt/pro/luno.py +6 -5
  72. ccxt/pro/mexc.py +2 -0
  73. ccxt/pro/modetrade.py +1271 -0
  74. ccxt/pro/okxus.py +38 -0
  75. ccxt/probit.py +18 -47
  76. ccxt/test/tests_async.py +17 -1
  77. ccxt/test/tests_sync.py +17 -1
  78. ccxt/timex.py +5 -10
  79. ccxt/vertex.py +3 -4
  80. ccxt/whitebit.py +41 -11
  81. ccxt/woo.py +100 -75
  82. ccxt/woofipro.py +24 -20
  83. ccxt/xt.py +31 -41
  84. {ccxt-4.4.85.dist-info → ccxt-4.4.87.dist-info}/METADATA +19 -8
  85. {ccxt-4.4.85.dist-info → ccxt-4.4.87.dist-info}/RECORD +89 -84
  86. ccxt/abstract/kuna.py +0 -182
  87. ccxt/async_support/kuna.py +0 -1935
  88. ccxt/kuna.py +0 -1935
  89. /ccxt/abstract/{huobijp.py → bittrade.py} +0 -0
  90. {ccxt-4.4.85.dist-info → ccxt-4.4.87.dist-info}/LICENSE.txt +0 -0
  91. {ccxt-4.4.85.dist-info → ccxt-4.4.87.dist-info}/WHEEL +0 -0
  92. {ccxt-4.4.85.dist-info → ccxt-4.4.87.dist-info}/top_level.txt +0 -0
@@ -1131,9 +1131,7 @@ class phemex(Exchange, ImplicitAPI):
1131
1131
  for i in range(0, len(currencies)):
1132
1132
  currency = currencies[i]
1133
1133
  id = self.safe_string(currency, 'currency')
1134
- name = self.safe_string(currency, 'name')
1135
1134
  code = self.safe_currency_code(id)
1136
- status = self.safe_string(currency, 'status')
1137
1135
  valueScaleString = self.safe_string(currency, 'valueScale')
1138
1136
  valueScale = int(valueScaleString)
1139
1137
  minValueEv = self.safe_string(currency, 'minValueEv')
@@ -1146,12 +1144,12 @@ class phemex(Exchange, ImplicitAPI):
1146
1144
  precision = self.parse_number(precisionString)
1147
1145
  minAmount = self.parse_number(Precise.string_mul(minValueEv, precisionString))
1148
1146
  maxAmount = self.parse_number(Precise.string_mul(maxValueEv, precisionString))
1149
- result[code] = {
1147
+ result[code] = self.safe_currency_structure({
1150
1148
  'id': id,
1151
1149
  'info': currency,
1152
1150
  'code': code,
1153
- 'name': name,
1154
- 'active': status == 'Listed',
1151
+ 'name': self.safe_string(currency, 'name'),
1152
+ 'active': self.safe_string(currency, 'status') == 'Listed',
1155
1153
  'deposit': None,
1156
1154
  'withdraw': None,
1157
1155
  'fee': None,
@@ -1169,7 +1167,7 @@ class phemex(Exchange, ImplicitAPI):
1169
1167
  'valueScale': valueScale,
1170
1168
  'networks': None,
1171
1169
  'type': 'crypto',
1172
- }
1170
+ })
1173
1171
  return result
1174
1172
 
1175
1173
  def custom_parse_bid_ask(self, bidask, priceKey=0, amountKey=1, market: Market = None):
@@ -322,6 +322,11 @@ class poloniex(Exchange, ImplicitAPI):
322
322
  'BEP20': 'BSC',
323
323
  'ERC20': 'ETH',
324
324
  'TRC20': 'TRON',
325
+ 'TRX': 'TRON',
326
+ },
327
+ 'networksById': {
328
+ 'TRX': 'TRC20',
329
+ 'TRON': 'TRC20',
325
330
  },
326
331
  'limits': {
327
332
  'cost': {
@@ -1149,102 +1154,103 @@ class poloniex(Exchange, ImplicitAPI):
1149
1154
  response = await self.publicGetCurrencies(self.extend(params, {'includeMultiChainCurrencies': True}))
1150
1155
  #
1151
1156
  # [
1152
- # {
1153
- # "1CR": {
1154
- # "id": 1,
1155
- # "name": "1CRedit",
1156
- # "description": "BTC Clone",
1157
- # "type": "address",
1158
- # "withdrawalFee": "0.01000000",
1159
- # "minConf": 10000,
1160
- # "depositAddress": null,
1161
- # "blockchain": "1CR",
1162
- # "delisted": False,
1163
- # "tradingState": "NORMAL",
1164
- # "walletState": "DISABLED",
1165
- # "walletDepositState": "DISABLED",
1166
- # "walletWithdrawalState": "DISABLED",
1167
- # "parentChain": null,
1168
- # "isMultiChain": False,
1169
- # "isChildChain": False,
1170
- # "childChains": []
1171
- # }
1172
- # }
1157
+ # {
1158
+ # "USDT": {
1159
+ # "id": 214,
1160
+ # "name": "Tether USD",
1161
+ # "description": "Sweep to Main Account",
1162
+ # "type": "address",
1163
+ # "withdrawalFee": "0.00000000",
1164
+ # "minConf": 2,
1165
+ # "depositAddress": null,
1166
+ # "blockchain": "OMNI",
1167
+ # "delisted": False,
1168
+ # "tradingState": "NORMAL",
1169
+ # "walletState": "DISABLED",
1170
+ # "walletDepositState": "DISABLED",
1171
+ # "walletWithdrawalState": "DISABLED",
1172
+ # "supportCollateral": True,
1173
+ # "supportBorrow": True,
1174
+ # "parentChain": null,
1175
+ # "isMultiChain": True,
1176
+ # "isChildChain": False,
1177
+ # "childChains": [
1178
+ # "USDTBSC",
1179
+ # "USDTETH",
1180
+ # "USDTSOL",
1181
+ # "USDTTRON"
1182
+ # ]
1183
+ # }
1184
+ # },
1185
+ # ...
1186
+ # {
1187
+ # "USDTBSC": {
1188
+ # "id": 582,
1189
+ # "name": "Binance-Peg BSC-USD",
1190
+ # "description": "Sweep to Main Account",
1191
+ # "type": "address",
1192
+ # "withdrawalFee": "0.00000000",
1193
+ # "minConf": 15,
1194
+ # "depositAddress": null,
1195
+ # "blockchain": "BSC",
1196
+ # "delisted": False,
1197
+ # "tradingState": "OFFLINE",
1198
+ # "walletState": "ENABLED",
1199
+ # "walletDepositState": "ENABLED",
1200
+ # "walletWithdrawalState": "DISABLED",
1201
+ # "supportCollateral": False,
1202
+ # "supportBorrow": False,
1203
+ # "parentChain": "USDT",
1204
+ # "isMultiChain": True,
1205
+ # "isChildChain": True,
1206
+ # "childChains": []
1207
+ # }
1208
+ # },
1209
+ # ...
1173
1210
  # ]
1174
1211
  #
1175
1212
  result: dict = {}
1213
+ # poloniex has a complicated structure of currencies, so we handle them differently
1214
+ # at first, turn the response into a normal dictionary
1215
+ currenciesDict = {}
1176
1216
  for i in range(0, len(response)):
1177
- item = self.safe_value(response, i)
1217
+ item = self.safe_dict(response, i)
1178
1218
  ids = list(item.keys())
1179
- id = self.safe_value(ids, 0)
1180
- currency = self.safe_value(item, id)
1219
+ id = self.safe_string(ids, 0)
1220
+ currenciesDict[id] = item[id]
1221
+ keys = list(currenciesDict.keys())
1222
+ for i in range(0, len(keys)):
1223
+ id = keys[i]
1224
+ entry = currenciesDict[id]
1181
1225
  code = self.safe_currency_code(id)
1182
- name = self.safe_string(currency, 'name')
1183
- networkId = self.safe_string(currency, 'blockchain')
1184
- networkCode = None
1185
- if networkId is not None:
1186
- networkCode = self.network_id_to_code(networkId, code)
1187
- delisted = self.safe_value(currency, 'delisted')
1188
- walletEnabled = self.safe_string(currency, 'walletState') == 'ENABLED'
1189
- depositEnabled = self.safe_string(currency, 'walletDepositState') == 'ENABLED'
1190
- withdrawEnabled = self.safe_string(currency, 'walletWithdrawalState') == 'ENABLED'
1191
- active = not delisted and walletEnabled and depositEnabled and withdrawEnabled
1192
- numericId = self.safe_integer(currency, 'id')
1193
- feeString = self.safe_string(currency, 'withdrawalFee')
1194
- parentChain = self.safe_value(currency, 'parentChain')
1195
- noParentChain = parentChain is None
1196
- if self.safe_value(result, code) is None:
1197
- result[code] = {
1198
- 'id': id,
1199
- 'code': code,
1200
- 'info': None,
1201
- 'name': name,
1202
- 'active': active,
1203
- 'deposit': depositEnabled,
1204
- 'withdraw': withdrawEnabled,
1205
- 'fee': self.parse_number(feeString),
1206
- 'precision': None,
1207
- 'type': 'crypto',
1208
- 'limits': {
1209
- 'amount': {
1210
- 'min': None,
1211
- 'max': None,
1212
- },
1213
- 'deposit': {
1214
- 'min': None,
1215
- 'max': None,
1216
- },
1217
- 'withdraw': {
1218
- 'min': None,
1219
- 'max': None,
1220
- },
1221
- },
1222
- }
1223
- minFeeString = self.safe_string(result[code], 'fee')
1224
- if feeString is not None:
1225
- minFeeString = feeString if (minFeeString is None) else Precise.string_min(feeString, minFeeString)
1226
- depositAvailable = self.safe_value(result[code], 'deposit')
1227
- depositAvailable = depositEnabled if (depositEnabled) else depositAvailable
1228
- withdrawAvailable = self.safe_value(result[code], 'withdraw')
1229
- withdrawAvailable = withdrawEnabled if (withdrawEnabled) else withdrawAvailable
1230
- networks = self.safe_value(result[code], 'networks', {})
1231
- if networkCode is not None:
1226
+ # skip childChains, are collected in parentChain loop
1227
+ if self.safe_bool(entry, 'isChildChain'):
1228
+ continue
1229
+ allChainEntries = []
1230
+ childChains = self.safe_list(entry, 'childChains', [])
1231
+ if childChains is not None:
1232
+ for j in range(0, len(childChains)):
1233
+ childChainId = childChains[j]
1234
+ childNetworkEntry = self.safe_dict(currenciesDict, childChainId)
1235
+ allChainEntries.append(childNetworkEntry)
1236
+ allChainEntries.append(entry)
1237
+ networks: dict = {}
1238
+ for j in range(0, len(allChainEntries)):
1239
+ chainEntry = allChainEntries[j]
1240
+ networkName = self.safe_string(chainEntry, 'blockchain')
1241
+ networkCode = self.network_id_to_code(networkName, code)
1242
+ specialNetworkId = self.safe_string(childChains, j, id) # in case it's primary chain, defeault to ID
1232
1243
  networks[networkCode] = {
1233
- 'info': currency,
1234
- 'id': networkId,
1244
+ 'info': chainEntry,
1245
+ 'id': specialNetworkId, # we need self for deposit/withdrawal, instead of friendly name
1246
+ 'numericId': self.safe_integer(chainEntry, 'id'),
1235
1247
  'network': networkCode,
1236
- 'currencyId': id,
1237
- 'numericId': numericId,
1238
- 'deposit': depositEnabled,
1239
- 'withdraw': withdrawEnabled,
1240
- 'active': active,
1241
- 'fee': self.parse_number(feeString),
1248
+ 'active': self.safe_bool(chainEntry, 'walletState'),
1249
+ 'deposit': self.safe_string(chainEntry, 'walletDepositState') == 'ENABLED',
1250
+ 'withdraw': self.safe_string(chainEntry, 'walletWithdrawalState') == 'ENABLED',
1251
+ 'fee': self.safe_number(chainEntry, 'withdrawalFee'),
1242
1252
  'precision': None,
1243
1253
  'limits': {
1244
- 'amount': {
1245
- 'min': None,
1246
- 'max': None,
1247
- },
1248
1254
  'withdraw': {
1249
1255
  'min': None,
1250
1256
  'max': None,
@@ -1255,19 +1261,34 @@ class poloniex(Exchange, ImplicitAPI):
1255
1261
  },
1256
1262
  },
1257
1263
  }
1258
- result[code]['networks'] = networks
1259
- info = self.safe_value(result[code], 'info', [])
1260
- rawInfo: dict = {}
1261
- rawInfo[id] = currency
1262
- info.append(rawInfo)
1263
- result[code]['info'] = info
1264
- if noParentChain:
1265
- result[code]['id'] = id
1266
- result[code]['name'] = name
1267
- result[code]['active'] = depositAvailable and withdrawAvailable
1268
- result[code]['deposit'] = depositAvailable
1269
- result[code]['withdraw'] = withdrawAvailable
1270
- result[code]['fee'] = self.parse_number(minFeeString)
1264
+ result[code] = self.safe_currency_structure({
1265
+ 'info': entry,
1266
+ 'code': code,
1267
+ 'id': id,
1268
+ 'numericId': self.safe_integer(entry, 'id'),
1269
+ 'type': 'crypto',
1270
+ 'name': self.safe_string(entry, 'name'),
1271
+ 'active': None,
1272
+ 'deposit': None,
1273
+ 'withdraw': None,
1274
+ 'fee': None,
1275
+ 'precision': None,
1276
+ 'limits': {
1277
+ 'amount': {
1278
+ 'min': None,
1279
+ 'max': None,
1280
+ },
1281
+ 'withdraw': {
1282
+ 'min': None,
1283
+ 'max': None,
1284
+ },
1285
+ 'deposit': {
1286
+ 'min': None,
1287
+ 'max': None,
1288
+ },
1289
+ },
1290
+ 'networks': networks,
1291
+ })
1271
1292
  return result
1272
1293
 
1273
1294
  async def fetch_ticker(self, symbol: str, params={}) -> Ticker:
@@ -2585,40 +2606,15 @@ class poloniex(Exchange, ImplicitAPI):
2585
2606
  :returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
2586
2607
  """
2587
2608
  await self.load_markets()
2588
- currency = self.currency(code)
2589
- request: dict = {
2590
- 'currency': currency['id'],
2591
- }
2592
- networks = self.safe_value(self.options, 'networks', {})
2593
- network = self.safe_string_upper(params, 'network') # self line allows the user to specify either ERC20 or ETH
2594
- network = self.safe_string(networks, network, network) # handle ERC20>ETH alias
2595
- if network is not None:
2596
- request['currency'] = request['currency'] + network # when network the currency need to be changed to currency+network https://docs.poloniex.com/#withdraw on MultiChain Currencies section
2597
- params = self.omit(params, 'network')
2598
- else:
2599
- if currency['id'] == 'USDT':
2600
- raise ArgumentsRequired(self.id + ' createDepositAddress requires a network parameter for ' + code + '.')
2609
+ request, extraParams, currency, networkEntry = self.prepare_request_for_deposit_address(code, params)
2610
+ params = extraParams
2601
2611
  response = await self.privatePostWalletsAddress(self.extend(request, params))
2602
2612
  #
2603
2613
  # {
2604
2614
  # "address" : "0xfxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxf"
2605
2615
  # }
2606
2616
  #
2607
- address = self.safe_string(response, 'address')
2608
- tag: Str = None
2609
- self.check_address(address)
2610
- if currency is not None:
2611
- depositAddress = self.safe_string(currency['info'], 'depositAddress')
2612
- if depositAddress is not None:
2613
- tag = address
2614
- address = depositAddress
2615
- return {
2616
- 'currency': code,
2617
- 'address': address,
2618
- 'tag': tag,
2619
- 'network': network,
2620
- 'info': response,
2621
- }
2617
+ return self.parse_deposit_address_special(response, currency, networkEntry)
2622
2618
 
2623
2619
  async def fetch_deposit_address(self, code: str, params={}) -> DepositAddress:
2624
2620
  """
@@ -2631,37 +2627,56 @@ class poloniex(Exchange, ImplicitAPI):
2631
2627
  :returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
2632
2628
  """
2633
2629
  await self.load_markets()
2634
- currency = self.currency(code)
2635
- request: dict = {
2636
- 'currency': currency['id'],
2637
- }
2638
- networks = self.safe_value(self.options, 'networks', {})
2639
- network = self.safe_string_upper(params, 'network') # self line allows the user to specify either ERC20 or ETH
2640
- network = self.safe_string(networks, network, network) # handle ERC20>ETH alias
2641
- if network is not None:
2642
- request['currency'] = request['currency'] + network # when network the currency need to be changed to currency+network https://docs.poloniex.com/#withdraw on MultiChain Currencies section
2643
- params = self.omit(params, 'network')
2644
- else:
2645
- if currency['id'] == 'USDT':
2646
- raise ArgumentsRequired(self.id + ' fetchDepositAddress requires a network parameter for ' + code + '.')
2630
+ request, extraParams, currency, networkEntry = self.prepare_request_for_deposit_address(code, params)
2631
+ params = extraParams
2647
2632
  response = await self.privateGetWalletsAddresses(self.extend(request, params))
2648
2633
  #
2649
2634
  # {
2650
2635
  # "USDTTRON" : "Txxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxp"
2651
2636
  # }
2652
2637
  #
2653
- address = self.safe_string(response, request['currency'])
2638
+ keys = list(response.keys())
2639
+ length = len(keys)
2640
+ if length < 1:
2641
+ raise ExchangeError(self.id + ' fetchDepositAddress() returned an empty response, you might need to try "createDepositAddress" at first and then use "fetchDepositAddress"')
2642
+ return self.parse_deposit_address_special(response, currency, networkEntry)
2643
+
2644
+ def prepare_request_for_deposit_address(self, code: str, params: dict = {}) -> Any:
2645
+ if not (code in self.currencies):
2646
+ raise BadSymbol(self.id + ' fetchDepositAddress(): can not recognize ' + code + ' currency, you might try using unified currency-code and add provide specific "network" parameter, like: fetchDepositAddress("USDT", {"network": "TRC20"})')
2647
+ currency = self.currency(code)
2648
+ networkCode = None
2649
+ networkCode, params = self.handle_network_code_and_params(params)
2650
+ if networkCode is None:
2651
+ # we need to know the network to find out the currency-junction
2652
+ raise ArgumentsRequired(self.id + ' fetchDepositAddress requires a network parameter for ' + code + '.')
2653
+ exchangeNetworkId = None
2654
+ networkCode = self.network_id_to_code(networkCode, code)
2655
+ networkEntry = self.safe_dict(currency['networks'], networkCode)
2656
+ if networkEntry is not None:
2657
+ exchangeNetworkId = networkEntry['id']
2658
+ else:
2659
+ exchangeNetworkId = networkCode
2660
+ request = {
2661
+ 'currency': exchangeNetworkId,
2662
+ }
2663
+ return [request, params, currency, networkEntry]
2664
+
2665
+ def parse_deposit_address_special(self, response, currency, networkEntry) -> DepositAddress:
2666
+ address = self.safe_string(response, 'address')
2667
+ if address is None:
2668
+ address = self.safe_string(response, networkEntry['id'])
2654
2669
  tag: Str = None
2655
2670
  self.check_address(address)
2656
- if currency is not None:
2657
- depositAddress = self.safe_string(currency['info'], 'depositAddress')
2671
+ if networkEntry is not None:
2672
+ depositAddress = self.safe_string(networkEntry['info'], 'depositAddress')
2658
2673
  if depositAddress is not None:
2659
2674
  tag = address
2660
2675
  address = depositAddress
2661
2676
  return {
2662
2677
  'info': response,
2663
- 'currency': code,
2664
- 'network': network,
2678
+ 'currency': currency['code'],
2679
+ 'network': self.safe_string(networkEntry, 'network'),
2665
2680
  'address': address,
2666
2681
  'tag': tag,
2667
2682
  }
@@ -2731,21 +2746,12 @@ class poloniex(Exchange, ImplicitAPI):
2731
2746
  """
2732
2747
  tag, params = self.handle_withdraw_tag_and_params(tag, params)
2733
2748
  self.check_address(address)
2734
- await self.load_markets()
2735
- currency = self.currency(code)
2736
- request: dict = {
2737
- 'currency': currency['id'],
2738
- 'amount': amount,
2739
- 'address': address,
2740
- }
2749
+ request, extraParams, currency, networkEntry = self.prepare_request_for_deposit_address(code, params)
2750
+ params = extraParams
2751
+ request['amount'] = self.currency_to_precision(code, amount)
2752
+ request['address'] = address
2741
2753
  if tag is not None:
2742
2754
  request['paymentId'] = tag
2743
- networks = self.safe_value(self.options, 'networks', {})
2744
- network = self.safe_string_upper(params, 'network') # self line allows the user to specify either ERC20 or ETH
2745
- network = self.safe_string(networks, network, network) # handle ERC20>ETH alias
2746
- if network is not None:
2747
- request['currency'] = request['currency'] + network # when network the currency need to be changed to currency+network https://docs.poloniex.com/#withdraw on MultiChain Currencies section
2748
- params = self.omit(params, 'network')
2749
2755
  response = await self.privatePostWalletsWithdraw(self.extend(request, params))
2750
2756
  #
2751
2757
  # {
@@ -2754,7 +2760,11 @@ class poloniex(Exchange, ImplicitAPI):
2754
2760
  # "withdrawalNumber": 13449869
2755
2761
  # }
2756
2762
  #
2757
- return self.parse_transaction(response, currency)
2763
+ withdrawResponse = {
2764
+ 'response': response,
2765
+ 'withdrawNetworkEntry': networkEntry,
2766
+ }
2767
+ return self.parse_transaction(withdrawResponse, currency)
2758
2768
 
2759
2769
  async def fetch_transactions_helper(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
2760
2770
  await self.load_markets()
@@ -3072,6 +3082,9 @@ class poloniex(Exchange, ImplicitAPI):
3072
3082
  # "withdrawalRequestsId": 33485231
3073
3083
  # }
3074
3084
  #
3085
+ # if it's being parsed from "withdraw()" method, get the original response
3086
+ if 'withdrawNetworkEntry' in transaction:
3087
+ transaction = transaction['response']
3075
3088
  timestamp = self.safe_timestamp(transaction, 'timestamp')
3076
3089
  currencyId = self.safe_string(transaction, 'currency')
3077
3090
  code = self.safe_currency_code(currencyId)
@@ -483,32 +483,23 @@ class probit(Exchange, ImplicitAPI):
483
483
  # ]
484
484
  # }
485
485
  #
486
- currencies = self.safe_value(response, 'data', [])
486
+ currencies = self.safe_list(response, 'data', [])
487
487
  result: dict = {}
488
488
  for i in range(0, len(currencies)):
489
489
  currency = currencies[i]
490
490
  id = self.safe_string(currency, 'id')
491
491
  code = self.safe_currency_code(id)
492
- displayName = self.safe_value(currency, 'display_name')
492
+ displayName = self.safe_dict(currency, 'display_name')
493
493
  name = self.safe_string(displayName, 'en-us')
494
- platforms = self.safe_value(currency, 'platform', [])
494
+ platforms = self.safe_list(currency, 'platform', [])
495
495
  platformsByPriority = self.sort_by(platforms, 'priority')
496
- platform = None
497
496
  networkList: dict = {}
498
497
  for j in range(0, len(platformsByPriority)):
499
498
  network = platformsByPriority[j]
500
499
  idInner = self.safe_string(network, 'id')
501
500
  networkCode = self.network_id_to_code(idInner)
502
- currentDepositSuspended = self.safe_value(network, 'deposit_suspended')
503
- currentWithdrawalSuspended = self.safe_value(network, 'withdrawal_suspended')
504
- currentDeposit = not currentDepositSuspended
505
- currentWithdraw = not currentWithdrawalSuspended
506
- currentActive = currentDeposit and currentWithdraw
507
- if currentActive:
508
- platform = network
509
- precision = self.parse_precision(self.safe_string(network, 'precision'))
510
- withdrawFee = self.safe_value(network, 'withdrawal_fee', [])
511
- networkFee = self.safe_value(withdrawFee, 0, {})
501
+ withdrawFee = self.safe_list(network, 'withdrawal_fee', [])
502
+ networkFee = self.safe_dict(withdrawFee, 0, {})
512
503
  for k in range(0, len(withdrawFee)):
513
504
  withdrawPlatform = withdrawFee[k]
514
505
  feeCurrencyId = self.safe_string(withdrawPlatform, 'currency_id')
@@ -518,11 +509,11 @@ class probit(Exchange, ImplicitAPI):
518
509
  networkList[networkCode] = {
519
510
  'id': idInner,
520
511
  'network': networkCode,
521
- 'active': currentActive,
522
- 'deposit': currentDeposit,
523
- 'withdraw': currentWithdraw,
512
+ 'active': None,
513
+ 'deposit': not self.safe_bool(network, 'deposit_suspended'),
514
+ 'withdraw': not self.safe_bool(network, 'withdrawal_suspended'),
524
515
  'fee': self.safe_number(networkFee, 'amount'),
525
- 'precision': self.parse_number(precision),
516
+ 'precision': self.parse_number(self.parse_precision(self.safe_string(network, 'precision'))),
526
517
  'limits': {
527
518
  'withdraw': {
528
519
  'min': self.safe_number(network, 'min_withdrawal_amount'),
@@ -535,53 +526,33 @@ class probit(Exchange, ImplicitAPI):
535
526
  },
536
527
  'info': network,
537
528
  }
538
- if platform is None:
539
- platform = self.safe_value(platformsByPriority, 0, {})
540
- depositSuspended = self.safe_value(platform, 'deposit_suspended')
541
- withdrawalSuspended = self.safe_value(platform, 'withdrawal_suspended')
542
- deposit = not depositSuspended
543
- withdraw = not withdrawalSuspended
544
- active = deposit and withdraw
545
- withdrawalFees = self.safe_value(platform, 'withdrawal_fee', {})
546
- fees = []
547
- # sometimes the withdrawal fee is an empty object
548
- # [{'amount': '0.015', 'priority': 1, 'currency_id': 'ETH'}, {}]
549
- for j in range(0, len(withdrawalFees)):
550
- withdrawalFeeInner = withdrawalFees[j]
551
- amount = self.safe_number(withdrawalFeeInner, 'amount')
552
- priority = self.safe_integer(withdrawalFeeInner, 'priority')
553
- if (amount is not None) and (priority is not None):
554
- fees.append(withdrawalFeeInner)
555
- withdrawalFeesByPriority = self.sort_by(fees, 'priority')
556
- withdrawalFee = self.safe_value(withdrawalFeesByPriority, 0, {})
557
- fee = self.safe_number(withdrawalFee, 'amount')
558
- result[code] = {
529
+ result[code] = self.safe_currency_structure({
559
530
  'id': id,
560
531
  'code': code,
561
532
  'info': currency,
562
533
  'name': name,
563
- 'active': active,
564
- 'deposit': deposit,
565
- 'withdraw': withdraw,
534
+ 'active': None,
535
+ 'deposit': None,
536
+ 'withdraw': None,
566
537
  'type': 'crypto',
567
- 'fee': fee,
568
- 'precision': self.parse_number(self.parse_precision(self.safe_string(platform, 'precision'))),
538
+ 'fee': None,
539
+ 'precision': None,
569
540
  'limits': {
570
541
  'amount': {
571
542
  'min': None,
572
543
  'max': None,
573
544
  },
574
545
  'deposit': {
575
- 'min': self.safe_number(platform, 'min_deposit_amount'),
546
+ 'min': None,
576
547
  'max': None,
577
548
  },
578
549
  'withdraw': {
579
- 'min': self.safe_number(platform, 'min_withdrawal_amount'),
550
+ 'min': None,
580
551
  'max': None,
581
552
  },
582
553
  },
583
554
  'networks': networkList,
584
- }
555
+ })
585
556
  return result
586
557
 
587
558
  def parse_balance(self, response) -> Balances:
@@ -1393,11 +1393,6 @@ class timex(Exchange, ImplicitAPI):
1393
1393
  #
1394
1394
  id = self.safe_string(currency, 'symbol')
1395
1395
  code = self.safe_currency_code(id)
1396
- name = self.safe_string(currency, 'name')
1397
- depositEnabled = self.safe_value(currency, 'depositEnabled')
1398
- withdrawEnabled = self.safe_value(currency, 'withdrawalEnabled')
1399
- isActive = self.safe_value(currency, 'active')
1400
- active = depositEnabled and withdrawEnabled and isActive
1401
1396
  # fee = self.safe_number(currency, 'withdrawalFee')
1402
1397
  feeString = self.safe_string(currency, 'withdrawalFee')
1403
1398
  tradeDecimals = self.safe_integer(currency, 'tradeDecimals')
@@ -1419,14 +1414,14 @@ class timex(Exchange, ImplicitAPI):
1419
1414
  'code': code,
1420
1415
  'info': currency,
1421
1416
  'type': None,
1422
- 'name': name,
1423
- 'active': active,
1424
- 'deposit': depositEnabled,
1425
- 'withdraw': withdrawEnabled,
1417
+ 'name': self.safe_string(currency, 'name'),
1418
+ 'active': self.safe_bool(currency, 'active'),
1419
+ 'deposit': self.safe_bool(currency, 'depositEnabled'),
1420
+ 'withdraw': self.safe_bool(currency, 'withdrawalEnabled'),
1426
1421
  'fee': fee,
1427
1422
  'precision': self.parse_number(self.parse_precision(self.safe_string(currency, 'decimals'))),
1428
1423
  'limits': {
1429
- 'withdraw': {'min': fee, 'max': None},
1424
+ 'withdraw': {'min': None, 'max': None},
1430
1425
  'amount': {'min': None, 'max': None},
1431
1426
  },
1432
1427
  'networks': {},
@@ -457,11 +457,10 @@ class vertex(Exchange, ImplicitAPI):
457
457
  tickerId = self.safe_string(data, 'ticker_id')
458
458
  if (tickerId is not None) and (tickerId.find('PERP') > 0):
459
459
  continue
460
- id = self.safe_string(data, 'product_id')
461
460
  name = self.safe_string(data, 'symbol')
462
461
  code = self.safe_currency_code(name)
463
- result[code] = {
464
- 'id': id,
462
+ result[code] = self.safe_currency_structure({
463
+ 'id': self.safe_string(data, 'product_id'),
465
464
  'name': name,
466
465
  'code': code,
467
466
  'precision': None,
@@ -481,7 +480,7 @@ class vertex(Exchange, ImplicitAPI):
481
480
  'max': None,
482
481
  },
483
482
  },
484
- }
483
+ })
485
484
  return result
486
485
 
487
486
  def parse_market(self, market) -> Market: