Skip to content

ThetaDataDxDirect-Wire Market Data SDK

No terminal. No overhead. Pure speed. Connect directly to ThetaData from Rust, Python, Go, and C++.

Quick Install

bash
# Add to Cargo.toml
cargo add thetadatadx tokio --features tokio/rt-multi-thread,tokio/macros
bash
pip install thetadatadx

# With pandas DataFrame support
pip install thetadatadx[pandas]
bash
# Build the Rust FFI library first
cargo build --release -p thetadatadx-ffi
bash
# Build the Rust FFI library first
cargo build --release -p thetadatadx-ffi

# Then link against libthetadatadx_ffi.so/.dylib

Minimal Example

rust
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 quotes = tdx.stock_history_quote("AAPL", "20250115", "60000").await?;
    for q in &quotes {
        println!("{}: bid={} ask={}", q.date, q.bid_price(), q.ask_price());
    }
    Ok(())
}
python
from thetadatadx import ThetaDataDx, Credentials, Config

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

quotes = tdx.stock_history_quote("AAPL", "20250115", "60000")
for q in quotes:
    print(f"{q['date']}: bid={q['bid']:.2f} ask={q['ask']:.2f}")
go
creds, _ := thetadatadx.CredentialsFromFile("creds.txt")
defer creds.Close()

config := thetadatadx.ProductionConfig()
defer config.Close()

client, _ := thetadatadx.Connect(creds, config)
defer client.Close()

quotes, _ := client.StockHistoryQuote("AAPL", "20250115", "60000")
for _, q := range quotes {
    fmt.Printf("%d: bid=%.2f ask=%.2f\n", q.Date, q.Bid, q.Ask)
}
cpp
#include "thetadx.hpp"

auto creds = tdx::Credentials::from_file("creds.txt");
auto client = tdx::Client::connect(creds, tdx::Config::production());

auto quotes = client.stock_history_quote("AAPL", "20250115", "60000");
for (auto& q : quotes) {
    std::cout << q.date << ": bid=" << q.bid
              << " ask=" << q.ask << std::endl;
}

Released under the GPL-3.0-or-later License.