ccxt 4.4.74__py2.py3-none-any.whl → 4.4.77__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.
ccxt/async_support/xt.py CHANGED
@@ -59,7 +59,7 @@ class xt(Exchange, ImplicitAPI):
59
59
  'createOrder': True,
60
60
  'createPostOnlyOrder': False,
61
61
  'createReduceOnlyOrder': True,
62
- 'editOrder': False,
62
+ 'editOrder': True,
63
63
  'fetchAccounts': False,
64
64
  'fetchBalance': True,
65
65
  'fetchBidsAsks': True,
@@ -246,6 +246,9 @@ class xt(Exchange, ImplicitAPI):
246
246
  'open-order': 1,
247
247
  'order/{orderId}': 1,
248
248
  },
249
+ 'put': {
250
+ 'order/{orderId}': 1,
251
+ },
249
252
  },
250
253
  'linear': {
251
254
  'get': {
@@ -280,6 +283,7 @@ class xt(Exchange, ImplicitAPI):
280
283
  'future/trade/v1/order/cancel-all': 1,
281
284
  'future/trade/v1/order/create': 1,
282
285
  'future/trade/v1/order/create-batch': 1,
286
+ 'future/trade/v1/order/update': 1,
283
287
  'future/user/v1/account/open': 1,
284
288
  'future/user/v1/position/adjust-leverage': 1,
285
289
  'future/user/v1/position/auto-margin': 1,
@@ -323,6 +327,7 @@ class xt(Exchange, ImplicitAPI):
323
327
  'future/trade/v1/order/cancel-all': 1,
324
328
  'future/trade/v1/order/create': 1,
325
329
  'future/trade/v1/order/create-batch': 1,
330
+ 'future/trade/v1/order/update': 1,
326
331
  'future/user/v1/account/open': 1,
327
332
  'future/user/v1/position/adjust-leverage': 1,
328
333
  'future/user/v1/position/auto-margin': 1,
@@ -3338,7 +3343,7 @@ class xt(Exchange, ImplicitAPI):
3338
3343
  # "cancelId": "208322474307982720"
3339
3344
  # }
3340
3345
  #
3341
- # swap and future: createOrder, cancelOrder
3346
+ # swap and future: createOrder, cancelOrder, editOrder
3342
3347
  #
3343
3348
  # {
3344
3349
  # "returnCode": 0,
@@ -3443,6 +3448,14 @@ class xt(Exchange, ImplicitAPI):
3443
3448
  # "createdTime": 1681273420039
3444
3449
  # }
3445
3450
  #
3451
+ # spot editOrder
3452
+ #
3453
+ # {
3454
+ # "orderId": "484203027161892224",
3455
+ # "modifyId": "484203544105344000",
3456
+ # "clientModifyId": null
3457
+ # }
3458
+ #
3446
3459
  marketId = self.safe_string(order, 'symbol')
3447
3460
  marketType = ('result' in order) or 'contract' if ('positionSide' in order) else 'spot'
3448
3461
  market = self.safe_market(marketId, market, None, marketType)
@@ -3456,7 +3469,7 @@ class xt(Exchange, ImplicitAPI):
3456
3469
  return self.safe_order({
3457
3470
  'info': order,
3458
3471
  'id': self.safe_string_n(order, ['orderId', 'result', 'cancelId', 'entrustId', 'profitId']),
3459
- 'clientOrderId': self.safe_string(order, 'clientOrderId'),
3472
+ 'clientOrderId': self.safe_string_2(order, 'clientOrderId', 'clientModifyId'),
3460
3473
  'timestamp': timestamp,
3461
3474
  'datetime': self.iso8601(timestamp),
3462
3475
  'lastTradeTimestamp': lastUpdatedTimestamp,
@@ -4679,6 +4692,94 @@ class xt(Exchange, ImplicitAPI):
4679
4692
  #
4680
4693
  return response # unify return type
4681
4694
 
4695
+ async def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}) -> Order:
4696
+ """
4697
+ cancels an order and places a new order
4698
+
4699
+ https://doc.xt.com/#orderorderUpdate
4700
+ https://doc.xt.com/#futures_orderupdate
4701
+ https://doc.xt.com/#futures_entrustupdateProfit
4702
+
4703
+ :param str id: order id
4704
+ :param str symbol: unified symbol of the market to create an order in
4705
+ :param str type: 'market' or 'limit'
4706
+ :param str side: 'buy' or 'sell'
4707
+ :param float amount: how much of the currency you want to trade in units of the base currency
4708
+ :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
4709
+ :param dict [params]: extra parameters specific to the exchange API endpoint
4710
+ :param float [params.stopLoss]: price to set a stop-loss on an open position
4711
+ :param float [params.takeProfit]: price to set a take-profit on an open position
4712
+ :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
4713
+ """
4714
+ if amount is None:
4715
+ raise ArgumentsRequired(self.id + ' editOrder() requires an amount argument')
4716
+ await self.load_markets()
4717
+ market = self.market(symbol)
4718
+ request = {}
4719
+ stopLoss = self.safe_number_2(params, 'stopLoss', 'triggerStopPrice')
4720
+ takeProfit = self.safe_number_2(params, 'takeProfit', 'triggerProfitPrice')
4721
+ params = self.omit(params, ['stopLoss', 'takeProfit'])
4722
+ isStopLoss = (stopLoss is not None)
4723
+ isTakeProfit = (takeProfit is not None)
4724
+ if isStopLoss or isTakeProfit:
4725
+ request['profitId'] = id
4726
+ else:
4727
+ request['orderId'] = id
4728
+ request['price'] = self.price_to_precision(symbol, price)
4729
+ response = None
4730
+ if market['swap']:
4731
+ if isStopLoss:
4732
+ request['triggerStopPrice'] = self.price_to_precision(symbol, stopLoss)
4733
+ elif takeProfit is not None:
4734
+ request['triggerProfitPrice'] = self.price_to_precision(symbol, takeProfit)
4735
+ else:
4736
+ request['origQty'] = self.amount_to_precision(symbol, amount)
4737
+ subType = None
4738
+ subType, params = self.handle_sub_type_and_params('editOrder', market, params)
4739
+ if subType == 'inverse':
4740
+ if isStopLoss or isTakeProfit:
4741
+ response = await self.privateInversePostFutureTradeV1EntrustUpdateProfitStop(self.extend(request, params))
4742
+ else:
4743
+ response = await self.privateInversePostFutureTradeV1OrderUpdate(self.extend(request, params))
4744
+ #
4745
+ # {
4746
+ # "returnCode": 0,
4747
+ # "msgInfo": "success",
4748
+ # "error": null,
4749
+ # "result": "483869474947826752"
4750
+ # }
4751
+ #
4752
+ else:
4753
+ if isStopLoss or isTakeProfit:
4754
+ response = await self.privateLinearPostFutureTradeV1EntrustUpdateProfitStop(self.extend(request, params))
4755
+ else:
4756
+ response = await self.privateLinearPostFutureTradeV1OrderUpdate(self.extend(request, params))
4757
+ #
4758
+ # {
4759
+ # "returnCode": 0,
4760
+ # "msgInfo": "success",
4761
+ # "error": null,
4762
+ # "result": "483869474947826752"
4763
+ # }
4764
+ #
4765
+ else:
4766
+ request['quantity'] = self.amount_to_precision(symbol, amount)
4767
+ response = await self.privateSpotPutOrderOrderId(self.extend(request, params))
4768
+ #
4769
+ # {
4770
+ # "rc": 0,
4771
+ # "mc": "SUCCESS",
4772
+ # "ma": [],
4773
+ # "result": {
4774
+ # "orderId": "484203027161892224",
4775
+ # "modifyId": "484203544105344000",
4776
+ # "clientModifyId": null
4777
+ # }
4778
+ # }
4779
+ #
4780
+ result = response if (market['swap']) else self.safe_dict(response, 'result', {})
4781
+ return self.parse_order(result, market)
4782
+
4682
4783
  def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
4683
4784
  #
4684
4785
  # spot: error
@@ -4776,6 +4877,8 @@ class xt(Exchange, ImplicitAPI):
4776
4877
  else:
4777
4878
  body['media'] = id
4778
4879
  isUndefinedBody = ((method == 'GET') or (path == 'order/{orderId}') or (path == 'ws-token'))
4880
+ if (method == 'PUT') and (endpoint == 'spot'):
4881
+ isUndefinedBody = False
4779
4882
  body = None if isUndefinedBody else self.json(body)
4780
4883
  payloadString = None
4781
4884
  if (endpoint == 'spot') or (endpoint == 'user'):
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.74'
7
+ __version__ = '4.4.77'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -509,7 +509,7 @@ class Exchange(object):
509
509
  proxyUrl = self.check_proxy_url_settings(url, method, headers, body)
510
510
  if proxyUrl is not None:
511
511
  request_headers.update({'Origin': self.origin})
512
- url = proxyUrl + url
512
+ url = proxyUrl + self.url_encoder_for_proxy_url(url)
513
513
  # proxy agents
514
514
  proxies = None # set default
515
515
  httpProxy, httpsProxy, socksProxy = self.check_proxy_settings(url, method, headers, body)
@@ -2254,6 +2254,12 @@ class Exchange(object):
2254
2254
  raise InvalidProxySettings(self.id + ' you have multiple conflicting proxy settings(' + joinedProxyNames + '), please use only one from : proxyUrl, proxy_url, proxyUrlCallback, proxy_url_callback')
2255
2255
  return proxyUrl
2256
2256
 
2257
+ def url_encoder_for_proxy_url(self, targetUrl: str):
2258
+ # to be overriden
2259
+ includesQuery = targetUrl.find('?') >= 0
2260
+ finalUrl = self.encode_uri_component(targetUrl) if includesQuery else targetUrl
2261
+ return finalUrl
2262
+
2257
2263
  def check_proxy_settings(self, url: Str = None, method: Str = None, headers=None, body=None):
2258
2264
  usedProxies = []
2259
2265
  httpProxy = None
@@ -2913,9 +2919,6 @@ class Exchange(object):
2913
2919
 
2914
2920
  def safe_currency_structure(self, currency: object):
2915
2921
  # derive data from networks: deposit, withdraw, active, fee, limits, precision
2916
- currencyDeposit = self.safe_bool(currency, 'deposit')
2917
- currencyWithdraw = self.safe_bool(currency, 'withdraw')
2918
- currencyActive = self.safe_bool(currency, 'active')
2919
2922
  networks = self.safe_dict(currency, 'networks', {})
2920
2923
  keys = list(networks.keys())
2921
2924
  length = len(keys)
@@ -2924,20 +2927,24 @@ class Exchange(object):
2924
2927
  key = keys[i]
2925
2928
  network = networks[key]
2926
2929
  deposit = self.safe_bool(network, 'deposit')
2930
+ currencyDeposit = self.safe_bool(currency, 'deposit')
2927
2931
  if currencyDeposit is None or deposit:
2928
2932
  currency['deposit'] = deposit
2929
2933
  withdraw = self.safe_bool(network, 'withdraw')
2934
+ currencyWithdraw = self.safe_bool(currency, 'withdraw')
2930
2935
  if currencyWithdraw is None or withdraw:
2931
2936
  currency['withdraw'] = withdraw
2932
- active = self.safe_bool(network, 'active')
2933
- if currencyActive is None or active:
2934
- currency['active'] = active
2935
2937
  # set network 'active' to False if D or W is disabled
2936
- if self.safe_bool(network, 'active') is None:
2938
+ active = self.safe_bool(network, 'active')
2939
+ if active is None:
2937
2940
  if deposit and withdraw:
2938
2941
  currency['networks'][key]['active'] = True
2939
2942
  elif deposit is not None and withdraw is not None:
2940
2943
  currency['networks'][key]['active'] = False
2944
+ active = self.safe_bool(network, 'active')
2945
+ currencyActive = self.safe_bool(currency, 'active')
2946
+ if currencyActive is None or active:
2947
+ currency['active'] = active
2941
2948
  # find lowest fee(which is more desired)
2942
2949
  fee = self.safe_string(network, 'fee')
2943
2950
  feeMain = self.safe_string(currency, 'fee')
ccxt/binance.py CHANGED
@@ -1356,195 +1356,8 @@ class binance(Exchange, ImplicitAPI):
1356
1356
  'SPL': 'SOL', # temporarily keep support for SPL(old name)
1357
1357
  'SOL': 'SOL', # we shouldn't rename SOL
1358
1358
  },
1359
- # keeping self object for backward-compatibility
1360
- 'reverseNetworks': {
1361
- 'tronscan.org': 'TRC20',
1362
- 'etherscan.io': 'ERC20',
1363
- 'bscscan.com': 'BSC',
1364
- 'explorer.binance.org': 'BEP2',
1365
- 'bithomp.com': 'XRP',
1366
- 'bloks.io': 'EOS',
1367
- 'stellar.expert': 'XLM',
1368
- 'blockchair.com/bitcoin': 'BTC',
1369
- 'blockchair.com/bitcoin-cash': 'BCH',
1370
- 'blockchair.com/ecash': 'XEC',
1371
- 'explorer.litecoin.net': 'LTC',
1372
- 'explorer.avax.network': 'AVAX',
1373
- 'solscan.io': 'SOL',
1374
- 'polkadot.subscan.io': 'DOT',
1375
- 'dashboard.internetcomputer.org': 'ICP',
1376
- 'explorer.chiliz.com': 'CHZ',
1377
- 'cardanoscan.io': 'ADA',
1378
- 'mainnet.theoan.com': 'AION',
1379
- 'algoexplorer.io': 'ALGO',
1380
- 'explorer.ambrosus.com': 'AMB',
1381
- 'viewblock.io/zilliqa': 'ZIL',
1382
- 'viewblock.io/arweave': 'AR',
1383
- 'explorer.ark.io': 'ARK',
1384
- 'atomscan.com': 'ATOM',
1385
- 'www.mintscan.io': 'CTK',
1386
- 'explorer.bitcoindiamond.org': 'BCD',
1387
- 'btgexplorer.com': 'BTG',
1388
- 'bts.ai': 'BTS',
1389
- 'explorer.celo.org': 'CELO',
1390
- 'explorer.nervos.org': 'CKB',
1391
- 'cerebro.cortexlabs.ai': 'CTXC',
1392
- 'chainz.cryptoid.info': 'VIA',
1393
- 'explorer.dcrdata.org': 'DCR',
1394
- 'digiexplorer.info': 'DGB',
1395
- 'dock.subscan.io': 'DOCK',
1396
- 'dogechain.info': 'DOGE',
1397
- 'explorer.elrond.com': 'EGLD',
1398
- 'blockscout.com': 'ETC',
1399
- 'explore-fetchhub.fetch.ai': 'FET',
1400
- 'filfox.info': 'FIL',
1401
- 'fio.bloks.io': 'FIO',
1402
- 'explorer.firo.org': 'FIRO',
1403
- 'neoscan.io': 'NEO',
1404
- 'ftmscan.com': 'FTM',
1405
- 'explorer.gochain.io': 'GO',
1406
- 'block.gxb.io': 'GXS',
1407
- 'hash-hash.info': 'HBAR',
1408
- 'www.hiveblockexplorer.com': 'HIVE',
1409
- 'explorer.helium.com': 'HNT',
1410
- 'tracker.icon.foundation': 'ICX',
1411
- 'www.iostabc.com': 'IOST',
1412
- 'explorer.iota.org': 'IOTA',
1413
- 'iotexscan.io': 'IOTX',
1414
- 'irishub.iobscan.io': 'IRIS',
1415
- 'kava.mintscan.io': 'KAVA',
1416
- 'scope.klaytn.com': 'KLAY',
1417
- 'kmdexplorer.io': 'KMD',
1418
- 'kusama.subscan.io': 'KSM',
1419
- 'explorer.lto.network': 'LTO',
1420
- 'polygonscan.com': 'POLYGON',
1421
- 'explorer.ont.io': 'ONT',
1422
- 'minaexplorer.com': 'MINA',
1423
- 'nanolooker.com': 'NANO',
1424
- 'explorer.nebulas.io': 'NAS',
1425
- 'explorer.nbs.plus': 'NBS',
1426
- 'explorer.nebl.io': 'NEBL',
1427
- 'nulscan.io': 'NULS',
1428
- 'nxscan.com': 'NXS',
1429
- 'explorer.harmony.one': 'ONE',
1430
- 'explorer.poa.network': 'POA',
1431
- 'qtum.info': 'QTUM',
1432
- 'explorer.rsk.co': 'RSK',
1433
- 'www.oasisscan.com': 'ROSE',
1434
- 'ravencoin.network': 'RVN',
1435
- 'sc.tokenview.com': 'SC',
1436
- 'secretnodes.com': 'SCRT',
1437
- 'explorer.skycoin.com': 'SKY',
1438
- 'steemscan.com': 'STEEM',
1439
- 'explorer.stacks.co': 'STX',
1440
- 'www.thetascan.io': 'THETA',
1441
- 'scan.tomochain.com': 'TOMO',
1442
- 'explore.vechain.org': 'VET',
1443
- 'explorer.vite.net': 'VITE',
1444
- 'www.wanscan.org': 'WAN',
1445
- 'wavesexplorer.com': 'WAVES',
1446
- 'wax.eosx.io': 'WAXP',
1447
- 'waltonchain.pro': 'WTC',
1448
- 'chain.nem.ninja': 'XEM',
1449
- 'verge-blockchain.info': 'XVG',
1450
- 'explorer.yoyow.org': 'YOYOW',
1451
- 'explorer.zcha.in': 'ZEC',
1452
- 'explorer.zensystem.io': 'ZEN',
1453
- },
1454
1359
  'networksById': {
1455
1360
  'SOL': 'SOL', # temporary fix for SPL definition
1456
- 'tronscan.org': 'TRC20',
1457
- 'etherscan.io': 'ERC20',
1458
- 'bscscan.com': 'BSC',
1459
- 'explorer.binance.org': 'BEP2',
1460
- 'bithomp.com': 'XRP',
1461
- 'bloks.io': 'EOS',
1462
- 'stellar.expert': 'XLM',
1463
- 'blockchair.com/bitcoin': 'BTC',
1464
- 'blockchair.com/bitcoin-cash': 'BCH',
1465
- 'blockchair.com/ecash': 'XEC',
1466
- 'explorer.litecoin.net': 'LTC',
1467
- 'explorer.avax.network': 'AVAX',
1468
- 'solscan.io': 'SOL',
1469
- 'polkadot.subscan.io': 'DOT',
1470
- 'dashboard.internetcomputer.org': 'ICP',
1471
- 'explorer.chiliz.com': 'CHZ',
1472
- 'cardanoscan.io': 'ADA',
1473
- 'mainnet.theoan.com': 'AION',
1474
- 'algoexplorer.io': 'ALGO',
1475
- 'explorer.ambrosus.com': 'AMB',
1476
- 'viewblock.io/zilliqa': 'ZIL',
1477
- 'viewblock.io/arweave': 'AR',
1478
- 'explorer.ark.io': 'ARK',
1479
- 'atomscan.com': 'ATOM',
1480
- 'www.mintscan.io': 'CTK',
1481
- 'explorer.bitcoindiamond.org': 'BCD',
1482
- 'btgexplorer.com': 'BTG',
1483
- 'bts.ai': 'BTS',
1484
- 'explorer.celo.org': 'CELO',
1485
- 'explorer.nervos.org': 'CKB',
1486
- 'cerebro.cortexlabs.ai': 'CTXC',
1487
- 'chainz.cryptoid.info': 'VIA',
1488
- 'explorer.dcrdata.org': 'DCR',
1489
- 'digiexplorer.info': 'DGB',
1490
- 'dock.subscan.io': 'DOCK',
1491
- 'dogechain.info': 'DOGE',
1492
- 'explorer.elrond.com': 'EGLD',
1493
- 'blockscout.com': 'ETC',
1494
- 'explore-fetchhub.fetch.ai': 'FET',
1495
- 'filfox.info': 'FIL',
1496
- 'fio.bloks.io': 'FIO',
1497
- 'explorer.firo.org': 'FIRO',
1498
- 'neoscan.io': 'NEO',
1499
- 'ftmscan.com': 'FTM',
1500
- 'explorer.gochain.io': 'GO',
1501
- 'block.gxb.io': 'GXS',
1502
- 'hash-hash.info': 'HBAR',
1503
- 'www.hiveblockexplorer.com': 'HIVE',
1504
- 'explorer.helium.com': 'HNT',
1505
- 'tracker.icon.foundation': 'ICX',
1506
- 'www.iostabc.com': 'IOST',
1507
- 'explorer.iota.org': 'IOTA',
1508
- 'iotexscan.io': 'IOTX',
1509
- 'irishub.iobscan.io': 'IRIS',
1510
- 'kava.mintscan.io': 'KAVA',
1511
- 'scope.klaytn.com': 'KLAY',
1512
- 'kmdexplorer.io': 'KMD',
1513
- 'kusama.subscan.io': 'KSM',
1514
- 'explorer.lto.network': 'LTO',
1515
- 'polygonscan.com': 'POLYGON',
1516
- 'explorer.ont.io': 'ONT',
1517
- 'minaexplorer.com': 'MINA',
1518
- 'nanolooker.com': 'NANO',
1519
- 'explorer.nebulas.io': 'NAS',
1520
- 'explorer.nbs.plus': 'NBS',
1521
- 'explorer.nebl.io': 'NEBL',
1522
- 'nulscan.io': 'NULS',
1523
- 'nxscan.com': 'NXS',
1524
- 'explorer.harmony.one': 'ONE',
1525
- 'explorer.poa.network': 'POA',
1526
- 'qtum.info': 'QTUM',
1527
- 'explorer.rsk.co': 'RSK',
1528
- 'www.oasisscan.com': 'ROSE',
1529
- 'ravencoin.network': 'RVN',
1530
- 'sc.tokenview.com': 'SC',
1531
- 'secretnodes.com': 'SCRT',
1532
- 'explorer.skycoin.com': 'SKY',
1533
- 'steemscan.com': 'STEEM',
1534
- 'explorer.stacks.co': 'STX',
1535
- 'www.thetascan.io': 'THETA',
1536
- 'scan.tomochain.com': 'TOMO',
1537
- 'explore.vechain.org': 'VET',
1538
- 'explorer.vite.net': 'VITE',
1539
- 'www.wanscan.org': 'WAN',
1540
- 'wavesexplorer.com': 'WAVES',
1541
- 'wax.eosx.io': 'WAXP',
1542
- 'waltonchain.pro': 'WTC',
1543
- 'chain.nem.ninja': 'XEM',
1544
- 'verge-blockchain.info': 'XVG',
1545
- 'explorer.yoyow.org': 'YOYOW',
1546
- 'explorer.zcha.in': 'ZEC',
1547
- 'explorer.zensystem.io': 'ZEN',
1548
1361
  },
1549
1362
  'impliedNetworks': {
1550
1363
  'ETH': {'ERC20': 'ETH'},
@@ -8706,39 +8519,19 @@ class binance(Exchange, ImplicitAPI):
8706
8519
  def parse_deposit_address(self, response, currency: Currency = None) -> DepositAddress:
8707
8520
  #
8708
8521
  # {
8709
- # "currency": "XRP",
8522
+ # "coin": "XRP",
8710
8523
  # "address": "rEb8TK3gBgk5auZkwc6sHnwrGVJH8DuaLh",
8711
8524
  # "tag": "108618262",
8712
- # "info": {
8713
- # "coin": "XRP",
8714
- # "address": "rEb8TK3gBgk5auZkwc6sHnwrGVJH8DuaLh",
8715
- # "tag": "108618262",
8716
- # "url": "https://bithomp.com/explorer/rEb8TK3gBgk5auZkwc6sHnwrGVJH8DuaLh"
8717
- # }
8525
+ # "url": "https://bithomp.com/explorer/rEb8TK3gBgk5auZkwc6sHnwrGVJH8DuaLh"
8718
8526
  # }
8719
8527
  #
8720
- info = self.safe_dict(response, 'info', {})
8721
- url = self.safe_string(info, 'url')
8528
+ url = self.safe_string(response, 'url')
8722
8529
  address = self.safe_string(response, 'address')
8723
8530
  currencyId = self.safe_string(response, 'currency')
8724
8531
  code = self.safe_currency_code(currencyId, currency)
8725
- impliedNetwork = None
8726
- if url is not None:
8727
- reverseNetworks = self.safe_dict(self.options, 'reverseNetworks', {})
8728
- parts = url.split('/')
8729
- topLevel = self.safe_string(parts, 2)
8730
- if (topLevel == 'blockchair.com') or (topLevel == 'viewblock.io'):
8731
- subLevel = self.safe_string(parts, 3)
8732
- if subLevel is not None:
8733
- topLevel = topLevel + '/' + subLevel
8734
- impliedNetwork = self.safe_string(reverseNetworks, topLevel)
8735
- impliedNetworks = self.safe_dict(self.options, 'impliedNetworks', {
8736
- 'ETH': {'ERC20': 'ETH'},
8737
- 'TRX': {'TRC20': 'TRX'},
8738
- })
8739
- if code in impliedNetworks:
8740
- conversion = self.safe_dict(impliedNetworks, code, {})
8741
- impliedNetwork = self.safe_string(conversion, impliedNetwork, impliedNetwork)
8532
+ # deposit-address endpoint provides only network url(not network ID/CODE)
8533
+ # so we should map the url to network(their data is inside currencies)
8534
+ networkCode = self.get_network_code_by_network_url(code, url)
8742
8535
  tag = self.safe_string(response, 'tag', '')
8743
8536
  if len(tag) == 0:
8744
8537
  tag = None
@@ -8746,7 +8539,7 @@ class binance(Exchange, ImplicitAPI):
8746
8539
  return {
8747
8540
  'info': response,
8748
8541
  'currency': code,
8749
- 'network': impliedNetwork,
8542
+ 'network': networkCode,
8750
8543
  'address': address,
8751
8544
  'tag': tag,
8752
8545
  }
@@ -11294,6 +11087,35 @@ class binance(Exchange, ImplicitAPI):
11294
11087
  }
11295
11088
  return self.safe_string(ledgerType, type, type)
11296
11089
 
11090
+ def get_network_code_by_network_url(self, currencyCode: str, depositUrl: Str = None) -> Str:
11091
+ # depositUrl is like : https://bscscan.com/address/0xEF238AB229342849..
11092
+ if depositUrl is None:
11093
+ return None
11094
+ networkCode = None
11095
+ currency = self.currency(currencyCode)
11096
+ networks = self.safe_dict(currency, 'networks', {})
11097
+ networkCodes = list(networks.keys())
11098
+ for i in range(0, len(networkCodes)):
11099
+ currentNetworkCode = networkCodes[i]
11100
+ info = self.safe_dict(networks[currentNetworkCode], 'info', {})
11101
+ siteUrl = self.safe_string(info, 'contractAddressUrl')
11102
+ # check if url matches the field's value
11103
+ if siteUrl is not None and depositUrl.startswith(self.get_base_domain_from_url(siteUrl)):
11104
+ networkCode = currentNetworkCode
11105
+ return networkCode
11106
+
11107
+ def get_base_domain_from_url(self, url: Str) -> Str:
11108
+ if url is None:
11109
+ return None
11110
+ urlParts = url.split('/')
11111
+ scheme = self.safe_string(urlParts, 0)
11112
+ if scheme is None:
11113
+ return None
11114
+ domain = self.safe_string(urlParts, 2)
11115
+ if domain is None:
11116
+ return None
11117
+ return scheme + '//' + domain + '/'
11118
+
11297
11119
  def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
11298
11120
  urls = self.urls
11299
11121
  if not (api in urls['api']):
ccxt/bitget.py CHANGED
@@ -3218,7 +3218,7 @@ class bitget(Exchange, ImplicitAPI):
3218
3218
  else:
3219
3219
  request['businessType'] = 'spot'
3220
3220
  else:
3221
- request['businessType'] = 'contract'
3221
+ request['businessType'] = 'mix'
3222
3222
  response = self.privateCommonGetV2CommonTradeRate(self.extend(request, params))
3223
3223
  #
3224
3224
  # {
ccxt/bitopro.py CHANGED
@@ -36,19 +36,29 @@ class bitopro(Exchange, ImplicitAPI):
36
36
  'swap': False,
37
37
  'future': False,
38
38
  'option': False,
39
+ 'addMargin': False,
40
+ 'borrowCrossMargin': False,
41
+ 'borrowIsolatedMargin': False,
42
+ 'borrowMargin': False,
39
43
  'cancelAllOrders': True,
40
44
  'cancelOrder': True,
41
45
  'cancelOrders': True,
42
46
  'closeAllPositions': False,
43
47
  'closePosition': False,
44
48
  'createOrder': True,
49
+ 'createOrderWithTakeProfitAndStopLoss': False,
50
+ 'createOrderWithTakeProfitAndStopLossWs': False,
45
51
  'createReduceOnlyOrder': False,
46
52
  'createStopOrder': True,
47
53
  'createTriggerOrder': True,
48
54
  'editOrder': False,
49
55
  'fetchBalance': True,
56
+ 'fetchBorrowInterest': False,
57
+ 'fetchBorrowRate': False,
50
58
  'fetchBorrowRateHistories': False,
51
59
  'fetchBorrowRateHistory': False,
60
+ 'fetchBorrowRates': False,
61
+ 'fetchBorrowRatesPerSymbol': False,
52
62
  'fetchClosedOrders': True,
53
63
  'fetchCrossBorrowRate': False,
54
64
  'fetchCrossBorrowRates': False,
@@ -59,19 +69,39 @@ class bitopro(Exchange, ImplicitAPI):
59
69
  'fetchDepositWithdrawFee': 'emulated',
60
70
  'fetchDepositWithdrawFees': True,
61
71
  'fetchFundingHistory': False,
72
+ 'fetchFundingInterval': False,
73
+ 'fetchFundingIntervals': False,
62
74
  'fetchFundingRate': False,
63
75
  'fetchFundingRateHistory': False,
64
76
  'fetchFundingRates': False,
77
+ 'fetchGreeks': False,
65
78
  'fetchIndexOHLCV': False,
66
79
  'fetchIsolatedBorrowRate': False,
67
80
  'fetchIsolatedBorrowRates': False,
81
+ 'fetchIsolatedPositions': False,
82
+ 'fetchLeverage': False,
83
+ 'fetchLeverages': False,
84
+ 'fetchLeverageTiers': False,
85
+ 'fetchLiquidations': False,
86
+ 'fetchLongShortRatio': False,
87
+ 'fetchLongShortRatioHistory': False,
88
+ 'fetchMarginAdjustmentHistory': False,
68
89
  'fetchMarginMode': False,
90
+ 'fetchMarginModes': False,
91
+ 'fetchMarketLeverageTiers': False,
69
92
  'fetchMarkets': True,
70
93
  'fetchMarkOHLCV': False,
94
+ 'fetchMarkPrices': False,
95
+ 'fetchMyLiquidations': False,
96
+ 'fetchMySettlementHistory': False,
71
97
  'fetchMyTrades': True,
72
98
  'fetchOHLCV': True,
99
+ 'fetchOpenInterest': False,
73
100
  'fetchOpenInterestHistory': False,
101
+ 'fetchOpenInterests': False,
74
102
  'fetchOpenOrders': True,
103
+ 'fetchOption': False,
104
+ 'fetchOptionChain': False,
75
105
  'fetchOrder': True,
76
106
  'fetchOrderBook': True,
77
107
  'fetchOrders': False,
@@ -84,6 +114,7 @@ class bitopro(Exchange, ImplicitAPI):
84
114
  'fetchPositionsHistory': False,
85
115
  'fetchPositionsRisk': False,
86
116
  'fetchPremiumIndexOHLCV': False,
117
+ 'fetchSettlementHistory': False,
87
118
  'fetchTicker': True,
88
119
  'fetchTickers': True,
89
120
  'fetchTime': False,
@@ -94,10 +125,16 @@ class bitopro(Exchange, ImplicitAPI):
94
125
  'fetchTransactions': False,
95
126
  'fetchTransfer': False,
96
127
  'fetchTransfers': False,
128
+ 'fetchVolatilityHistory': False,
97
129
  'fetchWithdrawal': True,
98
130
  'fetchWithdrawals': True,
131
+ 'reduceMargin': False,
132
+ 'repayCrossMargin': False,
133
+ 'repayIsolatedMargin': False,
99
134
  'setLeverage': False,
135
+ 'setMargin': False,
100
136
  'setMarginMode': False,
137
+ 'setPositionMode': False,
101
138
  'transfer': False,
102
139
  'withdraw': True,
103
140
  },