Share candle data and live charts with partners using API keys — integrate into any signal bot.
You run the chart server on your machine. Your Tradowix session token stays in the admin panel (never shared). For each partner or bot, create an API key in Admin → API Keys. They use that key to:
/gate.htmlGET /api/candleswss://tradowixapi.site)https://tradowixapi.sitewss://tradowixapi.site
twk_... key securely (shown once at creation).curl -X POST https://tradowixapi.site/api/auth/verify \
-H "Content-Type: application/json" \
-H "X-Api-Key: twk_YOUR_KEY_HERE" \
-d "{\"api_key\": \"twk_YOUR_KEY_HERE\"}"
curl "https://tradowixapi.site/api/candles?symbol=BTCUSD-OTC&timeframe=60&limit=200" \ -H "X-Api-Key: twk_YOUR_KEY_HERE"
curl "https://tradowixapi.site/api/candles?symbol=BTCUSD-OTC&timeframe=60" \ -H "X-Api-Key: twk_YOUR_KEY_HERE"
Omit limit to return all bars stored on the server for that symbol
(typically up to 3 days of 1-minute data after retention cleanup; up to 7 days while building history).
Use limit=4320 for exactly ~3 days of 1m bars (3 × 24 × 60).
from tradowix_bot.chart_client import ChartApiClient
client = ChartApiClient("https://tradowixapi.site", "twk_YOUR_KEY_HERE")
client.verify()
# All stored 1m bars (up to ~3 days on disk)
data = client.candles("BTCUSD-OTC", timeframe=60)
# Or 5-minute bars for the same period
data_5m = client.candles("BTCUSD-OTC", timeframe=300)
for bar in data["candles"]:
print(bar["time"], bar["close"])
| Command | Description |
|---|---|
python -m tradowix_bot.cli chart |
Chart UI + HTTP API (8765) + live WebSocket (8766). Options:
--host, --port, --ws-port,
--candles-dir, --token, --no-browser,
--offline, --no-archive, --admin-only
|
python -m tradowix_bot.cli admin |
Same as chart; opens admin login. Same flags as chart. |
python -m tradowix_bot.cli archive |
One-shot download of all OTC symbols to data/candles/.
--days 7 (default), --hours, --token, --candles-dir
|
python -m tradowix_bot.cli backtest |
Backtest built-in strategy on saved JSON candles. --candles-dir |
python -m tradowix_bot.cli signal <path.json> |
Run strategy on one symbol file. --min-confidence |
python -m tradowix_bot.cli live SYM … |
Standalone live signal stream (your token). --timeframe, --min-confidence, --verbose |
scripts\restart_chart.ps1 | Stop ports 8765/8766 and restart chart server (Windows) |
python examples/signal_bot_chart.py | Example bot using ChartApiClient (set env API key) |
TRADOWIX_SESSION_TOKEN — Tradowix session (owner only); overrides data/session.jsonTRADOWIX_CHART_URL — e.g. https://tradowixapi.site (for bots / examples)TRADOWIX_CHART_API_KEY — API key for example bot / integrationsTRADOWIX_CANDLES_DIR — candle directory overrideTRADOWIX_CDP_URL — Playwright CDP for scripts/fetch_candles.pyWhen at least one API key exists, protected endpoints require a valid, enabled key.
| Method | Usage |
|---|---|
| Header | X-Api-Key: twk_... (recommended for bots) |
| JSON body | {"api_key": "twk_..."} on POST /api/auth/verify |
| Query | ?api_key=twk_... (WebSocket; avoid in HTTP logs) |
| Cookie | Set after successful verify in browser (/gate.html) |
Symbol restrictions: if the key is limited to specific markets, other symbols return 403.
| Endpoint | Auth | Description | |
|---|---|---|---|
| POST | /api/auth/verify |
Optional | Validate key; returns key_id, name, all_symbols |
| GET | /api/symbols |
Key* | Symbol list + categories (filtered per key) |
| GET | /api/candles?symbol=&timeframe=&limit= |
Key* | OHLC bars: time (unix sec), o/h/l/c |
| GET | /api/timing?symbol=&timeframe= |
Key* | Bar open/close timing for countdowns |
| GET | /api/live/status |
Key* | live, ws_url, upstream connection flags |
| GET | /api/docs |
None | JSON machine-readable catalog |
* Required when API keys are configured. Open if no keys exist.
{
"symbol": "BTCUSD-OTC",
"timeframe": 60,
"base_timeframe": 60,
"count": 500,
"candles": [
{ "time": 1710000000, "open": 1.1, "high": 1.2, "low": 1.0, "close": 1.15 }
],
"timing": { }
}
Saved files are 1-minute (60s) candles. The API resamples them to any higher timeframe (seconds must be ≥ 60 and a multiple of 60). You cannot request 30s or 15s from saved files.
| Chart label | timeframe (seconds) | ~Bars per 3 days |
|---|---|---|
| 1m | 60 | 4,320 |
| 2m | 120 | 2,160 |
| 3m | 180 | 1,440 |
| 5m | 300 | 864 |
| 10m | 600 | 432 |
| 15m | 900 | 288 |
| 30m | 1800 | 144 |
| 1h | 3600 | 72 |
| 4h | 14400 | 18 |
Example 5m request:
GET /api/candles?symbol=EURUSD-OTC&timeframe=300
While the chart server runs with a valid session, it archives live 1m OTC candles under
data/candles/<SYMBOL>.json:
/api/candles — no Tradowix login required.How much data you get:
| Request | Result |
|---|---|
No limit |
All stored bars for the symbol (whatever is on disk, usually ~3 days of 1m) |
limit=N |
Last N bars after resampling to your timeframe |
limit=4320 + timeframe=60 |
Up to ~3 days of 1m bars (if available) |
If a symbol returns 404, run
python -m tradowix_bot.cli archive --days 7 on the server or wait for the auto-archiver
after saving a session token in admin.
# 1 minute — full history on server curl -H "X-Api-Key: twk_KEY" \ "https://tradowixapi.site/api/candles?symbol=BTCUSD-OTC&timeframe=60" # 2 / 5 / 10 minute curl -H "X-Api-Key: twk_KEY" \ "https://tradowixapi.site/api/candles?symbol=BTCUSD-OTC&timeframe=120" curl -H "X-Api-Key: twk_KEY" \ "https://tradowixapi.site/api/candles?symbol=BTCUSD-OTC&timeframe=300" curl -H "X-Api-Key: twk_KEY" \ "https://tradowixapi.site/api/candles?symbol=BTCUSD-OTC&timeframe=600"
WS
Connect to the URL from GET /api/live/status (includes api_key when authenticated).
Use wss://tradowixapi.site (from /api/live/status when connected on the public site).
Use the same timeframe seconds as HTTP (60, 120, 300, 600, …). Minimum live base is 60.
{"type": "subscribe", "symbol": "BTCUSD-OTC", "timeframe": 300}
| type | Description |
|---|---|
status | connected, upstream_ready, optional message |
history | Initial candles array + timing |
bar | Updated or closed bar (candle object) |
timing | Per-second countdown / bar progress |
error | e.g. symbol not allowed for this key |
from tradowix_bot.chart_client import ChartApiClient
def on_msg(msg):
if msg.get("type") == "bar":
c = msg["candle"]
print(msg["symbol"], c["close"])
client = ChartApiClient("https://tradowixapi.site", "twk_YOUR_KEY")
client.subscribe_live_sync(on_msg, symbol="BTCUSD-OTC", timeframe=60)
Typical flow for a partner building a signal bot on your data:
bar for real-time, or poll /api/candles on a timer.GET /api/symbols once at startup to list allowed markets for the key.
Use GET /api/timing to align entries with candle close.
| Code | Meaning |
|---|---|
| 401 | Missing or invalid API key |
| 403 | Key cannot access this symbol |
| 404 | Symbol file not found (run archive or wait for live history) |
| 400 | Bad query (timeframe, missing symbol) |
WebSocket close code 4401 = API key required or invalid on the WS port.
twk_ API keys.X-Api-Key header over URL query strings in HTTP.