oracle / scripts /debug_db_counts.py
zirobtc's picture
Upload folder using huggingface_hub
db0a14e
import os
import clickhouse_connect
from dotenv import load_dotenv
load_dotenv()
def check_max_trades():
try:
client = clickhouse_connect.get_client(
host=os.getenv("CLICKHOUSE_HOST"),
port=int(os.getenv("CLICKHOUSE_HTTP_PORT")),
secure=False
)
print("Connected to ClickHouse.")
# 1. Find the token with the most trades
print("Querying max trade count per token (this might take a moment)...")
query = """
SELECT base_address, count(*) as c
FROM trades
GROUP BY base_address
ORDER BY c DESC
LIMIT 5
"""
result = client.query(query)
print("Top 5 Tokens by Trade Count:")
for row in result.result_rows:
print(f"Token: {row[0]}, Count: {row[1]}")
except Exception as e:
print(f"Error: {e}")
if __name__ == "__main__":
check_max_trades()