Skip to main content

Python client for the public Grand Thera AIT API.

Project description

thera-os

Python client for the public Grand Thera AIT API.

The package wraps the public API endpoints for:

  • Neural SDE forecast: POST /api/v1/forecast/run
  • Regime analysis: POST /api/v1/regime/analyze
  • Regime dashboard scope: POST /api/v1/regime/scope
  • Symbolic regression: POST /api/v1/symbolic/fit
  • Symbolic prediction and scenarios
  • Dataset/file upload endpoints

Install

pip install thera-os

For local development:

git clone https://github.com/GrandThera/thera-os-python.git
cd thera-os-python
python -m pip install -e ".[dev]"
pytest

Quick Start

from thera_os import TheraOSClient

client = TheraOSClient()

prices = [5.12, 5.15, 5.11, 5.18, 5.21]

forecast = client.forecast_run(
    series=prices,
    steps=30,
    simulations=500,
    targets=[prices[-1] * 1.05],
)

regime = client.regime_analyze(
    prices=prices,
    window=2,
    n_regimes=2,
)

print(forecast["terminal_summary"])
print(regime["summary"])

By default the client uses:

https://api.thera-os.com/api/v1

Use another deployment by passing base_url:

client = TheraOSClient(base_url="http://localhost:8000/api/v1")

Upload Examples

from thera_os import TheraOSClient

client = TheraOSClient()

forecast = client.forecast_upload(
    "usdbrl.csv",
    steps=30,
    simulations=1000,
    targets=[5.60],
)

dataset = client.symbolic_upload(
    "dataset.xlsx",
    dependent="target",
    independents=["x1", "x2"],
)

Error Handling

from thera_os import TheraOSAPIError, TheraOSClient

client = TheraOSClient()

try:
    result = client.forecast_run(series=[1.0, 1.1, 1.2])
except TheraOSAPIError as exc:
    print(exc.status_code)
    print(exc.code)
    print(exc.message)

Publishing Checklist

  1. Create a public GitHub repository, for example GrandThera/thera-os-python.
  2. Update the URLs in pyproject.toml if the repository name changes.
  3. Confirm no private URLs, credentials, notebooks with secrets, .venv, .git, caches, or backend internals are committed.
  4. Run:
python -m pip install -e ".[dev]"
pytest
python -m build
  1. Publish when ready:
python -m twine upload dist/*

License

MIT

Project details


Download files

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

Source Distribution

thera_os-0.1.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

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

thera_os-0.1.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file thera_os-0.1.0.tar.gz.

File metadata

  • Download URL: thera_os-0.1.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for thera_os-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ee9682a63db6eeb8b61e16fcf8e4e2a13c34a17bea19f7ba52ece3ece80f9328
MD5 8e2e4228917f61bc35d268f996cbced9
BLAKE2b-256 a1dd97443e575db50dc67dc6abb981e9dbeb33206b8f090432f7c12ba717595b

See more details on using hashes here.

File details

Details for the file thera_os-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: thera_os-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for thera_os-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 698b295c226786fccb31e7e3d0d88989b6bd3fbfdb5d4f2ae82d4d3c93e7d64f
MD5 f53956c748fece454cdcdc2b3f35f5ed
BLAKE2b-256 faab25e77b121d82393276d4f408f4fb7abdf1aad3ef761937f2cba29523cf2d

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