REST Server
Drop-in replacement for the ThetaData Java Terminal. Runs a local HTTP REST server and WebSocket server with identical API compatibility. Existing Python SDK scripts, Excel add-ins, and curl commands work without changes.
Installation
cargo install thetadatadx-server --git https://github.com/userFRM/ThetaDataDxOr build from source:
cargo install --path tools/serverQuick Start
thetadatadx-server --creds creds.txtThis starts:
- HTTP REST API on
http://127.0.0.1:25510(all/v2/...routes) - WebSocket server on
ws://127.0.0.1:25520/v1/events
CLI Flags
| Flag | Default | Description |
|---|---|---|
--creds <path> | creds.txt | Credentials file |
--http-port <port> | 25510 | HTTP REST API port |
--ws-port <port> | 25520 | WebSocket server port |
--bind <addr> | 127.0.0.1 | Bind address |
REST API
All 61 endpoints are exposed as HTTP routes following the Java terminal's URL patterns.
# Stock EOD
curl "http://127.0.0.1:25510/v2/hist/stock/eod?root=AAPL&start_date=20240101&end_date=20240301"
# Option snapshot
curl "http://127.0.0.1:25510/v2/snapshot/option/quote?root=SPY&exp=20240419&strike=500000&right=C"
# Calendar
curl "http://127.0.0.1:25510/v2/calendar/open_today"Response envelope matches the Java terminal:
{
"header": { "format": "json", "error_type": "null" },
"response": [ ... ]
}TIP
The REST server uses sonic-rs (SIMD-accelerated JSON) for serialization, providing faster response times than the Java terminal on large payloads.
WebSocket API
The WebSocket server at /v1/events replicates the Java terminal's streaming protocol:
- Single client at a time
- STATUS heartbeat every second
- Event types: QUOTE, TRADE, OHLC, OPEN_INTEREST, STATUS
WARNING
The WebSocket endpoint supports a single concurrent client connection. If a second client connects, the first connection will be dropped. For multi-client setups, run multiple server instances on different ports.
System Routes
| Route | Description |
|---|---|
/v2/system/mdds/status | MDDS connection status |
/v2/system/fpss/status | FPSS connection status |
/v2/system/shutdown | Graceful shutdown |