Skip to main content

No-JVM ThetaData Terminal — native Rust SDK for direct market data access (Python bindings)

Project description

thetadatadx (Python)

Python SDK for ThetaData market data, powered by the thetadatadx Rust crate via PyO3.

This is NOT a Python reimplementation. Every call goes through compiled Rust — gRPC communication, protobuf parsing, zstd decompression, FIT tick decoding, and TCP streaming all happen at native speed. Python is just the interface.

Installation

pip install thetadatadx

# With pandas DataFrame support
pip install thetadatadx[pandas]

Or build from source (requires Rust toolchain):

pip install maturin
maturin develop --release

Quick Start

from thetadatadx import Credentials, Config, DirectClient

# Authenticate and connect
creds = Credentials.from_file("creds.txt")
client = DirectClient(creds, Config.production())

# Fetch end-of-day data
eod = client.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']}")

# Intraday 1-minute OHLC bars
bars = client.stock_history_ohlc("AAPL", "20240315", "60000")
print(f"{len(bars)} bars")

# Option chain
exps = client.option_list_expirations("SPY")
strikes = client.option_list_strikes("SPY", exps[0])

Greeks Calculator

Full Black-Scholes calculator with 22 Greeks, running in Rust:

from thetadatadx import all_greeks, implied_volatility

# All Greeks at once
g = all_greeks(
    spot=450.0, strike=455.0, rate=0.05, div_yield=0.015,
    tte=30/365, option_price=8.50, is_call=True
)
print(f"IV={g['iv']:.4f} Delta={g['delta']:.4f} Gamma={g['gamma']:.6f}")

# Just IV
iv, err = implied_volatility(450.0, 455.0, 0.05, 0.015, 30/365, 8.50, True)

API

Credentials

  • Credentials(email, password) — direct construction
  • Credentials.from_file(path) — load from creds.txt

Config

  • Config.production() — ThetaData NJ production servers
  • Config.dev() — dev servers with shorter timeouts

DirectClient(creds, config)

All methods return lists of dicts.

Method Description
stock_list_symbols() All stock symbols
stock_history_eod(symbol, start, end) EOD data
stock_history_ohlc(symbol, date, interval) Intraday OHLC
stock_history_trade(symbol, date) All trades
stock_history_quote(symbol, date, interval) NBBO quotes
stock_snapshot_quote(symbols) Live quote snapshot
option_list_expirations(symbol) Expiration dates
option_list_strikes(symbol, exp) Strike prices
option_list_symbols() Option underlyings
index_list_symbols() Index symbols

FpssClient(creds, buffer_size=1024)

Real-time streaming client.

Method Description
subscribe(symbol, data_type) Subscribe to a stream ("QUOTE", "TRADE", "OI")
next_event(timeout_ms=5000) Poll for the next event (returns dict or None on timeout)
shutdown() Graceful shutdown

to_dataframe(data)

Convert a list of tick dicts to a pandas DataFrame. Requires pip install thetadatadx[pandas].

_df method variants

All DirectClient data methods have _df variants that return DataFrames directly: stock_history_eod_df(), stock_history_ohlc_df(), stock_history_trade_df(), etc.

all_greeks(spot, strike, rate, div_yield, tte, price, is_call)

Returns dict with 22 Greeks: delta, gamma, theta, vega, rho, iv, vanna, charm, vomma, veta, speed, zomma, color, ultima, d1, d2, dual_delta, dual_gamma, epsilon, lambda.

implied_volatility(spot, strike, rate, div_yield, tte, price, is_call)

Returns (iv, error) tuple.

Architecture

Python code
    │  (PyO3 FFI)
    ▼
thetadatadx Rust crate
    │  (tonic gRPC / tokio TCP)
    ▼
ThetaData servers

No HTTP middleware, no Java terminal, no subprocess. Direct wire protocol access at Rust speed.

FPSS Streaming

Real-time market data via ThetaData's FPSS servers:

from thetadatadx import Credentials, FpssClient

creds = Credentials.from_file("creds.txt")
fpss = FpssClient(creds, buffer_size=1024)

# Subscribe to real-time quotes
fpss.subscribe("AAPL", "QUOTE")
fpss.subscribe("SPY", "TRADE")

# Poll for events
while True:
    event = fpss.next_event(timeout_ms=5000)
    if event is None:
        break  # timeout, no event received
    if event["type"] == "quote":
        print(f"Quote: {event['contract']} bid={event['bid']} ask={event['ask']}")
    elif event["type"] == "trade":
        print(f"Trade: {event['contract']} price={event['price']} size={event['size']}")

fpss.shutdown()

pandas DataFrame Conversion

Convert any result to a pandas DataFrame:

from thetadatadx import Credentials, Config, DirectClient, to_dataframe

creds = Credentials.from_file("creds.txt")
client = DirectClient(creds, Config.production())

# Option 1: convert an existing result
eod = client.stock_history_eod("AAPL", "20240101", "20240301")
df = to_dataframe(eod)
print(df.head())

# Option 2: use _df convenience methods
df = client.stock_history_eod_df("AAPL", "20240101", "20240301")
df = client.stock_history_ohlc_df("AAPL", "20240315", "60000")
df = client.option_list_expirations_df("SPY")

Install with: pip install thetadatadx[pandas]

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

thetadatadx-1.2.4.tar.gz (116.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

thetadatadx-1.2.4-cp314-cp314-win_amd64.whl (4.5 MB view details)

Uploaded CPython 3.14Windows x86-64

thetadatadx-1.2.4-cp314-cp314-manylinux_2_38_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.38+ x86-64

thetadatadx-1.2.4-cp314-cp314-macosx_11_0_arm64.whl (4.9 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

thetadatadx-1.2.4-cp313-cp313-win_amd64.whl (4.5 MB view details)

Uploaded CPython 3.13Windows x86-64

thetadatadx-1.2.4-cp313-cp313-manylinux_2_38_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.38+ x86-64

thetadatadx-1.2.4-cp313-cp313-macosx_11_0_arm64.whl (4.9 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

thetadatadx-1.2.4-cp312-cp312-win_amd64.whl (4.5 MB view details)

Uploaded CPython 3.12Windows x86-64

thetadatadx-1.2.4-cp312-cp312-manylinux_2_38_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.38+ x86-64

thetadatadx-1.2.4-cp312-cp312-macosx_11_0_arm64.whl (4.9 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

thetadatadx-1.2.4-cp311-cp311-win_amd64.whl (4.5 MB view details)

Uploaded CPython 3.11Windows x86-64

thetadatadx-1.2.4-cp311-cp311-manylinux_2_38_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.38+ x86-64

thetadatadx-1.2.4-cp311-cp311-macosx_11_0_arm64.whl (4.9 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

thetadatadx-1.2.4-cp310-cp310-win_amd64.whl (4.5 MB view details)

Uploaded CPython 3.10Windows x86-64

thetadatadx-1.2.4-cp310-cp310-manylinux_2_38_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.38+ x86-64

thetadatadx-1.2.4-cp310-cp310-macosx_11_0_arm64.whl (4.9 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

thetadatadx-1.2.4-cp39-cp39-win_amd64.whl (4.5 MB view details)

Uploaded CPython 3.9Windows x86-64

thetadatadx-1.2.4-cp39-cp39-manylinux_2_38_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.38+ x86-64

thetadatadx-1.2.4-cp39-cp39-macosx_11_0_arm64.whl (4.9 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file thetadatadx-1.2.4.tar.gz.

File metadata

  • Download URL: thetadatadx-1.2.4.tar.gz
  • Upload date:
  • Size: 116.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for thetadatadx-1.2.4.tar.gz
Algorithm Hash digest
SHA256 0efe203ccf0135afa6bc657a44dce23e1ba6793575cc5409fbf575df43cd7c44
MD5 075106d54013f8d57ccb9143a400343a
BLAKE2b-256 de1953b2ee5f1e943c5221d42c621af645583e67e7adf15d00cd4b445102a1ef

See more details on using hashes here.

File details

Details for the file thetadatadx-1.2.4-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for thetadatadx-1.2.4-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 08e3eedee495f8fe74d1ae1f031a5ead776da267ed41ae4d9cba638608b966ba
MD5 7cc3c2b15a06b520782802bc6c9b2379
BLAKE2b-256 67a259ceff13a14fc5fe9893e8db4a12159eeed5135339e79f8ec2f3e3421d00

See more details on using hashes here.

File details

Details for the file thetadatadx-1.2.4-cp314-cp314-manylinux_2_38_x86_64.whl.

File metadata

File hashes

Hashes for thetadatadx-1.2.4-cp314-cp314-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 9075bfd5c7ef4043b471db80e91ff3ed84cf2ebf0c56b1d06b827b5a3dfe0227
MD5 6bba32224d4342703467c892134290dc
BLAKE2b-256 20e2691bae029d3da357721c9b46b4886786c534b84af6cfd8763328cc4fcad0

See more details on using hashes here.

File details

Details for the file thetadatadx-1.2.4-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for thetadatadx-1.2.4-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2cbc821ae79a392f872f5bd28501d46f8844ef0141ab0a30cd9459963d463387
MD5 f472e08e063d2c31aca308efc5d2e205
BLAKE2b-256 1d462eaceffe38e23ceffea64b327e92c2f116452077840e59d68f4820288bd9

See more details on using hashes here.

File details

Details for the file thetadatadx-1.2.4-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for thetadatadx-1.2.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 b252fb89b6ff5ea00b228c9367871e66cbed2ea2bb3a38e76e38a1840d109e07
MD5 b3dea1dc2d5da3f2dc43861696aacfb3
BLAKE2b-256 322dd89bdbcc83f9035b418e88c974034ff0c3217e851bed184e56e703bbc7c2

See more details on using hashes here.

File details

Details for the file thetadatadx-1.2.4-cp313-cp313-manylinux_2_38_x86_64.whl.

File metadata

File hashes

Hashes for thetadatadx-1.2.4-cp313-cp313-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 75d117561eb4314ecb78e50978b46a526c5a205da68f4d134422eec154b8a735
MD5 1cda2d837075efe48c585af0e04027e1
BLAKE2b-256 3ddc964407199620232f810307f7dc3eb2e52673a4e66198cae882117d0ca865

See more details on using hashes here.

File details

Details for the file thetadatadx-1.2.4-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for thetadatadx-1.2.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 420728fbd50d3477d53617844c62ec54b114b3521d251a6b553a1510b5ba4ca7
MD5 dc19ad8ffa7d36dac6c949c39f7a5b41
BLAKE2b-256 2b5ac394708c78801ab8018e482020d037c120095bcfb637c1b28e0f8572463c

See more details on using hashes here.

File details

Details for the file thetadatadx-1.2.4-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for thetadatadx-1.2.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 fcd171f9a09f43ac2232ff29e28a2be2d396c671d3d18ed1844429b3a4d1a605
MD5 fb87a4f285236b39b4cdcf3442598864
BLAKE2b-256 1bdc0398fa469ceb1ce13927a2a0062c99985efd8399c4b0abd44f237e13dd8d

See more details on using hashes here.

File details

Details for the file thetadatadx-1.2.4-cp312-cp312-manylinux_2_38_x86_64.whl.

File metadata

File hashes

Hashes for thetadatadx-1.2.4-cp312-cp312-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 bd644415fd4358efa30b89946ee80f25e4f60f0214bbeff3f981b3decade7ed3
MD5 06cc016b8ca127b4f72cc8af111d2d29
BLAKE2b-256 faeb206fb5916a72956b50caa7fd8956221f71b32fd9ba171f092fa6faca0db8

See more details on using hashes here.

File details

Details for the file thetadatadx-1.2.4-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for thetadatadx-1.2.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 98552b6a8156c8fa0d7a11361c899e7523574f60d875ade59726a3661e22af59
MD5 61898eb56f5c366551166542cf155b3f
BLAKE2b-256 24c7547813a98130f4c38ab0e91eaa1729e79e9ac34ddaf5b29006dad1e02f00

See more details on using hashes here.

File details

Details for the file thetadatadx-1.2.4-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for thetadatadx-1.2.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 9ef03df370bc2aefa1a23e3b8dca38f8a6b53ae43d440718f6aaeac100df0a97
MD5 2e50fbf2831817369fdd1018f3fcfe8b
BLAKE2b-256 5a79d1c27baf6953a3eb375db79423a9342b0223d1033ef7c9e006654402afff

See more details on using hashes here.

File details

Details for the file thetadatadx-1.2.4-cp311-cp311-manylinux_2_38_x86_64.whl.

File metadata

File hashes

Hashes for thetadatadx-1.2.4-cp311-cp311-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 6b4ab532f07690db84fb0962d3e38a1db282c9c73df86bf3410c98ed69aa2391
MD5 e6b3c3774f9e8fd91bc6b695f9a44594
BLAKE2b-256 970312f2483d363cdb3f3afa6ef6e7ead138dddf950552d4f699b6b638c348b9

See more details on using hashes here.

File details

Details for the file thetadatadx-1.2.4-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for thetadatadx-1.2.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c48b649110a2b7f84c34be66c4a73a394e91bae93068ea3c379e2c4ed20d49fd
MD5 e2fbcb5455989a8546d65e7dce44afa8
BLAKE2b-256 f156ece0c9102520e532e008e03f77b4509a298e0515a46ee33d18ead45a6b78

See more details on using hashes here.

File details

Details for the file thetadatadx-1.2.4-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for thetadatadx-1.2.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1f43d933669da65c799b3285b090bacb9a3a2d91586a009177c013951d18f26c
MD5 183a366a17a93aa8e8fe9bbd1489283e
BLAKE2b-256 c29c953d4cd59d9a12d7ebbcf5e9588de20d67fe0b0fb9e0ada33a65a655736d

See more details on using hashes here.

File details

Details for the file thetadatadx-1.2.4-cp310-cp310-manylinux_2_38_x86_64.whl.

File metadata

File hashes

Hashes for thetadatadx-1.2.4-cp310-cp310-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 9eb70664ca693e24231ce314227008fbffee7ceb4d0baf169e44356e2c47e0d2
MD5 960c4d93c078cf9fc3484426d4b9fd77
BLAKE2b-256 f28cfa396d45b33eb2d0fc2743311b657f38652abc299fd2a2f073b4722e00a0

See more details on using hashes here.

File details

Details for the file thetadatadx-1.2.4-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for thetadatadx-1.2.4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0fc6cbf88a0c73723fba9a8dbc5851e5dddbb155f4f75b22983bfb80f54439e7
MD5 c2b06fd58799fc8ac2a038d747b8d763
BLAKE2b-256 8d8d608adf3bae65c8d1e2e25c91f48c567900c3ab0b3aa36483ec6a9f68fdba

See more details on using hashes here.

File details

Details for the file thetadatadx-1.2.4-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: thetadatadx-1.2.4-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 4.5 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for thetadatadx-1.2.4-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 890b04588ede0b7c71f870b9cef4005b4b68bdeee18b925a1f2f4eb80c0bb2af
MD5 7e26ba995b14cf498f1c681f862705d2
BLAKE2b-256 3c072628a57a78f1b21c82cdbd0a5b3b086af9841e32cd0d1b5c9f1127f3d595

See more details on using hashes here.

File details

Details for the file thetadatadx-1.2.4-cp39-cp39-manylinux_2_38_x86_64.whl.

File metadata

File hashes

Hashes for thetadatadx-1.2.4-cp39-cp39-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 2834908f381a140b30bff6a8a38eb71c899e7177bbfa3cf46c409affd660bbf4
MD5 cc0ae42bb378be5e3aa1775a014111a8
BLAKE2b-256 ffe274fbd1a44ae65c46fdb688c56d6f295982598fe7eca6ef55d714feeff982

See more details on using hashes here.

File details

Details for the file thetadatadx-1.2.4-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for thetadatadx-1.2.4-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9d1afae34df48dd89c05098b08baba6ed2982261b2b22b262fd163f05bc4d1ca
MD5 90997e0ff51fd94372c74640787204f5
BLAKE2b-256 bc3e658e9e50d5c17ecc177803e8bd035d220419f59b3abe0534120f2129beb6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page