ccxt 4.4.44__py2.py3-none-any.whl → 4.4.46__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 (74) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/blofin.py +22 -0
  3. ccxt/ascendex.py +15 -1
  4. ccxt/async_support/__init__.py +1 -1
  5. ccxt/async_support/ascendex.py +15 -1
  6. ccxt/async_support/base/exchange.py +1 -1
  7. ccxt/async_support/binance.py +178 -62
  8. ccxt/async_support/bingx.py +15 -9
  9. ccxt/async_support/bitfinex.py +1 -1
  10. ccxt/async_support/bitget.py +105 -41
  11. ccxt/async_support/bitmart.py +3 -3
  12. ccxt/async_support/bitmex.py +1 -1
  13. ccxt/async_support/blofin.py +22 -0
  14. ccxt/async_support/bybit.py +84 -40
  15. ccxt/async_support/coinbase.py +1 -1
  16. ccxt/async_support/coinex.py +1 -1
  17. ccxt/async_support/cryptocom.py +1 -1
  18. ccxt/async_support/delta.py +9 -4
  19. ccxt/async_support/exmo.py +16 -8
  20. ccxt/async_support/gate.py +1 -2
  21. ccxt/async_support/hashkey.py +6 -1
  22. ccxt/async_support/htx.py +2 -2
  23. ccxt/async_support/hyperliquid.py +3 -4
  24. ccxt/async_support/kraken.py +1 -1
  25. ccxt/async_support/krakenfutures.py +1 -1
  26. ccxt/async_support/kucoin.py +1 -1
  27. ccxt/async_support/kucoinfutures.py +2 -3
  28. ccxt/async_support/lykke.py +1 -1
  29. ccxt/async_support/mexc.py +3 -2
  30. ccxt/async_support/myokx.py +8 -0
  31. ccxt/async_support/okx.py +4 -4
  32. ccxt/async_support/onetrading.py +20 -4
  33. ccxt/async_support/whitebit.py +31 -8
  34. ccxt/async_support/woo.py +1 -1
  35. ccxt/async_support/woofipro.py +2 -2
  36. ccxt/base/exchange.py +1 -1
  37. ccxt/binance.py +178 -62
  38. ccxt/bingx.py +15 -9
  39. ccxt/bitfinex.py +1 -1
  40. ccxt/bitget.py +105 -41
  41. ccxt/bitmart.py +3 -3
  42. ccxt/bitmex.py +1 -1
  43. ccxt/blofin.py +22 -0
  44. ccxt/bybit.py +84 -40
  45. ccxt/coinbase.py +1 -1
  46. ccxt/coinex.py +1 -1
  47. ccxt/cryptocom.py +1 -1
  48. ccxt/delta.py +9 -4
  49. ccxt/exmo.py +16 -8
  50. ccxt/gate.py +1 -2
  51. ccxt/hashkey.py +6 -1
  52. ccxt/htx.py +2 -2
  53. ccxt/hyperliquid.py +3 -4
  54. ccxt/kraken.py +1 -1
  55. ccxt/krakenfutures.py +1 -1
  56. ccxt/kucoin.py +1 -1
  57. ccxt/kucoinfutures.py +2 -3
  58. ccxt/lykke.py +1 -1
  59. ccxt/mexc.py +3 -2
  60. ccxt/myokx.py +8 -0
  61. ccxt/okx.py +4 -4
  62. ccxt/onetrading.py +20 -4
  63. ccxt/pro/__init__.py +1 -1
  64. ccxt/pro/binance.py +2 -1
  65. ccxt/pro/coinex.py +1 -1
  66. ccxt/pro/myokx.py +5 -0
  67. ccxt/whitebit.py +31 -8
  68. ccxt/woo.py +1 -1
  69. ccxt/woofipro.py +2 -2
  70. {ccxt-4.4.44.dist-info → ccxt-4.4.46.dist-info}/METADATA +4 -4
  71. {ccxt-4.4.44.dist-info → ccxt-4.4.46.dist-info}/RECORD +74 -74
  72. {ccxt-4.4.44.dist-info → ccxt-4.4.46.dist-info}/LICENSE.txt +0 -0
  73. {ccxt-4.4.44.dist-info → ccxt-4.4.46.dist-info}/WHEEL +0 -0
  74. {ccxt-4.4.44.dist-info → ccxt-4.4.46.dist-info}/top_level.txt +0 -0
@@ -1445,16 +1445,102 @@ class bitget(Exchange, ImplicitAPI):
1445
1445
  },
1446
1446
  'sandboxMode': False,
1447
1447
  'networks': {
1448
+ # 'TRX': 'TRX', # different code for mainnet
1448
1449
  'TRC20': 'TRC20',
1450
+ # 'ETH': 'ETH', # different code for mainnet
1449
1451
  'ERC20': 'ERC20',
1450
1452
  'BEP20': 'BSC',
1451
- 'ARB': 'ArbitrumOne',
1452
- 'ZKSYNC': 'zkSyncEra',
1453
- 'STARKNET': 'Starknet',
1453
+ # 'BEP20': 'BEP20', # different for BEP20
1454
+ 'BSC': 'BEP20',
1455
+ 'ATOM': 'ATOM',
1456
+ 'ACA': 'AcalaToken',
1454
1457
  'APT': 'Aptos',
1458
+ 'ARBONE': 'ArbitrumOne',
1459
+ 'ARBNOVA': 'ArbitrumNova',
1460
+ 'AVAXC': 'C-Chain',
1461
+ 'AVAXX': 'X-Chain',
1462
+ 'AR': 'Arweave',
1463
+ 'BCH': 'BCH',
1464
+ 'BCHA': 'BCHA',
1465
+ 'BITCI': 'BITCI',
1466
+ 'BTC': 'BTC',
1467
+ 'CELO': 'CELO',
1468
+ 'CSPR': 'CSPR',
1469
+ 'ADA': 'Cardano',
1470
+ 'CHZ': 'ChilizChain',
1471
+ 'CRC20': 'CronosChain',
1472
+ 'DOGE': 'DOGE',
1473
+ 'DOT': 'DOT',
1474
+ 'EOS': 'EOS',
1475
+ 'ETHF': 'ETHFAIR',
1476
+ 'ETHW': 'ETHW',
1477
+ 'ETC': 'ETC',
1478
+ 'EGLD': 'Elrond',
1479
+ 'FIL': 'FIL',
1480
+ 'FIO': 'FIO',
1481
+ 'FTM': 'Fantom',
1482
+ 'HRC20': 'HECO',
1483
+ 'ONE': 'Harmony',
1484
+ 'HNT': 'Helium',
1485
+ 'ICP': 'ICP',
1486
+ 'IOTX': 'IoTeX',
1487
+ 'KARDIA': 'KAI',
1488
+ 'KAVA': 'KAVA',
1489
+ 'KDA': 'KDA',
1490
+ 'KLAY': 'Klaytn',
1491
+ 'KSM': 'Kusama',
1492
+ 'LAT': 'LAT',
1493
+ 'LTC': 'LTC',
1494
+ 'MINA': 'MINA',
1495
+ 'MOVR': 'MOVR',
1496
+ 'METIS': 'MetisToken',
1497
+ 'GLMR': 'Moonbeam',
1498
+ 'NEAR': 'NEARProtocol',
1499
+ 'NULS': 'NULS',
1500
+ 'OASYS': 'OASYS',
1501
+ 'OASIS': 'ROSE',
1502
+ 'OMNI': 'OMNI',
1503
+ 'ONT': 'Ontology',
1504
+ 'OPTIMISM': 'Optimism',
1505
+ 'OSMO': 'Osmosis',
1506
+ 'POKT': 'PocketNetwork',
1455
1507
  'MATIC': 'Polygon',
1508
+ 'QTUM': 'QTUM',
1509
+ 'REEF': 'REEF',
1510
+ 'SOL': 'SOL',
1511
+ 'SYS': 'SYS', # SyscoinNEVM is different
1512
+ 'SXP': 'Solar',
1513
+ 'XYM': 'Symbol',
1514
+ 'TON': 'TON',
1515
+ 'TT': 'TT',
1516
+ 'TLOS': 'Telos',
1517
+ 'THETA': 'ThetaToken',
1518
+ 'VITE': 'VITE',
1519
+ 'WAVES': 'WAVES',
1520
+ 'WAX': 'WAXP',
1521
+ 'WEMIX': 'WEMIXMainnet',
1522
+ 'XDC': 'XDCNetworkXDC',
1523
+ 'XRP': 'XRP',
1524
+ 'FET': 'FETCH',
1525
+ 'NEM': 'NEM',
1526
+ 'REI': 'REINetwork',
1527
+ 'ZIL': 'ZIL',
1528
+ 'ABBC': 'ABBCCoin',
1529
+ 'RSK': 'RSK',
1530
+ 'AZERO': 'AZERO',
1531
+ 'TRC10': 'TRC10',
1532
+ 'JUNO': 'JUNO',
1533
+ # undetected: USDSP, more info at https://www.bitget.com/v1/spot/public/coinChainList
1534
+ # todo: uncomment below after unification
1535
+ # 'TERRACLASSIC': 'Terra', # tbd, that network id is also assigned to TERRANEW network
1536
+ # 'CUBENETWORK': 'CUBE',
1537
+ # 'CADUCEUS': 'CMP',
1538
+ # 'CONFLUX': 'CFX', # CFXeSpace is different
1539
+ # 'CERE': 'CERE',
1540
+ # 'CANTO': 'CANTO',
1541
+ 'ZKSYNC': 'zkSyncEra',
1542
+ 'STARKNET': 'Starknet',
1456
1543
  'VIC': 'VICTION',
1457
- 'AVAXC': 'C-Chain',
1458
1544
  },
1459
1545
  'networksById': {
1460
1546
  },
@@ -1483,7 +1569,7 @@ class bitget(Exchange, ImplicitAPI):
1483
1569
  'mark': False,
1484
1570
  'index': False,
1485
1571
  },
1486
- 'limitPrice': True,
1572
+ 'price': True,
1487
1573
  },
1488
1574
  'timeInForce': {
1489
1575
  'IOC': True,
@@ -1525,7 +1611,7 @@ class bitget(Exchange, ImplicitAPI):
1525
1611
  'fetchClosedOrders': {
1526
1612
  'marginMode': True,
1527
1613
  'limit': 100,
1528
- 'daysBackClosed': None,
1614
+ 'daysBack': None,
1529
1615
  'daysBackCanceled': None,
1530
1616
  'untilDays': 90,
1531
1617
  'trigger': True,
@@ -1553,7 +1639,7 @@ class bitget(Exchange, ImplicitAPI):
1553
1639
  'mark': True,
1554
1640
  'index': True,
1555
1641
  },
1556
- 'limitPrice': False,
1642
+ 'price': False,
1557
1643
  },
1558
1644
  'timeInForce': {
1559
1645
  'IOC': True,
@@ -2304,13 +2390,13 @@ class bitget(Exchange, ImplicitAPI):
2304
2390
  :returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
2305
2391
  """
2306
2392
  self.check_address(address)
2307
- chain = self.safe_string_2(params, 'chain', 'network')
2308
- params = self.omit(params, 'network')
2309
- if chain is None:
2310
- raise ArgumentsRequired(self.id + ' withdraw() requires a chain parameter or a network parameter')
2393
+ networkCode = None
2394
+ networkCode, params = self.handle_network_code_and_params(params)
2395
+ if networkCode is None:
2396
+ raise ArgumentsRequired(self.id + ' withdraw() requires a "network" parameter')
2311
2397
  await self.load_markets()
2312
2398
  currency = self.currency(code)
2313
- networkId = self.network_code_to_id(chain)
2399
+ networkId = self.network_code_to_id(networkCode)
2314
2400
  request: dict = {
2315
2401
  'coin': currency['id'],
2316
2402
  'address': address,
@@ -2333,27 +2419,8 @@ class bitget(Exchange, ImplicitAPI):
2333
2419
  # }
2334
2420
  #
2335
2421
  data = self.safe_value(response, 'data', {})
2336
- result: dict = {
2337
- 'id': self.safe_string(data, 'orderId'),
2338
- 'info': response,
2339
- 'txid': None,
2340
- 'timestamp': None,
2341
- 'datetime': None,
2342
- 'network': None,
2343
- 'addressFrom': None,
2344
- 'address': None,
2345
- 'addressTo': None,
2346
- 'amount': None,
2347
- 'type': 'withdrawal',
2348
- 'currency': None,
2349
- 'status': None,
2350
- 'updated': None,
2351
- 'tagFrom': None,
2352
- 'tag': None,
2353
- 'tagTo': None,
2354
- 'comment': None,
2355
- 'fee': None,
2356
- }
2422
+ result = self.parse_transaction(data, currency)
2423
+ result['type'] = 'withdrawal'
2357
2424
  withdrawOptions = self.safe_value(self.options, 'withdraw', {})
2358
2425
  fillResponseFromRequest = self.safe_bool(withdrawOptions, 'fillResponseFromRequest', True)
2359
2426
  if fillResponseFromRequest:
@@ -2364,7 +2431,7 @@ class bitget(Exchange, ImplicitAPI):
2364
2431
  result['tag'] = tag
2365
2432
  result['address'] = address
2366
2433
  result['addressTo'] = address
2367
- result['network'] = chain
2434
+ result['network'] = networkCode
2368
2435
  return result
2369
2436
 
2370
2437
  async def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
@@ -2526,17 +2593,14 @@ class bitget(Exchange, ImplicitAPI):
2526
2593
  :returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
2527
2594
  """
2528
2595
  await self.load_markets()
2529
- networkCode = self.safe_string_2(params, 'chain', 'network')
2530
- params = self.omit(params, 'network')
2531
- networkId = None
2532
- if networkCode is not None:
2533
- networkId = self.network_code_to_id(networkCode, code)
2596
+ networkCode = None
2597
+ networkCode, params = self.handle_network_code_and_params(params)
2534
2598
  currency = self.currency(code)
2535
2599
  request: dict = {
2536
2600
  'coin': currency['id'],
2537
2601
  }
2538
- if networkId is not None:
2539
- request['chain'] = networkId
2602
+ if networkCode is not None:
2603
+ request['chain'] = self.network_code_to_id(networkCode, code)
2540
2604
  response = await self.privateSpotGetV2SpotWalletDepositAddress(self.extend(request, params))
2541
2605
  #
2542
2606
  # {
@@ -756,7 +756,7 @@ class bitmart(Exchange, ImplicitAPI):
756
756
  'fetchClosedOrders': {
757
757
  'marginMode': True,
758
758
  'limit': 200,
759
- 'daysBackClosed': None,
759
+ 'daysBack': None,
760
760
  'daysBackCanceled': None,
761
761
  'untilDays': None,
762
762
  'trigger': False,
@@ -785,7 +785,7 @@ class bitmart(Exchange, ImplicitAPI):
785
785
  'mark': True,
786
786
  'index': False,
787
787
  },
788
- 'limitPrice': False,
788
+ 'price': False,
789
789
  },
790
790
  'timeInForce': {
791
791
  'IOC': True,
@@ -823,7 +823,7 @@ class bitmart(Exchange, ImplicitAPI):
823
823
  'fetchClosedOrders': {
824
824
  'marginMode': True,
825
825
  'limit': 200,
826
- 'daysBackClosed': None,
826
+ 'daysBack': None,
827
827
  'daysBackCanceled': None,
828
828
  'untilDays': None,
829
829
  'trigger': False,
@@ -343,7 +343,7 @@ class bitmex(Exchange, ImplicitAPI):
343
343
  'fetchClosedOrders': {
344
344
  'marginMode': False,
345
345
  'limit': 500,
346
- 'daysBackClosed': None,
346
+ 'daysBack': None,
347
347
  'daysBackCanceled': None,
348
348
  'untilDays': 1000000,
349
349
  'trigger': False,
@@ -204,6 +204,18 @@ class blofin(Exchange, ImplicitAPI):
204
204
  'trade/orders-tpsl-history': 1,
205
205
  'user/query-apikey': 1,
206
206
  'affiliate/basic': 1,
207
+ 'copytrading/instruments': 1,
208
+ 'copytrading/account/balance': 1,
209
+ 'copytrading/account/positions-by-order': 1,
210
+ 'copytrading/account/positions-details-by-order': 1,
211
+ 'copytrading/account/positions-by-contract': 1,
212
+ 'copytrading/account/position-mode': 1,
213
+ 'copytrading/account/leverage-info': 1,
214
+ 'copytrading/trade/orders-pending': 1,
215
+ 'copytrading/trade/pending-tpsl-by-contract': 1,
216
+ 'copytrading/trade/position-history-by-order': 1,
217
+ 'copytrading/trade/orders-history': 1,
218
+ 'copytrading/trade/pending-tpsl-by-order': 1,
207
219
  },
208
220
  'post': {
209
221
  'trade/order': 1,
@@ -215,6 +227,16 @@ class blofin(Exchange, ImplicitAPI):
215
227
  'trade/cancel-tpsl': 1,
216
228
  'trade/close-position': 1,
217
229
  'asset/transfer': 1,
230
+ 'copytrading/account/set-position-mode': 1,
231
+ 'copytrading/account/set-leverage': 1,
232
+ 'copytrading/trade/place-order': 1,
233
+ 'copytrading/trade/cancel-order': 1,
234
+ 'copytrading/trade/place-tpsl-by-contract': 1,
235
+ 'copytrading/trade/cancel-tpsl-by-contract': 1,
236
+ 'copytrading/trade/place-tpsl-by-order': 1,
237
+ 'copytrading/trade/cancel-tpsl-by-order': 1,
238
+ 'copytrading/trade/close-position-by-order': 1,
239
+ 'copytrading/trade/close-position-by-contract': 1,
218
240
  },
219
241
  },
220
242
  },
@@ -1073,8 +1073,78 @@ class bybit(Exchange, ImplicitAPI):
1073
1073
  'ERC20': 'ETH',
1074
1074
  'TRC20': 'TRX',
1075
1075
  'BEP20': 'BSC',
1076
+ 'SOL': 'SOL',
1077
+ 'ACA': 'ACA',
1078
+ 'ADA': 'ADA',
1079
+ 'ALGO': 'ALGO',
1080
+ 'APT': 'APTOS',
1081
+ 'AR': 'AR',
1082
+ 'ARBONE': 'ARBI',
1083
+ 'AVAXC': 'CAVAX',
1084
+ 'AVAXX': 'XAVAX',
1085
+ 'ATOM': 'ATOM',
1086
+ 'BCH': 'BCH',
1087
+ 'BEP2': 'BNB',
1088
+ 'CHZ': 'CHZ',
1089
+ 'DCR': 'DCR',
1090
+ 'DGB': 'DGB',
1091
+ 'DOGE': 'DOGE',
1092
+ 'DOT': 'DOT',
1093
+ 'EGLD': 'EGLD',
1094
+ 'EOS': 'EOS',
1095
+ 'ETC': 'ETC',
1096
+ 'ETHF': 'ETHF',
1097
+ 'ETHW': 'ETHW',
1098
+ 'FIL': 'FIL',
1099
+ 'STEP': 'FITFI',
1100
+ 'FLOW': 'FLOW',
1101
+ 'FTM': 'FTM',
1102
+ 'GLMR': 'GLMR',
1103
+ 'HBAR': 'HBAR',
1104
+ 'HNT': 'HNT',
1105
+ 'ICP': 'ICP',
1106
+ 'ICX': 'ICX',
1107
+ 'KDA': 'KDA',
1108
+ 'KLAY': 'KLAY',
1109
+ 'KMA': 'KMA',
1110
+ 'KSM': 'KSM',
1111
+ 'LTC': 'LTC',
1112
+ # 'TERRA': 'LUNANEW',
1113
+ # 'TERRACLASSIC': 'LUNA',
1114
+ 'MATIC': 'MATIC',
1115
+ 'MINA': 'MINA',
1116
+ 'MOVR': 'MOVR',
1117
+ 'NEAR': 'NEAR',
1118
+ 'NEM': 'NEM',
1119
+ 'OASYS': 'OAS',
1120
+ 'OASIS': 'ROSE',
1076
1121
  'OMNI': 'OMNI',
1077
- 'SPL': 'SOL',
1122
+ 'ONE': 'ONE',
1123
+ 'OPTIMISM': 'OP',
1124
+ 'POKT': 'POKT',
1125
+ 'QTUM': 'QTUM',
1126
+ 'RVN': 'RVN',
1127
+ 'SC': 'SC',
1128
+ 'SCRT': 'SCRT',
1129
+ 'STX': 'STX',
1130
+ 'THETA': 'THETA',
1131
+ 'TON': 'TON',
1132
+ 'WAVES': 'WAVES',
1133
+ 'WAX': 'WAXP',
1134
+ 'XDC': 'XDC',
1135
+ 'XEC': 'XEC',
1136
+ 'XLM': 'XLM',
1137
+ 'XRP': 'XRP',
1138
+ 'XTZ': 'XTZ',
1139
+ 'XYM': 'XYM',
1140
+ 'ZEN': 'ZEN',
1141
+ 'ZIL': 'ZIL',
1142
+ 'ZKSYNC': 'ZKSYNC',
1143
+ # todo: uncomment after consensus
1144
+ # 'CADUCEUS': 'CMP',
1145
+ # 'KON': 'KON', # konpay, "konchain"
1146
+ # 'AURORA': 'AURORA',
1147
+ # 'BITCOINGOLD': 'BTG',
1078
1148
  },
1079
1149
  'networksById': {
1080
1150
  'ETH': 'ERC20',
@@ -1116,7 +1186,7 @@ class bybit(Exchange, ImplicitAPI):
1116
1186
  'mark': True,
1117
1187
  'index': True,
1118
1188
  },
1119
- 'limitPrice': True,
1189
+ 'price': True,
1120
1190
  },
1121
1191
  'timeInForce': {
1122
1192
  'IOC': True,
@@ -1156,7 +1226,7 @@ class bybit(Exchange, ImplicitAPI):
1156
1226
  'fetchClosedOrders': {
1157
1227
  'marginMode': False,
1158
1228
  'limit': 50,
1159
- 'daysBackClosed': 365 * 2, # 2 years
1229
+ 'daysBack': 365 * 2, # 2 years
1160
1230
  'daysBackCanceled': 1,
1161
1231
  'untilDays': 7,
1162
1232
  'trigger': True,
@@ -1173,7 +1243,7 @@ class bybit(Exchange, ImplicitAPI):
1173
1243
  'triggerDirection': False,
1174
1244
  'attachedStopLossTakeProfit': {
1175
1245
  'triggerPriceType': None,
1176
- 'limitPrice': True,
1246
+ 'price': True,
1177
1247
  },
1178
1248
  'marketBuyRequiresPrice': True,
1179
1249
  },
@@ -1254,7 +1324,7 @@ class bybit(Exchange, ImplicitAPI):
1254
1324
  :param dict [params]: extra parameters specific to the exchange API endpoint
1255
1325
  :returns any: [enableUnifiedMargin, enableUnifiedAccount]
1256
1326
  """
1257
- # The API key of user id must own one of permissions will be allowed to call following API endpoints.
1327
+ # The API key of user id must own one of permissions will be allowed to call following API endpoints:
1258
1328
  # SUB UID: "Account Transfer"
1259
1329
  # MASTER UID: "Account Transfer", "Subaccount Transfer", "Withdrawal"
1260
1330
  enableUnifiedMargin = self.safe_bool(self.options, 'enableUnifiedMargin')
@@ -5059,12 +5129,11 @@ classic accounts only/ spot not supported* fetches information on an order made
5059
5129
  address = self.safe_string(depositAddress, 'addressDeposit')
5060
5130
  tag = self.safe_string(depositAddress, 'tagDeposit')
5061
5131
  code = self.safe_string(currency, 'code')
5062
- chain = self.safe_string(depositAddress, 'chain')
5063
5132
  self.check_address(address)
5064
5133
  return {
5065
5134
  'info': depositAddress,
5066
5135
  'currency': code,
5067
- 'network': chain,
5136
+ 'network': self.network_id_to_code(self.safe_string(depositAddress, 'chain'), code),
5068
5137
  'address': address,
5069
5138
  'tag': tag,
5070
5139
  }
@@ -5084,6 +5153,10 @@ classic accounts only/ spot not supported* fetches information on an order made
5084
5153
  request: dict = {
5085
5154
  'coin': currency['id'],
5086
5155
  }
5156
+ networkCode = None
5157
+ networkCode, params = self.handle_network_code_and_params(params)
5158
+ if networkCode is not None:
5159
+ request['chainType'] = self.network_code_to_id(networkCode, code)
5087
5160
  response = await self.privateGetV5AssetDepositQueryAddress(self.extend(request, params))
5088
5161
  #
5089
5162
  # {
@@ -5124,40 +5197,11 @@ classic accounts only/ spot not supported* fetches information on an order made
5124
5197
  :returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
5125
5198
  """
5126
5199
  await self.load_markets()
5127
- networkCode, query = self.handle_network_code_and_params(params)
5128
- networkId = self.network_code_to_id(networkCode)
5129
5200
  currency = self.currency(code)
5130
- request: dict = {
5131
- 'coin': currency['id'],
5132
- }
5133
- if networkId is not None:
5134
- request['chainType'] = networkId
5135
- response = await self.privateGetV5AssetDepositQueryAddress(self.extend(request, query))
5136
- #
5137
- # {
5138
- # "retCode": 0,
5139
- # "retMsg": "success",
5140
- # "result": {
5141
- # "coin": "USDT",
5142
- # "chains": [
5143
- # {
5144
- # "chainType": "ERC20",
5145
- # "addressDeposit": "0xd9e1cd77afa0e50b452a62fbb68a3340602286c3",
5146
- # "tagDeposit": "",
5147
- # "chain": "ETH"
5148
- # }
5149
- # ]
5150
- # },
5151
- # "retExtInfo": {},
5152
- # "time": 1672192792860
5153
- # }
5154
- #
5155
- result = self.safe_dict(response, 'result', {})
5156
- chains = self.safe_list(result, 'chains', [])
5157
- chainsIndexedById = self.index_by(chains, 'chain')
5158
- selectedNetworkId = self.select_network_id_from_raw_networks(code, networkCode, chainsIndexedById)
5159
- addressObject = self.safe_dict(chainsIndexedById, selectedNetworkId, {})
5160
- return self.parse_deposit_address(addressObject, currency)
5201
+ networkCode, paramsOmited = self.handle_network_code_and_params(params)
5202
+ indexedAddresses = await self.fetch_deposit_addresses_by_network(code, paramsOmited)
5203
+ selectedNetworkCode = self.select_network_code_from_unified_networks(currency['code'], networkCode, indexedAddresses)
5204
+ return indexedAddresses[selectedNetworkCode]
5161
5205
 
5162
5206
  async def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
5163
5207
  """
@@ -439,7 +439,7 @@ class coinbase(Exchange, ImplicitAPI):
439
439
  'fetchClosedOrders': {
440
440
  'marginMode': False,
441
441
  'limit': None,
442
- 'daysBackClosed': None,
442
+ 'daysBack': None,
443
443
  'daysBackCanceled': None,
444
444
  'untilDays': 10000,
445
445
  'trigger': False,
@@ -563,7 +563,7 @@ class coinex(Exchange, ImplicitAPI):
563
563
  'fetchClosedOrders': {
564
564
  'marginMode': True,
565
565
  'limit': 1000,
566
- 'daysBackClosed': None,
566
+ 'daysBack': None,
567
567
  'daysBackCanceled': None,
568
568
  'untilDays': None,
569
569
  'trigger': True,
@@ -427,7 +427,7 @@ class cryptocom(Exchange, ImplicitAPI):
427
427
  'fetchClosedOrders': {
428
428
  'marginMode': False,
429
429
  'limit': 100,
430
- 'daysBackClosed': None,
430
+ 'daysBack': None,
431
431
  'daysBackCanceled': None,
432
432
  'untilDays': 1,
433
433
  'trigger': False,
@@ -1446,13 +1446,14 @@ class delta(Exchange, ImplicitAPI):
1446
1446
  """
1447
1447
  fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1448
1448
 
1449
- https://docs.delta.exchange/#get-ohlc-candles
1449
+ https://docs.delta.exchange/#delta-exchange-api-v2-historical-ohlc-candles-sparklines
1450
1450
 
1451
1451
  :param str symbol: unified symbol of the market to fetch OHLCV data for
1452
1452
  :param str timeframe: the length of time each candle represents
1453
1453
  :param int [since]: timestamp in ms of the earliest candle to fetch
1454
1454
  :param int [limit]: the maximum amount of candles to fetch
1455
1455
  :param dict [params]: extra parameters specific to the exchange API endpoint
1456
+ :param str [params.until]: timestamp in ms of the latest candle to fetch
1456
1457
  :returns int[][]: A list of candles ordered, open, high, low, close, volume
1457
1458
  """
1458
1459
  await self.load_markets()
@@ -1462,14 +1463,18 @@ class delta(Exchange, ImplicitAPI):
1462
1463
  }
1463
1464
  duration = self.parse_timeframe(timeframe)
1464
1465
  limit = limit if limit else 2000 # max 2000
1466
+ until = self.safe_integer_product(params, 'until', 0.001)
1467
+ untilIsDefined = (until is not None)
1468
+ if untilIsDefined:
1469
+ until = self.parse_to_int(until)
1465
1470
  if since is None:
1466
- end = self.seconds()
1471
+ end = until if untilIsDefined else self.seconds()
1467
1472
  request['end'] = end
1468
1473
  request['start'] = end - limit * duration
1469
1474
  else:
1470
1475
  start = self.parse_to_int(since / 1000)
1471
1476
  request['start'] = start
1472
- request['end'] = self.sum(start, limit * duration)
1477
+ request['end'] = until if untilIsDefined else self.sum(start, limit * duration)
1473
1478
  price = self.safe_string(params, 'price')
1474
1479
  if price == 'mark':
1475
1480
  request['symbol'] = 'MARK:' + market['id']
@@ -1477,7 +1482,7 @@ class delta(Exchange, ImplicitAPI):
1477
1482
  request['symbol'] = market['info']['spot_index']['symbol']
1478
1483
  else:
1479
1484
  request['symbol'] = market['id']
1480
- params = self.omit(params, 'price')
1485
+ params = self.omit(params, ['price', 'until'])
1481
1486
  response = await self.publicGetHistoryCandles(self.extend(request, params))
1482
1487
  #
1483
1488
  # {
@@ -846,32 +846,40 @@ class exmo(Exchange, ImplicitAPI):
846
846
  :param int [since]: timestamp in ms of the earliest candle to fetch
847
847
  :param int [limit]: the maximum amount of candles to fetch
848
848
  :param dict [params]: extra parameters specific to the exchange API endpoint
849
+ :param int [params.until]: timestamp in ms of the latest candle to fetch
849
850
  :returns int[][]: A list of candles ordered, open, high, low, close, volume
850
851
  """
851
852
  await self.load_markets()
852
853
  market = self.market(symbol)
854
+ until = self.safe_integer_product(params, 'until', 0.001)
855
+ untilIsDefined = (until is not None)
853
856
  request: dict = {
854
857
  'symbol': market['id'],
855
858
  'resolution': self.safe_string(self.timeframes, timeframe, timeframe),
856
859
  }
857
860
  maxLimit = 3000
858
861
  duration = self.parse_timeframe(timeframe)
859
- now = self.milliseconds()
862
+ now = self.parse_to_int(self.milliseconds() / 1000)
860
863
  if since is None:
864
+ to = min(until, now) if untilIsDefined else now
861
865
  if limit is None:
862
866
  limit = 1000 # cap default at generous amount
863
867
  else:
864
868
  limit = min(limit, maxLimit)
865
- request['from'] = self.parse_to_int(now / 1000) - limit * duration - 1
866
- request['to'] = self.parse_to_int(now / 1000)
869
+ request['from'] = to - (limit * duration) - 1
870
+ request['to'] = to
867
871
  else:
868
872
  request['from'] = self.parse_to_int(since / 1000) - 1
869
- if limit is None:
870
- limit = maxLimit
873
+ if untilIsDefined:
874
+ request['to'] = min(until, now)
871
875
  else:
872
- limit = min(limit, maxLimit)
873
- to = self.sum(since, limit * duration * 1000)
874
- request['to'] = self.parse_to_int(to / 1000)
876
+ if limit is None:
877
+ limit = maxLimit
878
+ else:
879
+ limit = min(limit, maxLimit)
880
+ to = self.sum(since, limit * duration)
881
+ request['to'] = min(to, now)
882
+ params = self.omit(params, 'until')
875
883
  response = await self.publicGetCandlesHistory(self.extend(request, params))
876
884
  #
877
885
  # {
@@ -735,7 +735,6 @@ class gate(Exchange, ImplicitAPI):
735
735
  'takeProfitPrice': True,
736
736
  'attachedStopLossTakeProfit': None,
737
737
  'timeInForce': {
738
- 'GTC': True,
739
738
  'IOC': True,
740
739
  'FOK': True,
741
740
  'PO': True,
@@ -776,7 +775,7 @@ class gate(Exchange, ImplicitAPI):
776
775
  'trailing': False,
777
776
  'limit': 100,
778
777
  'untilDays': 30,
779
- 'daysBackClosed': None,
778
+ 'daysBack': None,
780
779
  'daysBackCanceled': None,
781
780
  },
782
781
  'fetchOHLCV': {
@@ -1454,9 +1454,14 @@ class hashkey(Exchange, ImplicitAPI):
1454
1454
  if isBuyer is not None:
1455
1455
  side = 'buy' if isBuyer else 'sell'
1456
1456
  takerOrMaker = None
1457
- isMaker = self.safe_bool_n(trade, ['isMaker', 'isMarker', 'ibm'])
1457
+ isMaker = self.safe_bool_n(trade, ['isMaker', 'isMarker'])
1458
1458
  if isMaker is not None:
1459
1459
  takerOrMaker = 'maker' if isMaker else 'taker'
1460
+ isBuyerMaker = self.safe_bool(trade, 'ibm')
1461
+ # if public trade
1462
+ if isBuyerMaker is not None:
1463
+ takerOrMaker = 'taker'
1464
+ side = 'sell' if isBuyerMaker else 'buy'
1460
1465
  feeCost = self.safe_string(trade, 'commission')
1461
1466
  feeCurrncyId = self.safe_string(trade, 'commissionAsset')
1462
1467
  feeInfo = self.safe_dict(trade, 'fee')
ccxt/async_support/htx.py CHANGED
@@ -1311,7 +1311,7 @@ class htx(Exchange, ImplicitAPI):
1311
1311
  'trailing': False,
1312
1312
  'untilDays': 2,
1313
1313
  'limit': 500,
1314
- 'daysBackClosed': 180,
1314
+ 'daysBack': 180,
1315
1315
  'daysBackCanceled': 1 / 12,
1316
1316
  },
1317
1317
  'fetchOHLCV': {
@@ -1352,7 +1352,7 @@ class htx(Exchange, ImplicitAPI):
1352
1352
  'trailing': False,
1353
1353
  'untilDays': 2,
1354
1354
  'limit': 50,
1355
- 'daysBackClosed': 90,
1355
+ 'daysBack': 90,
1356
1356
  'daysBackCanceled': 1 / 12,
1357
1357
  },
1358
1358
  'fetchOHLCV': {