ccxt 4.4.78__py2.py3-none-any.whl → 4.4.82__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 (87) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/bitmart.py +1 -0
  3. ccxt/apex.py +21 -31
  4. ccxt/ascendex.py +23 -6
  5. ccxt/async_support/__init__.py +1 -1
  6. ccxt/async_support/apex.py +21 -31
  7. ccxt/async_support/ascendex.py +23 -6
  8. ccxt/async_support/base/exchange.py +5 -1
  9. ccxt/async_support/bigone.py +17 -14
  10. ccxt/async_support/binance.py +6 -0
  11. ccxt/async_support/bingx.py +16 -35
  12. ccxt/async_support/bitfinex.py +120 -82
  13. ccxt/async_support/bitget.py +58 -66
  14. ccxt/async_support/bitmart.py +7 -2
  15. ccxt/async_support/bitmex.py +8 -1
  16. ccxt/async_support/bitopro.py +5 -1
  17. ccxt/async_support/bitrue.py +2 -1
  18. ccxt/async_support/bitso.py +1 -1
  19. ccxt/async_support/bitteam.py +2 -0
  20. ccxt/async_support/bitvavo.py +25 -10
  21. ccxt/async_support/btcalpha.py +1 -1
  22. ccxt/async_support/btcmarkets.py +1 -1
  23. ccxt/async_support/btcturk.py +1 -1
  24. ccxt/async_support/bybit.py +29 -15
  25. ccxt/async_support/coinbase.py +3 -15
  26. ccxt/async_support/coinex.py +1 -0
  27. ccxt/async_support/coinlist.py +1 -0
  28. ccxt/async_support/coinone.py +1 -0
  29. ccxt/async_support/delta.py +3 -0
  30. ccxt/async_support/deribit.py +1 -0
  31. ccxt/async_support/hollaex.py +1 -0
  32. ccxt/async_support/htx.py +9 -5
  33. ccxt/async_support/huobijp.py +1 -0
  34. ccxt/async_support/hyperliquid.py +14 -0
  35. ccxt/async_support/kraken.py +2 -0
  36. ccxt/async_support/okx.py +2 -3
  37. ccxt/async_support/oxfun.py +21 -1
  38. ccxt/async_support/poloniex.py +1 -0
  39. ccxt/async_support/timex.py +2 -2
  40. ccxt/async_support/upbit.py +43 -21
  41. ccxt/async_support/whitebit.py +65 -12
  42. ccxt/base/exchange.py +20 -2
  43. ccxt/bigone.py +17 -14
  44. ccxt/binance.py +6 -0
  45. ccxt/bingx.py +16 -35
  46. ccxt/bitfinex.py +120 -82
  47. ccxt/bitget.py +58 -66
  48. ccxt/bitmart.py +7 -2
  49. ccxt/bitmex.py +8 -1
  50. ccxt/bitopro.py +5 -1
  51. ccxt/bitrue.py +2 -1
  52. ccxt/bitso.py +1 -1
  53. ccxt/bitteam.py +2 -0
  54. ccxt/bitvavo.py +25 -10
  55. ccxt/btcalpha.py +1 -1
  56. ccxt/btcmarkets.py +1 -1
  57. ccxt/btcturk.py +1 -1
  58. ccxt/bybit.py +29 -15
  59. ccxt/coinbase.py +3 -15
  60. ccxt/coinex.py +1 -0
  61. ccxt/coinlist.py +1 -0
  62. ccxt/coinone.py +1 -0
  63. ccxt/delta.py +3 -0
  64. ccxt/deribit.py +1 -0
  65. ccxt/hollaex.py +1 -0
  66. ccxt/htx.py +9 -5
  67. ccxt/huobijp.py +1 -0
  68. ccxt/hyperliquid.py +14 -0
  69. ccxt/kraken.py +2 -0
  70. ccxt/okx.py +2 -3
  71. ccxt/oxfun.py +21 -1
  72. ccxt/poloniex.py +1 -0
  73. ccxt/pro/__init__.py +1 -1
  74. ccxt/pro/binance.py +3 -3
  75. ccxt/pro/coinbase.py +41 -53
  76. ccxt/pro/hyperliquid.py +10 -2
  77. ccxt/pro/upbit.py +42 -0
  78. ccxt/test/tests_async.py +0 -1
  79. ccxt/test/tests_sync.py +0 -1
  80. ccxt/timex.py +2 -2
  81. ccxt/upbit.py +43 -21
  82. ccxt/whitebit.py +65 -12
  83. {ccxt-4.4.78.dist-info → ccxt-4.4.82.dist-info}/METADATA +9 -13
  84. {ccxt-4.4.78.dist-info → ccxt-4.4.82.dist-info}/RECORD +87 -87
  85. {ccxt-4.4.78.dist-info → ccxt-4.4.82.dist-info}/LICENSE.txt +0 -0
  86. {ccxt-4.4.78.dist-info → ccxt-4.4.82.dist-info}/WHEEL +0 -0
  87. {ccxt-4.4.78.dist-info → ccxt-4.4.82.dist-info}/top_level.txt +0 -0
ccxt/bitfinex.py CHANGED
@@ -751,6 +751,7 @@ class bitfinex(Exchange, ImplicitAPI):
751
751
  'pub:map:currency:explorer', # maps symbols to their recognised block explorer URLs
752
752
  'pub:map:currency:tx:fee', # maps currencies to their withdrawal fees https://github.com/ccxt/ccxt/issues/7745,
753
753
  'pub:map:tx:method', # maps withdrawal/deposit methods to their API symbols
754
+ 'pub:info:tx:status', # maps withdrawal/deposit statuses, coins: 1 = enabled, 0 = maintenance
754
755
  ]
755
756
  config = ','.join(labels)
756
757
  request: dict = {
@@ -833,40 +834,81 @@ class bitfinex(Exchange, ImplicitAPI):
833
834
  # ["ABS",[0,131.3]],
834
835
  # ["ADA",[0,0.3]],
835
836
  # ],
837
+ # # deposit/withdrawal data
838
+ # [
839
+ # ["BITCOIN", 1, 1, null, null, null, null, 0, 0, null, null, 3],
840
+ # ...
841
+ # ]
836
842
  # ]
837
843
  #
838
844
  indexed: dict = {
839
- 'sym': self.index_by(self.safe_value(response, 1, []), 0),
840
- 'label': self.index_by(self.safe_value(response, 2, []), 0),
841
- 'unit': self.index_by(self.safe_value(response, 3, []), 0),
842
- 'undl': self.index_by(self.safe_value(response, 4, []), 0),
843
- 'pool': self.index_by(self.safe_value(response, 5, []), 0),
844
- 'explorer': self.index_by(self.safe_value(response, 6, []), 0),
845
- 'fees': self.index_by(self.safe_value(response, 7, []), 0),
845
+ 'sym': self.index_by(self.safe_list(response, 1, []), 0),
846
+ 'label': self.index_by(self.safe_list(response, 2, []), 0),
847
+ 'unit': self.index_by(self.safe_list(response, 3, []), 0),
848
+ 'undl': self.index_by(self.safe_list(response, 4, []), 0),
849
+ 'pool': self.index_by(self.safe_list(response, 5, []), 0),
850
+ 'explorer': self.index_by(self.safe_list(response, 6, []), 0),
851
+ 'fees': self.index_by(self.safe_list(response, 7, []), 0),
852
+ 'networks': self.safe_list(response, 8, []),
853
+ 'statuses': self.index_by(self.safe_list(response, 9, []), 0),
846
854
  }
847
- ids = self.safe_value(response, 0, [])
855
+ indexedNetworks: dict = {}
856
+ for i in range(0, len(indexed['networks'])):
857
+ networkObj = indexed['networks'][i]
858
+ networkId = self.safe_string(networkObj, 0)
859
+ valuesList = self.safe_list(networkObj, 1)
860
+ networkName = self.safe_string(valuesList, 0)
861
+ # for GOlang transpiler, do with "safe" method
862
+ networksList = self.safe_list(indexedNetworks, networkName, [])
863
+ networksList.append(networkId)
864
+ indexedNetworks[networkName] = networksList
865
+ ids = self.safe_list(response, 0, [])
848
866
  result: dict = {}
849
867
  for i in range(0, len(ids)):
850
868
  id = ids[i]
851
- if id.find('F0') >= 0:
869
+ if id.endswith('F0'):
852
870
  # we get a lot of F0 currencies, skip those
853
871
  continue
854
872
  code = self.safe_currency_code(id)
855
- label = self.safe_value(indexed['label'], id, [])
873
+ label = self.safe_list(indexed['label'], id, [])
856
874
  name = self.safe_string(label, 1)
857
- pool = self.safe_value(indexed['pool'], id, [])
875
+ pool = self.safe_list(indexed['pool'], id, [])
858
876
  rawType = self.safe_string(pool, 1)
859
877
  isCryptoCoin = (rawType is not None) or (id in indexed['explorer']) # "hacky" solution
860
878
  type = None
861
879
  if isCryptoCoin:
862
880
  type = 'crypto'
863
- feeValues = self.safe_value(indexed['fees'], id, [])
864
- fees = self.safe_value(feeValues, 1, [])
881
+ feeValues = self.safe_list(indexed['fees'], id, [])
882
+ fees = self.safe_list(feeValues, 1, [])
865
883
  fee = self.safe_number(fees, 1)
866
- undl = self.safe_value(indexed['undl'], id, [])
884
+ undl = self.safe_list(indexed['undl'], id, [])
867
885
  precision = '8' # default precision, todo: fix "magic constants"
868
886
  fid = 'f' + id
869
- result[code] = {
887
+ dwStatuses = self.safe_list(indexed['statuses'], id, [])
888
+ depositEnabled = self.safe_integer(dwStatuses, 1) == 1
889
+ withdrawEnabled = self.safe_integer(dwStatuses, 2) == 1
890
+ networks: dict = {}
891
+ netwokIds = self.safe_list(indexedNetworks, id, [])
892
+ for j in range(0, len(netwokIds)):
893
+ networkId = netwokIds[j]
894
+ network = self.network_id_to_code(networkId)
895
+ networks[network] = {
896
+ 'info': networkId,
897
+ 'id': networkId.lower(),
898
+ 'network': networkId,
899
+ 'active': None,
900
+ 'deposit': None,
901
+ 'withdraw': None,
902
+ 'fee': None,
903
+ 'precision': None,
904
+ 'limits': {
905
+ 'withdraw': {
906
+ 'min': None,
907
+ 'max': None,
908
+ },
909
+ },
910
+ }
911
+ result[code] = self.safe_currency_structure({
870
912
  'id': fid,
871
913
  'uppercaseId': id,
872
914
  'code': code,
@@ -874,8 +916,8 @@ class bitfinex(Exchange, ImplicitAPI):
874
916
  'type': type,
875
917
  'name': name,
876
918
  'active': True,
877
- 'deposit': None,
878
- 'withdraw': None,
919
+ 'deposit': depositEnabled,
920
+ 'withdraw': withdrawEnabled,
879
921
  'fee': fee,
880
922
  'precision': int(precision),
881
923
  'limits': {
@@ -888,37 +930,8 @@ class bitfinex(Exchange, ImplicitAPI):
888
930
  'max': None,
889
931
  },
890
932
  },
891
- 'networks': {},
892
- }
893
- networks: dict = {}
894
- currencyNetworks = self.safe_value(response, 8, [])
895
- cleanId = id.replace('F0', '')
896
- for j in range(0, len(currencyNetworks)):
897
- pair = currencyNetworks[j]
898
- networkId = self.safe_string(pair, 0)
899
- currencyId = self.safe_string(self.safe_value(pair, 1, []), 0)
900
- if currencyId == cleanId:
901
- network = self.network_id_to_code(networkId)
902
- networks[network] = {
903
- 'info': networkId,
904
- 'id': networkId.lower(),
905
- 'network': networkId,
906
- 'active': None,
907
- 'deposit': None,
908
- 'withdraw': None,
909
- 'fee': None,
910
- 'precision': None,
911
- 'limits': {
912
- 'withdraw': {
913
- 'min': None,
914
- 'max': None,
915
- },
916
- },
917
- }
918
- keysNetworks = list(networks.keys())
919
- networksLength = len(keysNetworks)
920
- if networksLength > 0:
921
- result[code]['networks'] = networks
933
+ 'networks': networks,
934
+ })
922
935
  return result
923
936
 
924
937
  def fetch_balance(self, params={}) -> Balances:
@@ -1150,9 +1163,8 @@ class bitfinex(Exchange, ImplicitAPI):
1150
1163
  #
1151
1164
  # on trading pairs(ex. tBTCUSD)
1152
1165
  #
1153
- # {
1154
- # 'result': [
1155
- # SYMBOL,
1166
+ # [
1167
+ # SYMBOL, # self index is not present in singular-ticker
1156
1168
  # BID,
1157
1169
  # BID_SIZE,
1158
1170
  # ASK,
@@ -1163,15 +1175,13 @@ class bitfinex(Exchange, ImplicitAPI):
1163
1175
  # VOLUME,
1164
1176
  # HIGH,
1165
1177
  # LOW
1166
- # ]
1167
- # }
1178
+ # ]
1168
1179
  #
1169
1180
  #
1170
1181
  # on funding currencies(ex. fUSD)
1171
1182
  #
1172
- # {
1173
- # 'result': [
1174
- # SYMBOL,
1183
+ # [
1184
+ # SYMBOL, # self index is not present in singular-ticker
1175
1185
  # FRR,
1176
1186
  # BID,
1177
1187
  # BID_PERIOD,
@@ -1188,35 +1198,71 @@ class bitfinex(Exchange, ImplicitAPI):
1188
1198
  # _PLACEHOLDER,
1189
1199
  # _PLACEHOLDER,
1190
1200
  # FRR_AMOUNT_AVAILABLE
1191
- # ]
1192
- # }
1201
+ # ]
1193
1202
  #
1194
- result = self.safe_list(ticker, 'result')
1203
+ length = len(ticker)
1204
+ isFetchTicker = (length == 10) or (length == 16)
1205
+ symbol: Str = None
1206
+ minusIndex = 0
1207
+ isFundingCurrency = False
1208
+ if isFetchTicker:
1209
+ minusIndex = 1
1210
+ isFundingCurrency = (length == 16)
1211
+ else:
1212
+ marketId = self.safe_string(ticker, 0)
1213
+ market = self.safe_market(marketId, market)
1214
+ isFundingCurrency = (length == 17)
1195
1215
  symbol = self.safe_symbol(None, market)
1196
- length = len(result)
1197
- last = self.safe_string(result, length - 4)
1198
- percentage = self.safe_string(result, length - 5)
1216
+ last: Str = None
1217
+ bid: Str = None
1218
+ ask: Str = None
1219
+ change: Str = None
1220
+ percentage: Str = None
1221
+ volume: Str = None
1222
+ high: Str = None
1223
+ low: Str = None
1224
+ if isFundingCurrency:
1225
+ # per api docs, they are different array type
1226
+ last = self.safe_string(ticker, 10 - minusIndex)
1227
+ bid = self.safe_string(ticker, 2 - minusIndex)
1228
+ ask = self.safe_string(ticker, 5 - minusIndex)
1229
+ change = self.safe_string(ticker, 8 - minusIndex)
1230
+ percentage = self.safe_string(ticker, 9 - minusIndex)
1231
+ volume = self.safe_string(ticker, 11 - minusIndex)
1232
+ high = self.safe_string(ticker, 12 - minusIndex)
1233
+ low = self.safe_string(ticker, 13 - minusIndex)
1234
+ else:
1235
+ # on trading pairs(ex. tBTCUSD or tHMSTR:USD)
1236
+ last = self.safe_string(ticker, 7 - minusIndex)
1237
+ bid = self.safe_string(ticker, 1 - minusIndex)
1238
+ ask = self.safe_string(ticker, 3 - minusIndex)
1239
+ change = self.safe_string(ticker, 5 - minusIndex)
1240
+ percentage = self.safe_string(ticker, 6 - minusIndex)
1241
+ percentage = Precise.string_mul(percentage, '100')
1242
+ volume = self.safe_string(ticker, 8 - minusIndex)
1243
+ high = self.safe_string(ticker, 9 - minusIndex)
1244
+ low = self.safe_string(ticker, 10 - minusIndex)
1199
1245
  return self.safe_ticker({
1200
1246
  'symbol': symbol,
1201
1247
  'timestamp': None,
1202
1248
  'datetime': None,
1203
- 'high': self.safe_string(result, length - 2),
1204
- 'low': self.safe_string(result, length - 1),
1205
- 'bid': self.safe_string(result, length - 10),
1206
- 'bidVolume': self.safe_string(result, length - 9),
1207
- 'ask': self.safe_string(result, length - 8),
1208
- 'askVolume': self.safe_string(result, length - 7),
1249
+ 'high': high,
1250
+ 'low': low,
1251
+ 'bid': bid,
1252
+ 'bidVolume': None,
1253
+ 'ask': ask,
1254
+ 'askVolume': None,
1209
1255
  'vwap': None,
1210
1256
  'open': None,
1211
1257
  'close': last,
1212
1258
  'last': last,
1213
1259
  'previousClose': None,
1214
- 'change': self.safe_string(result, length - 6),
1215
- 'percentage': Precise.string_mul(percentage, '100'),
1260
+ 'change': change,
1261
+ 'percentage': percentage,
1216
1262
  'average': None,
1217
- 'baseVolume': self.safe_string(result, length - 3),
1263
+ 'baseVolume': volume,
1218
1264
  'quoteVolume': None,
1219
- 'info': result,
1265
+ 'info': ticker,
1220
1266
  }, market)
1221
1267
 
1222
1268
  def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
@@ -1277,14 +1323,7 @@ class bitfinex(Exchange, ImplicitAPI):
1277
1323
  # ...
1278
1324
  # ]
1279
1325
  #
1280
- result: dict = {}
1281
- for i in range(0, len(tickers)):
1282
- ticker = tickers[i]
1283
- marketId = self.safe_string(ticker, 0)
1284
- market = self.safe_market(marketId)
1285
- symbol = market['symbol']
1286
- result[symbol] = self.parse_ticker({'result': ticker}, market)
1287
- return self.filter_by_array_tickers(result, 'symbol', symbols)
1326
+ return self.parse_tickers(tickers, symbols)
1288
1327
 
1289
1328
  def fetch_ticker(self, symbol: str, params={}) -> Ticker:
1290
1329
  """
@@ -1302,8 +1341,7 @@ class bitfinex(Exchange, ImplicitAPI):
1302
1341
  'symbol': market['id'],
1303
1342
  }
1304
1343
  ticker = self.publicGetTickerSymbol(self.extend(request, params))
1305
- result: dict = {'result': ticker}
1306
- return self.parse_ticker(result, market)
1344
+ return self.parse_ticker(ticker, market)
1307
1345
 
1308
1346
  def parse_trade(self, trade: dict, market: Market = None) -> Trade:
1309
1347
  #
ccxt/bitget.py CHANGED
@@ -1566,6 +1566,8 @@ class bitget(Exchange, ImplicitAPI):
1566
1566
  'method': 'privateMixGetV2MixPositionAllPosition', # or privateMixGetV2MixPositionHistoryPosition
1567
1567
  },
1568
1568
  'defaultTimeInForce': 'GTC', # 'GTC' = Good To Cancel(default), 'IOC' = Immediate Or Cancel
1569
+ # fiat currencies on deposit page
1570
+ 'fiatCurrencies': ['EUR', 'VND', 'PLN', 'CZK', 'HUF', 'DKK', 'AUD', 'CAD', 'NOK', 'SEK', 'CHF', 'MXN', 'COP', 'ARS', 'GBP', 'BRL', 'UAH', 'ZAR'],
1569
1571
  },
1570
1572
  'features': {
1571
1573
  'spot': {
@@ -2024,99 +2026,85 @@ class bitget(Exchange, ImplicitAPI):
2024
2026
  """
2025
2027
  response = self.publicSpotGetV2SpotPublicCoins(params)
2026
2028
  #
2027
- # {
2028
- # "code": "00000",
2029
- # "data": [
2030
- # {
2031
- # "chains": [
2032
- # {
2033
- # "browserUrl": "https://blockchair.com/bitcoin/transaction/",
2034
- # "chain": "BTC",
2035
- # "depositConfirm": "1",
2036
- # "extraWithdrawFee": "0",
2037
- # "minDepositAmount": "0.0001",
2038
- # "minWithdrawAmount": "0.005",
2039
- # "needTag": "false",
2040
- # "rechargeable": "true",
2041
- # "withdrawConfirm": "1",
2042
- # "withdrawFee": "0.0004",
2043
- # "withdrawable": "true"
2044
- # },
2045
- # ],
2046
- # "coin": "BTC",
2047
- # "coinId": "1",
2048
- # "transfer": "true""
2049
- # }
2050
- # ],
2051
- # "msg": "success",
2052
- # "requestTime": "1700120731773"
2053
- # }
2029
+ # {
2030
+ # "code": "00000",
2031
+ # "msg": "success",
2032
+ # "requestTime": "1746195617812",
2033
+ # "data": [
2034
+ # {
2035
+ # "coinId": "1456",
2036
+ # "coin": "NEIROETH",
2037
+ # "transfer": "false",
2038
+ # "chains": [
2039
+ # {
2040
+ # "chain": "ERC20",
2041
+ # "needTag": "false",
2042
+ # "withdrawable": "true",
2043
+ # "rechargeable": "true",
2044
+ # "withdrawFee": "44.91017965",
2045
+ # "extraWithdrawFee": "0",
2046
+ # "depositConfirm": "12",
2047
+ # "withdrawConfirm": "64",
2048
+ # "minDepositAmount": "0.06",
2049
+ # "minWithdrawAmount": "60",
2050
+ # "browserUrl": "https://etherscan.io/tx/",
2051
+ # "contractAddress": "0xee2a03aa6dacf51c18679c516ad5283d8e7c2637",
2052
+ # "withdrawStep": "0",
2053
+ # "withdrawMinScale": "8",
2054
+ # "congestion": "normal"
2055
+ # }
2056
+ # ],
2057
+ # "areaCoin": "no"
2058
+ # },
2059
+ # ...
2054
2060
  #
2055
2061
  result: dict = {}
2056
2062
  data = self.safe_value(response, 'data', [])
2063
+ fiatCurrencies = self.safe_list(self.options, 'fiatCurrencies', [])
2057
2064
  for i in range(0, len(data)):
2058
2065
  entry = data[i]
2059
2066
  id = self.safe_string(entry, 'coin') # we don't use 'coinId' has no use. it is 'coin' field that needs to be used in currency related endpoints(deposit, withdraw, etc..)
2060
2067
  code = self.safe_currency_code(id)
2061
2068
  chains = self.safe_value(entry, 'chains', [])
2062
2069
  networks: dict = {}
2063
- deposit = False
2064
- withdraw = False
2065
- minWithdrawString = None
2066
- minDepositString = None
2067
- minWithdrawFeeString = None
2068
2070
  for j in range(0, len(chains)):
2069
2071
  chain = chains[j]
2070
2072
  networkId = self.safe_string(chain, 'chain')
2071
2073
  network = self.network_id_to_code(networkId, code)
2072
2074
  if network is not None:
2073
2075
  network = network.upper()
2074
- withdrawEnabled = self.safe_string(chain, 'withdrawable')
2075
- canWithdraw = withdrawEnabled == 'true'
2076
- withdraw = canWithdraw if (canWithdraw) else withdraw
2077
- depositEnabled = self.safe_string(chain, 'rechargeable')
2078
- canDeposit = depositEnabled == 'true'
2079
- deposit = canDeposit if (canDeposit) else deposit
2080
- networkWithdrawFeeString = self.safe_string(chain, 'withdrawFee')
2081
- if networkWithdrawFeeString is not None:
2082
- minWithdrawFeeString = networkWithdrawFeeString if (minWithdrawFeeString is None) else Precise.string_min(networkWithdrawFeeString, minWithdrawFeeString)
2083
- networkMinWithdrawString = self.safe_string(chain, 'minWithdrawAmount')
2084
- if networkMinWithdrawString is not None:
2085
- minWithdrawString = networkMinWithdrawString if (minWithdrawString is None) else Precise.string_min(networkMinWithdrawString, minWithdrawString)
2086
- networkMinDepositString = self.safe_string(chain, 'minDepositAmount')
2087
- if networkMinDepositString is not None:
2088
- minDepositString = networkMinDepositString if (minDepositString is None) else Precise.string_min(networkMinDepositString, minDepositString)
2089
2076
  networks[network] = {
2090
2077
  'info': chain,
2091
2078
  'id': networkId,
2092
2079
  'network': network,
2093
2080
  'limits': {
2094
2081
  'withdraw': {
2095
- 'min': self.parse_number(networkMinWithdrawString),
2082
+ 'min': self.safe_number(chain, 'minWithdrawAmount'),
2096
2083
  'max': None,
2097
2084
  },
2098
2085
  'deposit': {
2099
- 'min': self.parse_number(networkMinDepositString),
2086
+ 'min': self.safe_number(chain, 'minDepositAmount'),
2100
2087
  'max': None,
2101
2088
  },
2102
2089
  },
2103
- 'active': canWithdraw and canDeposit,
2104
- 'withdraw': canWithdraw,
2105
- 'deposit': canDeposit,
2106
- 'fee': self.parse_number(networkWithdrawFeeString),
2107
- 'precision': None,
2090
+ 'active': None,
2091
+ 'withdraw': self.safe_string(chain, 'withdrawable') == 'true',
2092
+ 'deposit': self.safe_string(chain, 'rechargeable') == 'true',
2093
+ 'fee': self.safe_number(chain, 'withdrawFee'),
2094
+ 'precision': self.parse_number(self.parse_precision(self.safe_string(chain, 'withdrawMinScale'))),
2108
2095
  }
2109
- result[code] = {
2096
+ isFiat = self.in_array(code, fiatCurrencies)
2097
+ result[code] = self.safe_currency_structure({
2110
2098
  'info': entry,
2111
2099
  'id': id,
2112
2100
  'code': code,
2113
2101
  'networks': networks,
2114
- 'type': None,
2102
+ 'type': 'fiat' if isFiat else 'crypto',
2115
2103
  'name': None,
2116
- 'active': deposit and withdraw,
2117
- 'deposit': deposit,
2118
- 'withdraw': withdraw,
2119
- 'fee': self.parse_number(minWithdrawFeeString),
2104
+ 'active': None,
2105
+ 'deposit': None,
2106
+ 'withdraw': None,
2107
+ 'fee': None,
2120
2108
  'precision': None,
2121
2109
  'limits': {
2122
2110
  'amount': {
@@ -2124,16 +2112,16 @@ class bitget(Exchange, ImplicitAPI):
2124
2112
  'max': None,
2125
2113
  },
2126
2114
  'withdraw': {
2127
- 'min': self.parse_number(minWithdrawString),
2115
+ 'min': None,
2128
2116
  'max': None,
2129
2117
  },
2130
2118
  'deposit': {
2131
- 'min': self.parse_number(minDepositString),
2119
+ 'min': None,
2132
2120
  'max': None,
2133
2121
  },
2134
2122
  },
2135
2123
  'created': None,
2136
- }
2124
+ })
2137
2125
  return result
2138
2126
 
2139
2127
  def fetch_market_leverage_tiers(self, symbol: str, params={}) -> List[LeverageTier]:
@@ -2752,7 +2740,7 @@ class bitget(Exchange, ImplicitAPI):
2752
2740
  close = self.safe_string(ticker, 'lastPr')
2753
2741
  timestamp = self.safe_integer_omit_zero(ticker, 'ts') # exchange bitget provided 0
2754
2742
  change = self.safe_string(ticker, 'change24h')
2755
- open24 = self.safe_string(ticker, 'open24')
2743
+ open24 = self.safe_string_2(ticker, 'open24', 'open24h')
2756
2744
  open = self.safe_string(ticker, 'open')
2757
2745
  symbol: str
2758
2746
  openValue: str
@@ -3419,6 +3407,7 @@ class bitget(Exchange, ImplicitAPI):
3419
3407
  :param dict [params]: extra parameters specific to the exchange API endpoint
3420
3408
  :param int [params.until]: timestamp in ms of the latest candle to fetch
3421
3409
  :param boolean [params.useHistoryEndpoint]: whether to force to use historical endpoint(it has max limit of 200)
3410
+ :param boolean [params.useHistoryEndpointForPagination]: whether to force to use historical endpoint for pagination(default True)
3422
3411
  :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)
3423
3412
  :param str [params.price]: *swap only* "mark"(to fetch mark price candles) or "index"(to fetch index price candles)
3424
3413
  :returns int[][]: A list of candles ordered, open, high, low, close, volume
@@ -3427,11 +3416,13 @@ class bitget(Exchange, ImplicitAPI):
3427
3416
  defaultLimit = 100 # default 100, max 1000
3428
3417
  maxLimitForRecentEndpoint = 1000
3429
3418
  maxLimitForHistoryEndpoint = 200 # note, max 1000 bars are supported for "recent-candles" endpoint, but "historical-candles" support only max 200
3419
+ useHistoryEndpoint = self.safe_bool(params, 'useHistoryEndpoint', False)
3420
+ useHistoryEndpointForPagination = self.safe_bool(params, 'useHistoryEndpointForPagination', True)
3430
3421
  paginate = False
3431
3422
  paginate, params = self.handle_option_and_params(params, 'fetchOHLCV', 'paginate')
3432
3423
  if paginate:
3433
- return self.fetch_paginated_call_deterministic('fetchOHLCV', symbol, since, limit, timeframe, params, maxLimitForRecentEndpoint)
3434
- useHistoryEndpoint = self.safe_bool(params, 'useHistoryEndpoint', False)
3424
+ limitForPagination = maxLimitForHistoryEndpoint if useHistoryEndpointForPagination else maxLimitForRecentEndpoint
3425
+ return self.fetch_paginated_call_deterministic('fetchOHLCV', symbol, since, limit, timeframe, params, limitForPagination)
3435
3426
  market = self.market(symbol)
3436
3427
  marketType = 'spot' if market['spot'] else 'swap'
3437
3428
  timeframes = self.options['timeframes'][marketType]
@@ -4050,6 +4041,7 @@ class bitget(Exchange, ImplicitAPI):
4050
4041
  timestamp = self.safe_integer_2(order, 'cTime', 'ctime')
4051
4042
  updateTimestamp = self.safe_integer(order, 'uTime')
4052
4043
  rawStatus = self.safe_string_2(order, 'status', 'state')
4044
+ rawStatus = self.safe_string(order, 'planStatus', rawStatus)
4053
4045
  fee = None
4054
4046
  feeCostString = self.safe_string(order, 'fee')
4055
4047
  if feeCostString is not None:
ccxt/bitmart.py CHANGED
@@ -225,6 +225,7 @@ class bitmart(Exchange, ImplicitAPI):
225
225
  'contract/private/order': 1.2,
226
226
  'contract/private/order-history': 10,
227
227
  'contract/private/position': 10,
228
+ 'contract/private/position-v2': 10,
228
229
  'contract/private/get-open-orders': 1.2,
229
230
  'contract/private/current-plan-order': 1.2,
230
231
  'contract/private/trades': 10,
@@ -1214,6 +1215,7 @@ class bitmart(Exchange, ImplicitAPI):
1214
1215
  # {
1215
1216
  # "currency": "BTC",
1216
1217
  # "name": "Bitcoin",
1218
+ # "recharge_minsize": '0.00000001',
1217
1219
  # "contract_address": null,
1218
1220
  # "network": "BTC",
1219
1221
  # "withdraw_enabled": True,
@@ -1235,7 +1237,8 @@ class bitmart(Exchange, ImplicitAPI):
1235
1237
  fullId = self.safe_string(currency, 'currency')
1236
1238
  currencyId = fullId
1237
1239
  networkId = self.safe_string(currency, 'network')
1238
- if fullId.find('NFT') < 0:
1240
+ isNtf = (fullId.find('NFT') >= 0)
1241
+ if not isNtf:
1239
1242
  parts = fullId.split('-')
1240
1243
  currencyId = self.safe_string(parts, 0)
1241
1244
  second = self.safe_string(parts, 1)
@@ -1254,6 +1257,7 @@ class bitmart(Exchange, ImplicitAPI):
1254
1257
  'withdraw': None,
1255
1258
  'active': None,
1256
1259
  'networks': {},
1260
+ 'type': 'other' if isNtf else 'crypto',
1257
1261
  }
1258
1262
  networkCode = self.network_id_to_code(networkId)
1259
1263
  withdraw = self.safe_bool(currency, 'withdraw_enabled')
@@ -4659,6 +4663,7 @@ class bitmart(Exchange, ImplicitAPI):
4659
4663
  fetch all open contract positions
4660
4664
 
4661
4665
  https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-keyed
4666
+ https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-v2-keyed
4662
4667
 
4663
4668
  :param str[]|None symbols: list of unified market symbols
4664
4669
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -4675,7 +4680,7 @@ class bitmart(Exchange, ImplicitAPI):
4675
4680
  if symbolsLength == 1:
4676
4681
  # only supports symbols or sending one symbol
4677
4682
  request['symbol'] = market['id']
4678
- response = self.privateGetContractPrivatePosition(self.extend(request, params))
4683
+ response = self.privateGetContractPrivatePositionV2(self.extend(request, params))
4679
4684
  #
4680
4685
  # {
4681
4686
  # "code": 1000,
ccxt/bitmex.py CHANGED
@@ -503,6 +503,7 @@ class bitmex(Exchange, ImplicitAPI):
503
503
  maxWithdrawal = self.parse_number(Precise.string_mul(maxWithdrawalString, precisionString))
504
504
  minDepositString = self.safe_string(currency, 'minDepositAmount')
505
505
  minDeposit = self.parse_number(Precise.string_mul(minDepositString, precisionString))
506
+ isCrypto = self.safe_string(currency, 'currencyType') == 'Crypto'
506
507
  result[code] = {
507
508
  'id': id,
508
509
  'code': code,
@@ -528,6 +529,7 @@ class bitmex(Exchange, ImplicitAPI):
528
529
  },
529
530
  },
530
531
  'networks': networks,
532
+ 'type': 'crypto' if isCrypto else 'other',
531
533
  }
532
534
  return result
533
535
 
@@ -756,6 +758,11 @@ class bitmex(Exchange, ImplicitAPI):
756
758
  maxOrderQty = self.safe_number(market, 'maxOrderQty')
757
759
  initMargin = self.safe_string(market, 'initMargin', '1')
758
760
  maxLeverage = self.parse_number(Precise.string_div('1', initMargin))
761
+ # subtype should be None for spot markets
762
+ if spot:
763
+ isInverse = None
764
+ isQuanto = None
765
+ linear = None
759
766
  return {
760
767
  'id': id,
761
768
  'symbol': symbol,
@@ -805,7 +812,7 @@ class bitmex(Exchange, ImplicitAPI):
805
812
  'max': maxOrderQty if positionIsQuote else None,
806
813
  },
807
814
  },
808
- 'created': self.parse8601(self.safe_string(market, 'listing')),
815
+ 'created': None, # 'listing' field is buggy, e.g. 2200-02-01T00:00:00.000Z
809
816
  'info': market,
810
817
  }
811
818
 
ccxt/bitopro.py CHANGED
@@ -245,6 +245,7 @@ class bitopro(Exchange, ImplicitAPI):
245
245
  'BEP20': 'BSC',
246
246
  'BSC': 'BSC',
247
247
  },
248
+ 'fiatCurrencies': ['TWD'], # the only fiat currency for exchange
248
249
  },
249
250
  'features': {
250
251
  'spot': {
@@ -373,6 +374,7 @@ class bitopro(Exchange, ImplicitAPI):
373
374
  # }
374
375
  #
375
376
  result: dict = {}
377
+ fiatCurrencies = self.safe_list(self.options, 'fiatCurrencies', [])
376
378
  for i in range(0, len(currencies)):
377
379
  currency = currencies[i]
378
380
  currencyId = self.safe_string(currency, 'currency')
@@ -392,11 +394,12 @@ class bitopro(Exchange, ImplicitAPI):
392
394
  'max': None,
393
395
  },
394
396
  }
397
+ isFiat = self.in_array(code, fiatCurrencies)
395
398
  result[code] = {
396
399
  'id': currencyId,
397
400
  'code': code,
398
401
  'info': currency,
399
- 'type': None,
402
+ 'type': 'fiat' if isFiat else 'crypto',
400
403
  'name': None,
401
404
  'active': deposit and withdraw,
402
405
  'deposit': deposit,
@@ -404,6 +407,7 @@ class bitopro(Exchange, ImplicitAPI):
404
407
  'fee': fee,
405
408
  'precision': None,
406
409
  'limits': limits,
410
+ 'networks': None,
407
411
  }
408
412
  return result
409
413
 
ccxt/bitrue.py CHANGED
@@ -833,7 +833,8 @@ class bitrue(Exchange, ImplicitAPI):
833
833
  'withdraw': withdraw,
834
834
  'networks': networks,
835
835
  'fee': self.parse_number(minWithdrawFeeString),
836
- # 'fees': fees,
836
+ 'fees': None,
837
+ 'type': 'crypto',
837
838
  'limits': {
838
839
  'withdraw': {
839
840
  'min': self.parse_number(minWithdrawString),