Tradowix Chart API

Share candle data and live charts with partners using API keys — integrate into any signal bot.

Overview

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:

Default URLs
Chart + HTTP API: https://tradowixapi.site
Live WebSocket: wss://tradowixapi.site

Quick start (partner / signal bot)

  1. Owner creates an API key in the admin panel (optionally limit markets).
  2. Share the twk_... key securely (shown once at creation).
  3. Partner verifies the key and fetches candles or connects to live WebSocket.

Verify key (curl)

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\"}"

Fetch candles (curl)

curl "https://tradowixapi.site/api/candles?symbol=BTCUSD-OTC&timeframe=60&limit=200" \
  -H "X-Api-Key: twk_YOUR_KEY_HERE"

Last 3 days of candles (no limit)

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).

Python client (built-in)

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"])

Server owner setup

CLI commands (full list)

CommandDescription
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.ps1Stop ports 8765/8766 and restart chart server (Windows)
python examples/signal_bot_chart.pyExample bot using ChartApiClient (set env API key)

Environment variables

Owner workflow

  1. Sign in to the owner admin panel (URL shared privately, not on this page).
  2. Paste your Tradowix session token and save (powers live feed + archiver).
  3. Go to API Keys → create key → copy and send to your partner once.

Authentication

When at least one API key exists, protected endpoints require a valid, enabled key.

MethodUsage
HeaderX-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)
CookieSet after successful verify in browser (/gate.html)

Symbol restrictions: if the key is limited to specific markets, other symbols return 403.

HTTP API reference

EndpointAuthDescription
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.

Candle response example

{
  "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": { }
}

Supported timeframes (chart UI & API)

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 labeltimeframe (seconds)~Bars per 3 days
1m604,320
2m1202,160
3m1801,440
5m300864
10m600432
15m900288
30m1800144
1h360072
4h1440018

Example 5m request: GET /api/candles?symbol=EURUSD-OTC&timeframe=300

Candle history on disk (3 days)

While the chart server runs with a valid session, it archives live 1m OTC candles under data/candles/<SYMBOL>.json:

How much data you get:

RequestResult
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.

Fetch every timeframe (curl examples)

# 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"

Live WebSocket

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).

Subscribe (client → server)

Use the same timeframe seconds as HTTP (60, 120, 300, 600, …). Minimum live base is 60.

{"type": "subscribe", "symbol": "BTCUSD-OTC", "timeframe": 300}

Messages (server → client)

typeDescription
statusconnected, upstream_ready, optional message
historyInitial candles array + timing
barUpdated or closed bar (candle object)
timingPer-second countdown / bar progress
errore.g. symbol not allowed for this key

Python live example

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)

Signal bot integration pattern

Typical flow for a partner building a signal bot on your data:

  1. Poll or stream — use WebSocket bar for real-time, or poll /api/candles on a timer.
  2. Run strategy — apply your indicators / rules on the OHLC array (same format as the web chart).
  3. Emit signals — send orders/alerts from your bot; this server does not place trades for partners.
Tip: Use GET /api/symbols once at startup to list allowed markets for the key. Use GET /api/timing to align entries with candle close.

HTTP status codes

CodeMeaning
401Missing or invalid API key
403Key cannot access this symbol
404Symbol file not found (run archive or wait for live history)
400Bad query (timeframe, missing symbol)

WebSocket close code 4401 = API key required or invalid on the WS port.

Security notes