import requests
from pprint import pprint
# Define the DEXs to query.
dexes = ["Uniswap", "SushiSwap", "Curve"]
# Define the pairs to query.
pairs = ["ETH/USDC", "BTC/USDC"]
# Make a request to each DEX for each pair.
results = {}
for dex in dexes:
for pair in pairs:
# Get the price from the DEX.
response = requests.get(f"
https://api.{dex}.org/v2/ticker/{pair}")
price = response.json()["price"]
# Add the price to the results dictionary.
results[dex] = results.get(dex, {})
results[dex][pair] = price
# Print the results.
print(results)
من میخواهم این کد اختلاف قیمت بین صرافی های غیر متمرکز را نشان دهد ولی هر کار میکنم خطا میدهد