Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "qtsurfer-api-client"
version = "0.99.1"
version = "0.99.2"
description = "Auto-generated Python client for the QTSurfer API."
readme = "README.md"
license = "Apache-2.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from ...client import AuthenticatedClient, Client
from ...models.backtest_job_result import BacktestJobResult
from ...models.data_source_type import DataSourceType
from ...models.get_backtest_result_response_202 import GetBacktestResultResponse202
from ...models.response_error import ResponseError
from ...types import Response

Expand All @@ -32,12 +33,17 @@ def _get_kwargs(

def _parse_response(
*, client: AuthenticatedClient | Client, response: httpx.Response
) -> BacktestJobResult | ResponseError | None:
) -> BacktestJobResult | GetBacktestResultResponse202 | ResponseError | None:
if response.status_code == 200:
response_200 = BacktestJobResult.from_dict(response.json())

return response_200

if response.status_code == 202:
response_202 = GetBacktestResultResponse202.from_dict(response.json())

return response_202

if response.status_code == 400:
response_400 = ResponseError.from_dict(response.json())

Expand All @@ -56,7 +62,7 @@ def _parse_response(

def _build_response(
*, client: AuthenticatedClient | Client, response: httpx.Response
) -> Response[BacktestJobResult | ResponseError]:
) -> Response[BacktestJobResult | GetBacktestResultResponse202 | ResponseError]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
Expand All @@ -71,12 +77,16 @@ def sync_detailed(
job_id: str,
*,
client: AuthenticatedClient,
) -> Response[BacktestJobResult | ResponseError]:
) -> Response[BacktestJobResult | GetBacktestResultResponse202 | ResponseError]:
"""Get the result of a backtest execution job

Retrieves the current state and results of the execute job identified by `jobId`.
Poll until `state.status` is `Completed`, `Failed`, or `Aborted`.

A `202` means the result is not readable yet — keep polling. It is never a terminal
outcome, and it carries no `state`, so a poll loop that stops on a terminal status will
not stop on it.

Args:
exchange_id (str): Example: binance.
type_ (DataSourceType): Managed exchange data sources available for backtesting. Example:
Expand All @@ -88,7 +98,7 @@ def sync_detailed(
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[BacktestJobResult | ResponseError]
Response[BacktestJobResult | GetBacktestResultResponse202 | ResponseError]
"""

kwargs = _get_kwargs(
Expand All @@ -110,12 +120,16 @@ def sync(
job_id: str,
*,
client: AuthenticatedClient,
) -> BacktestJobResult | ResponseError | None:
) -> BacktestJobResult | GetBacktestResultResponse202 | ResponseError | None:
"""Get the result of a backtest execution job

Retrieves the current state and results of the execute job identified by `jobId`.
Poll until `state.status` is `Completed`, `Failed`, or `Aborted`.

A `202` means the result is not readable yet — keep polling. It is never a terminal
outcome, and it carries no `state`, so a poll loop that stops on a terminal status will
not stop on it.

Args:
exchange_id (str): Example: binance.
type_ (DataSourceType): Managed exchange data sources available for backtesting. Example:
Expand All @@ -127,7 +141,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
BacktestJobResult | ResponseError
BacktestJobResult | GetBacktestResultResponse202 | ResponseError
"""

return sync_detailed(
Expand All @@ -144,12 +158,16 @@ async def asyncio_detailed(
job_id: str,
*,
client: AuthenticatedClient,
) -> Response[BacktestJobResult | ResponseError]:
) -> Response[BacktestJobResult | GetBacktestResultResponse202 | ResponseError]:
"""Get the result of a backtest execution job

Retrieves the current state and results of the execute job identified by `jobId`.
Poll until `state.status` is `Completed`, `Failed`, or `Aborted`.

A `202` means the result is not readable yet — keep polling. It is never a terminal
outcome, and it carries no `state`, so a poll loop that stops on a terminal status will
not stop on it.

Args:
exchange_id (str): Example: binance.
type_ (DataSourceType): Managed exchange data sources available for backtesting. Example:
Expand All @@ -161,7 +179,7 @@ async def asyncio_detailed(
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[BacktestJobResult | ResponseError]
Response[BacktestJobResult | GetBacktestResultResponse202 | ResponseError]
"""

kwargs = _get_kwargs(
Expand All @@ -181,12 +199,16 @@ async def asyncio(
job_id: str,
*,
client: AuthenticatedClient,
) -> BacktestJobResult | ResponseError | None:
) -> BacktestJobResult | GetBacktestResultResponse202 | ResponseError | None:
"""Get the result of a backtest execution job

Retrieves the current state and results of the execute job identified by `jobId`.
Poll until `state.status` is `Completed`, `Failed`, or `Aborted`.

A `202` means the result is not readable yet — keep polling. It is never a terminal
outcome, and it carries no `state`, so a poll loop that stops on a terminal status will
not stop on it.

Args:
exchange_id (str): Example: binance.
type_ (DataSourceType): Managed exchange data sources available for backtesting. Example:
Expand All @@ -198,7 +220,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
BacktestJobResult | ResponseError
BacktestJobResult | GetBacktestResultResponse202 | ResponseError
"""

return (
Expand Down
2 changes: 2 additions & 0 deletions src/qtsurfer/api/client/_generated/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from .execute_sweep_result_objective import ExecuteSweepResultObjective
from .execute_sweep_result_order import ExecuteSweepResultOrder
from .execute_sweep_result_status import ExecuteSweepResultStatus
from .get_backtest_result_response_202 import GetBacktestResultResponse202
from .get_strategy_response_200 import GetStrategyResponse200
from .get_strategy_response_200_status import GetStrategyResponse200Status
from .get_sweep_result_objective import GetSweepResultObjective
Expand Down Expand Up @@ -85,6 +86,7 @@
"ExecuteSweepResultObjective",
"ExecuteSweepResultOrder",
"ExecuteSweepResultStatus",
"GetBacktestResultResponse202",
"GetStrategyResponse200",
"GetStrategyResponse200Status",
"GetSweepResultObjective",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from __future__ import annotations

from collections.abc import Mapping
from typing import Any, TypeVar

from attrs import define as _attrs_define

T = TypeVar("T", bound="GetBacktestResultResponse202")


@_attrs_define
class GetBacktestResultResponse202:
""" """

def to_dict(self) -> dict[str, Any]:

field_dict: dict[str, Any] = {}

return field_dict

@classmethod
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
get_backtest_result_response_202 = cls()

return get_backtest_result_response_202
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading