#!/usr/bin/env python3 import json from datetime import datetime, timezone from pathlib import Path ROOT = Path.home() / ".coinhunter" CACHE_DIR = ROOT / "cache" def now_iso(): return datetime.now(timezone.utc).replace(microsecond=0).isoformat() def ensure_file(path: Path, payload: dict): if path.exists(): return False path.write_text(json.dumps(payload, ensure_ascii=False, indent=2) + "\n", encoding="utf-8") return True def main(): ROOT.mkdir(parents=True, exist_ok=True) CACHE_DIR.mkdir(parents=True, exist_ok=True) created = [] ts = now_iso() templates = { ROOT / "config.json": { "default_exchange": "bybit", "default_quote_currency": "USDT", "timezone": "Asia/Shanghai", "preferred_chains": ["solana", "base"], "created_at": ts, "updated_at": ts, }, ROOT / "accounts.json": { "accounts": [] }, ROOT / "positions.json": { "positions": [] }, ROOT / "watchlist.json": { "watchlist": [] }, ROOT / "notes.json": { "notes": [] }, } for path, payload in templates.items(): if ensure_file(path, payload): created.append(str(path)) print(json.dumps({ "root": str(ROOT), "created": created, "cache_dir": str(CACHE_DIR), }, ensure_ascii=False, indent=2)) if __name__ == "__main__": main()