Works with Gemini

From @openapiv3.yaml to a working options pull.

Gemini can read our OpenAPI spec directly and connect to the same MCP server Claude uses. Ground it once, then ask for stocks, options, and index data in plain English.

No credit card required · free tier included · options, stocks, indices & rates
zsh — gemini

$ gemini

> @openapiv3.yaml Using this spec and the Theta Data Python library, write code for SPX 0DTE call greeks at 3:45pm ET

reading openapiv3.yaml · 1 file …

✓ wrote spx_0dte_greeks.py — checked against option/history/greeks/eod

Two ways to ground it

Give Gemini the real spec, or connect it live.

Both cut hallucinated methods to nearly zero — use whichever fits the moment.

Reference the spec directly

In the Gemini CLI, pull the whole schema into context with @openapiv3.yaml, then ask your question. Gemini checks endpoints and parameters against the real file instead of guessing.

Connect the MCP server

For a quick number instead of a script — "AAPL 0DTE call Greeks at 3:45pm ET" — connect once and ask in plain English. Setup below.

Copy, paste, run

Everything you need, in the format you'll actually use.

Prompts to paste into Gemini, plus the Python, SDK, notebook, and REST snippets it should produce — pre-verified against the current library.

Quick-start template

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.

Anchor to a known-good call

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 error handling

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, then simplify

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]

Paste any of these into the Gemini app, Gemini CLI, or AI Studio.
Prefer notebooks? Every example above drops straight into a Google Colab cell — !pip install thetadata, paste your key, go.

Native integration

Connect the MCP server

Five minutes, once, and every future question skips the boilerplate.

  1. Install Gemini CLI

    The CLI that can read local files and connect to MCP servers.

    npm install -g @google/gemini-cli
  2. 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.

  3. Edit your Gemini CLI settings

    Add ThetaData to ~/.gemini/settings.json:

    {
        "mcpServers": {
            "Theta Data": {
                "url": "http://127.0.0.1:25503/mcp/sse",
                "timeout": 30000
            }
        }
    }
  4. Verify the connection

    Inside the Gemini CLI, run /mcp and confirm Theta Data shows as connected.

  5. Ask naturally

    Be explicit: real ticker symbols, ISO dates (YYYY-MM-DD), call/put spelled out rather than C/P, and strikes as decimals.

Every strategy is only as good as its data.

Free tier available — no credit card to start pulling data.