The connector uses ThetaData API v2, which Theta Terminal v3 rejects with HTTP 410

Abierto
#20 0 comentarios 0 reacciones 0 asignados Ver en GitHub

@econstantin ya está trabajando en esto.

Desde el 28/10/2026.

  • #21 de @econstantin — abierto

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
csharp
Área
data

Línea de trabajo

Start by tracing ThetaDataRestApiClient.ApiVersion, the REST request models and v2 response converters, and the option chain provider; the issue names these as the affected areas but gives no file paths. Compare their behavior with the v3 paths, parameters, response format, status codes, and date limits described here. Reproduce against Theta Terminal v3, including the Free plan contract list denial. Done means history, downloads, backtests, research, and option chain retrieval work with v3; the issue reports an unmerged pull request with related changes and tests.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Expected Behavior

History requests, lean data download, backtests, and research return ThetaData data when Theta Terminal is running.

Actual Behavior

Every request fails. The connector calls API v2 (ThetaDataRestApiClient.ApiVersion = "/v2", default thetadata-rest-url http://127.0.0.1:25510). Theta Terminal v3 listens on port 25503 and answers every v2 path with:

HTTP 410
We have upgraded to API v3. Please use API v3 instead. Update your endpoint URLs to /v3/* format. Consult API v3 documentation for more information: https://thetadata.net/docs/

Changing the port and the version prefix is not enough. v3 also changed:

  • the paths, for example hist/option/eod is now option/history/eod, and list/contracts/option/quote is now option/list/contracts/quote;
  • the parameter names and units: root is now symbol, exp is now expiration, the strike is in dollars (470.000, not 470000), the right is call/put, and ivl (milliseconds) is now interval (1m, 1h);
  • the response: CSV by default, or JSON with format=json, with named fields and ISO timestamps instead of positional arrays. The header.next_page field is gone;
  • the plan denial: HTTP 403 with a text body;
  • the date range limits: 1 day for an interval under 1 minute, 1 month for 1 minute or more, and 365 days without an interval (HTTP 400 "Too many days between start and end date; max 365 days allowed").

So the v2 converters cannot parse any v3 response.

On the Free plan, option/list/contracts/* also returns HTTP 403 ("requiring a value subscription"), so the option chain provider gets no contracts even with a v3 URL. The end-of-day endpoint with expiration=* is allowed on the Free plan and lists the whole chain of a day.

The thetadata-rest-url default in the CLI module list is also the v2 port: http://host.docker.internal:25510.

Potential Solution

Move the REST client and models to v3: the v3 paths and parameters, format=json, typed row models, the v3 status codes, and the v3 date range limits. For the Free plan, list the option chain from the end-of-day report when the contract list is denied. Change the CLI module default of thetadata-rest-url to port 25503.

I have a branch with these changes and tests on recorded v3 responses, and can open a pull request.

Reproducing the Problem
  1. Start Theta Terminal v3 (java -jar ThetaTerminalv3.jar) and log in.
  2. Request any v2 path:
    curl -i "http://127.0.0.1:25510/v2/list/roots/option"
    curl -i "http://127.0.0.1:25503/v2/list/roots/option"
    
    The first fails to connect. The second returns HTTP 410 with the text above.
  3. The v3 path works:
    curl "http://127.0.0.1:25503/v3/stock/history/eod?symbol=SPY&start_date=20261020&end_date=20261020&format=json"
    
System Information
  • Windows 11, Docker Desktop, LEAN CLI, LEAN engine built from master of 2026-10-16
  • Theta Terminal v3, Free plan, checked on 2026-10-28
  • Connector at master d9e4e04
Checklist
  • I have completely filled out this template
  • I have confirmed that this issue exists on the current master branch
  • I have confirmed that this is not a duplicate issue by searching issues
  • I have provided detailed steps to reproduce the issue
Lenguaje dominante
C#
Estrellas
24
Forks
16
Merge medio
7 min
PR fusionados (30 d)
1

Preparar el entorno

  • Sin Dockerfile ni archivo de Docker Compose
  • Tiene una plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de QuantConnect/Lean.DataSource.ThetaData

Todos los issues de QuantConnect/Lean.DataSource.ThetaData

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.