From a plain-English question to a DataFrame.
Theta Data ships an MCP server, and Claude Code speaks MCP natively. Connect once, then ask for Greeks, OHLC bars, or a full chain — no request object to hand-write.
$ claude mcp add --transport sse ThetaData http://127.0.0.1:25503/mcp/sse
✓ Added ThetaData (sse) · 127.0.0.1:25503
> Get AAPL 200C 8/1/25 EOD greeks, Jul 28 to Aug 1
[ThetaData MCP] running option/history/greeks/eod …
5 rows · AAPL 200C 2025-08-01 · delta 0.482 → 0.553, iv 0.214 → 0.198
Two ways in
Pick the path that matches the question you're asking.
Claude has two genuinely different ways to reach Theta Data — use whichever fits the moment.
MCP, for a quick answer
Connect the server once and ask in plain English — "AAPL 0DTE call Greeks at 3:45pm ET" — when you want a number, not a script.
The Python library, for reusable code
When the output is a backtest, a notebook, or a script you'll run again, ask Claude to write it against ThetaClient instead.
Copy, paste, run
Everything you need, in the format you'll actually use.
Prompts to paste into Claude, plus the Python, SDK, notebook, and REST snippets it should produce — pre-verified against the current library.
Using the current Theta Data Python library from PyPI, write complete, executable Python code to [describe the task]. Use [symbol(s)], [date/time range], [interval], and [required fields]. Return the result as a pandas DataFrame and [save / plot / transform it]. Use only officially supported methods, state your authentication assumptions, handle AuthenticationError and NoDataFoundError, validate the returned schema, avoid pseudo-code, and explain each section.
Here is a known-good request using the Theta Data Python library: client.stock_history_eod(symbol="AAPL", start_date=date(2024,1,2), end_date=date(2024,1,5)) It returns a DataFrame with columns created, last_trade, open, high, low, close, volume (plus bid/ask fields). Using this exact pattern, write a call that pulls 5-minute OHLC bars for TSLA over the same date range.
Add explicit handling for AuthenticationError and NoDataFoundError (both from thetadata.errors) to the function below, without changing its return type or output columns: [paste your function]
Explain what each section of this script does line by line, then rewrite it in the simplest possible form while keeping the same behavior and output columns: [paste your script]
# Written with Claude, run locally after a quick read-through from datetime import date from thetadata import ThetaClient from thetadata.errors import AuthenticationError, NoDataFoundError client = ThetaClient(dataframe_type="pandas") try: eod = client.stock_history_eod( symbol="AAPL", start_date=date(2024, 1, 2), end_date=date(2024, 1, 31), ) except AuthenticationError: raise SystemExit("Check THETADATA_API_KEY and try again.") except NoDataFoundError: raise SystemExit("No data returned for this symbol/date range.") print(eod.head()) eod.plot(x="last_trade", y="close", title="AAPL — January 2024")
from thetadata import ThetaClient # Option 1 — environment variable (recommended) # export THETADATA_API_KEY="your_api_key_here" client = ThetaClient(dataframe_type="pandas") # Option 2 — pass the key directly client = ThetaClient(api_key="your_api_key_here", dataframe_type="pandas") # Option 3 — email + password via ./creds.txt # line 1: email, line 2: password client = ThetaClient(email="you@yourfirm.com", password="your-password") # dataframe_type defaults to "polars" — pass "pandas" if that's your stack. # Get your key at thetadata.net/portal/api_key
| timestamp | delta | gamma | theta | vega | implied_vol |
|---|---|---|---|---|---|
| 2025-07-28 | 0.482 | 0.031 | -0.184 | 0.612 | 0.214 |
| 2025-07-29 | 0.501 | 0.033 | -0.176 | 0.598 | 0.209 |
| 2025-07-30 | 0.519 | 0.034 | -0.169 | 0.583 | 0.205 |
| 2025-07-31 | 0.536 | 0.035 | -0.161 | 0.567 | 0.201 |
| 2025-08-01 | 0.553 | 0.036 | -0.153 | 0.549 | 0.198 |
curl "http://localhost:25503/v3/stock/history/ohlc\ ?symbol=AAPL&start_date=2024-01-02&end_date=2024-01-05&interval=1m"
import httpx, csv BASE_URL = "http://localhost:25503/v3" params = {"symbol": "MSFT", "expiration": "*"} response = httpx.get(f"{BASE_URL}/option/snapshot/ohlc", params=params, timeout=60) response.raise_for_status() for row in csv.reader(response.text.split("\n")): print(row)
Native integration
Connect the MCP server
Five minutes, once, and every future question skips the boilerplate.
Install Claude Code
The CLI that speaks MCP natively. (It also ships inside the Claude desktop app, if you'd rather start there.)
npm install -g @anthropic-ai/claude-code
Launch Theta Terminal v3
Needs an active Theta Data subscription and Java 21+. Starting it also starts the MCP server, listening on
127.0.0.1:25503.Connect the server
One command, run once:
claude mcp add --transport sse ThetaData http://127.0.0.1:25503/mcp/sse
Verify the connection
Inside Claude Code, run
/mcpand confirm ThetaData shows as connected.Ask naturally
Be explicit: real ticker symbols, ISO dates (
YYYY-MM-DD), call/put spelled out rather thanC/P, and strikes as decimals. The more specific the ask, the fewer follow-up questions.
127.0.0.1), so this works the same whether Claude Code is running locally or over SSH into a box you control.Every strategy is only as good as its data.
Free tier available — no credit card to start pulling data.