{"name": "Tradowix Chart API", "version": "1", "description": "Share chart and candle data with signal bots using API keys from the admin panel. Your Tradowix session stays on the server; partners only receive the key you create.", "base_url_note": "Production chart API: https://tradowixapi.site", "authentication": {"header": "X-Api-Key: twk_...", "query": "?api_key=twk_...", "verify": "POST /api/auth/verify with JSON {\"api_key\": \"...\"}", "public_without_keys": "If no API keys exist in data/chart_api_keys.json, endpoints are open."}, "pages": {"chart_ui": "/gate.html", "documentation": "/docs", "admin": "/adminjisanxonlynotallowanyone/login.html"}, "http_endpoints": [{"method": "GET", "path": "/api/auth/verify", "auth": "optional", "description": "Validate API key; sets HttpOnly cookie on success."}, {"method": "POST", "path": "/api/auth/verify", "auth": "optional", "body": {"api_key": "twk_..."}, "description": "Preferred verify (key not in URL)."}, {"method": "GET", "path": "/api/symbols", "auth": "required_when_keys_enabled", "description": "OTC symbol list and categories (filtered per key)."}, {"method": "GET", "path": "/api/candles", "auth": "required_when_keys_enabled", "query": {"symbol": "BTCUSD-OTC (required)", "timeframe": "seconds: 60,120,180,300,600,900,1800,3600,14400 or any multiple of 60 >= 60", "limit": "optional; omit for all stored bars (~3 days of 1m after retention)"}, "response": {"candles": [{"time": 1710000000, "open": 1, "high": 1, "low": 1, "close": 1}], "timing": "optional bar timing object"}}, {"method": "GET", "path": "/api/timing", "auth": "required_when_keys_enabled", "query": {"symbol": "...", "timeframe": "60"}}, {"method": "GET", "path": "/api/live/status", "auth": "required_when_keys_enabled", "response": {"live": true, "connected": true, "upstream_ready": true, "ws_url": "wss://tradowixapi.site/?api_key=..."}}, {"method": "GET", "path": "/api/docs", "auth": "none", "description": "This catalog (JSON)."}], "websocket": {"url_from": "/api/live/status \u2192 ws_url", "auth": "api_key query parameter on handshake", "client_send": {"subscribe": {"type": "subscribe", "symbol": "BTCUSD-OTC", "timeframe": 60}}, "server_messages": [{"type": "status", "connected": true, "upstream_ready": true}, {"type": "history", "symbol": "...", "candles": [], "timing": {}}, {"type": "bar", "symbol": "...", "candle": {}, "timing": {}}, {"type": "timing", "symbol": "...", "timing": {}}, {"type": "error", "message": "..."}], "timeframe_note": "Live hub base is 60s; higher TFs are aggregated from 60s bars.", "supported_timeframes_seconds": [60, 120, 180, 300, 600, 900, 1800, 3600, 14400]}, "data_retention": {"storage": "data/candles/<SYMBOL>.json", "base_timeframe_seconds": 60, "max_days_before_trim": 7, "days_kept_after_trim": 3, "bars_per_3_days_1m": 4320, "fetch_all": "GET /api/candles?symbol=X&timeframe=60 (no limit)", "fetch_3_days_1m": "GET /api/candles?symbol=X&timeframe=60&limit=4320"}, "timeframes": [{"label": "1m", "seconds": 60}, {"label": "2m", "seconds": 120}, {"label": "3m", "seconds": 180}, {"label": "5m", "seconds": 300}, {"label": "10m", "seconds": 600}, {"label": "15m", "seconds": 900}, {"label": "30m", "seconds": 1800}, {"label": "1h", "seconds": 3600}, {"label": "4h", "seconds": 14400}], "cli_commands": ["python -m tradowix_bot.cli chart", "python -m tradowix_bot.cli admin", "python -m tradowix_bot.cli archive --days 7", "python -m tradowix_bot.cli backtest", "python -m tradowix_bot.cli signal <file.json>", "python -m tradowix_bot.cli live"], "python_client": {"module": "tradowix_bot.chart_client", "class": "ChartApiClient", "example": "from tradowix_bot.chart_client import ChartApiClient\nc = ChartApiClient('https://tradowixapi.site', 'twk_...')\nc.verify()\nbars = c.candles('BTCUSD-OTC', timeframe=60)  # all stored (~3d)\nbars5m = c.candles('BTCUSD-OTC', timeframe=300)\n"}, "base_url": "https://tradowixapi.site", "websocket_url": "wss://tradowixapi.site:8766/"}