Skip to content

userFRM/ThetaDataDx

ThetaDataDx

No-JVM ThetaData Terminal - native Rust SDK for direct market data access.

build Documentation license Crates.io PyPI Discord

Overview

thetadatadx connects directly to ThetaData's upstream servers - MDDS for historical data and FPSS for real-time streaming - entirely in native Rust. No JVM terminal process, no local Java dependency, no subprocess management. Your application talks to ThetaData's infrastructure with the same wire protocol their own terminal uses.

Important

A valid ThetaData subscription is required. This SDK authenticates against ThetaData's Nexus API using your account credentials.

Repository Structure

Path Description
crates/thetadatadx/ Core Rust SDK - gRPC historical, FPSS streaming, Greeks, FIT codec
sdks/python/ Python SDK (PyO3/maturin) - pip install thetadatadx
sdks/go/ Go SDK (CGo FFI)
sdks/cpp/ C++ SDK (RAII wrappers over C FFI)
ffi/ C FFI layer - shared library consumed by Go and C++
tools/cli/ tdx CLI - all 61 endpoints from the command line
tools/mcp/ MCP server - gives LLMs access to 64 tools over JSON-RPC
tools/server/ REST+WS server - drop-in replacement for the Java terminal
docs/ Architecture, API reference, JVM deviations, reverse-engineering guide
docs-site/ mdBook documentation site (deployed to GitHub Pages)
notebooks/ 7 Jupyter notebooks (101-107)

Quick Start

Tip

Create a creds.txt file with your ThetaData email on line 1 and password on line 2. This is the same format the Java terminal uses.

Rust

[dependencies]
thetadatadx = "3.2"
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
use thetadatadx::{ThetaDataDx, Credentials, DirectConfig};

#[tokio::main]
async fn main() -> Result<(), thetadatadx::Error> {
    let creds = Credentials::from_file("creds.txt")?;
    let tdx = ThetaDataDx::connect(&creds, DirectConfig::production()).await?;

    let eod = tdx.stock_history_eod("AAPL", "20240101", "20240301").await?;
    for tick in &eod {
        println!("{}: O={} H={} L={} C={} V={}",
            tick.date, tick.open_price(), tick.high_price(),
            tick.low_price(), tick.close_price(), tick.volume);
    }
    Ok(())
}

Python

pip install thetadatadx
from thetadatadx import Credentials, Config, ThetaDataDx

creds = Credentials.from_file("creds.txt")
tdx = ThetaDataDx(creds, Config.production())

eod = tdx.stock_history_eod("AAPL", "20240101", "20240301")
for tick in eod:
    print(f"{tick['date']}: O={tick['open']:.2f} H={tick['high']:.2f} "
          f"L={tick['low']:.2f} C={tick['close']:.2f} V={tick['volume']}")

Streaming

One connection, one auth. Historical available immediately, streaming connects lazily.

use thetadatadx::fpss::{FpssData, FpssEvent};
use thetadatadx::fpss::protocol::Contract;

tdx.start_streaming(|event: &FpssEvent| {
    match event {
        FpssEvent::Data(FpssData::Trade { contract_id, price, size, .. }) => {
            println!("Trade: {contract_id} @ {price} x {size}");
        }
        _ => {}
    }
})?;

tdx.subscribe_quotes(&Contract::stock("AAPL"))?;

API Coverage

61 typed endpoints covering all ThetaData MDDS data, plus FPSS real-time streaming and a full Black-Scholes Greeks calculator.

Category Endpoints Examples
Stock 14 EOD, OHLC, trades, quotes, snapshots, at-time
Option 34 Same as stock + 5 Greeks tiers, open interest, contracts
Index 9 EOD, OHLC, price, snapshots
Calendar 3 Market open/close, holiday schedule
Interest Rate 1 EOD rate history
Streaming 7 Quotes, trades, OI, full-trades (per-contract or firehose)
Greeks 14 All 22 Greeks + IV solver, individually or batched

All endpoints return fully typed native structs in every language. Zero raw JSON or protobuf in the public API. See the API Reference for the complete method list.

Documentation

Document Description
API Reference All 61 methods, 14 tick types, configuration options
Architecture System design, wire protocols, TOML codegen pipeline
JVM Deviations Intentional differences from the Java terminal
Reverse-Engineering Guide How to decompile the terminal and extract proto definitions
Endpoint Schema TOML codegen format for adding new types/columns
Proto Maintenance Guide for ThetaData engineers updating proto files

Contributing

Contributions are welcome. See CONTRIBUTING.md for details.

Disclaimer

Caution

Theta Data, ThetaData, and Theta Terminal are trademarks of Theta Data, Inc. / AxiomX LLC. This project is not affiliated with, endorsed by, or supported by Theta Data.

ThetaDataDx is an independent, open-source project provided "as is", without warranty of any kind.

How ThetaDataDx Was Built

ThetaDataDx was developed through independent analysis of the ThetaData Terminal JAR and its network protocol. The protocol implementation was built from scratch in Rust based on decompiled Java source and observed wire-level behavior. This approach is consistent with the principle of interoperability through protocol analysis - the same method used by projects like Samba (SMB/CIFS), open-source Exchange clients, and countless other third-party implementations of proprietary network protocols.

Legal Considerations

Warning

  • No warranty. ThetaDataDx is provided "as is", without warranty of any kind. See LICENSE for full terms.
  • Use at your own risk. Users are solely responsible for ensuring their use complies with ThetaData's Terms of Service and any applicable laws or regulations. Using ThetaDataDx may carry risks including but not limited to account restriction or termination.
  • Not financial software. ThetaDataDx is a research and interoperability project. It is not intended as a replacement for officially supported ThetaData software in production trading environments. The authors accept no liability for financial losses, missed trades, or any other damages arising from the use of this software.
  • Protocol stability. ThetaDataDx relies on an undocumented protocol that ThetaData may change at any time without notice. There is no guarantee of continued functionality.

EU Interoperability

For users and contributors in the European Union: Article 6 of the EU Software Directive (2009/24/EC) permits reverse engineering for the purpose of achieving interoperability with independently created software, provided that specific conditions are met. ThetaDataDx was developed with this legal framework in mind, enabling interoperability with ThetaData's market data infrastructure on platforms where the official Java-based Terminal cannot run (headless Linux, containers, embedded systems, native Rust/Go/C++ applications).

License

GPL-3.0-or-later - see LICENSE.