Skip to main content

OpenStat SDK for AI trading agent telemetry

Project description

openstat Python SDK

Python helpers for sending native OpenStat telemetry from AI trading agents.

pip install openstat-sdk

Add editable starter files to an existing Python project:

openstat init

This creates .env.openstat.example, openstat_integration.py, and OPENSTAT.md in the current directory. Existing files are preserved unless you run openstat init --force.

from openstat import OpenStatClient

client = OpenStatClient(
    api_key="ostat_...",
    endpoint="https://api.openstat.online",
    service_name="paper-trader",
    environment="production",
)

run = client.start_agent_run(strategy="breakout")

client.record_run_lifecycle(
    run_id=run["run_id"],
    agent={"id": "agent-1", "name": "Paper Trader"},
    status="running",
    strategy="breakout",
    symbols=["BTC-USD"],
    summary="Run started.",
)

client.record_decision(
    run_id=run["run_id"],
    agent={"id": "agent-1", "name": "Paper Trader"},
    strategy="breakout",
    symbol="BTC-USD",
    venue="paper",
    action="enter_long",
    confidence=82,
    rationale_summary="Momentum and risk budget aligned.",
)

client.record_run_lifecycle(
    run_id=run["run_id"],
    agent={"id": "agent-1", "name": "Paper Trader"},
    status="completed",
    strategy="breakout",
    symbols=["BTC-USD"],
    summary="Run completed.",
)

endpoint defaults to https://api.openstat.online. Set OPENSTAT_ENDPOINT=http://localhost:4000 only when sending telemetry to a local OpenStat API during development.

Use record_run_lifecycle(status="completed") or record_run_lifecycle(status="failed") to settle the matching run on the OpenStat Runs dashboard. Lifecycle events share the same run_id as decisions, risk checks, orders, fills, positions, and PnL snapshots.

Use create_opentelemetry_http_config to get OTLP/HTTP endpoints and headers for traces, logs, and metrics exporters.

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

openstat_sdk-0.2.1.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

openstat_sdk-0.2.1-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file openstat_sdk-0.2.1.tar.gz.

File metadata

  • Download URL: openstat_sdk-0.2.1.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for openstat_sdk-0.2.1.tar.gz
Algorithm Hash digest
SHA256 5112a92095ce378bee1296182c0fae06624b8aad9e41d376f9aaba2320744f1c
MD5 0b9ff249bf51988bdb09ca685f988b43
BLAKE2b-256 e4edf78424f3d308597a6da6b25e18980f67d7acefde05f241f4828e972c049b

See more details on using hashes here.

Provenance

The following attestation bundles were made for openstat_sdk-0.2.1.tar.gz:

Publisher: workflow.yml on kezuflow/openstat

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file openstat_sdk-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: openstat_sdk-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for openstat_sdk-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 001044fd5b404ba565ac21951f59d499d4b804d701412768cab85e9fc9fc4a72
MD5 a395e2bffba957f8d70b7cf07e6a4257
BLAKE2b-256 a24909f9d3181538a32169737db878591ab788149535dc6733182eed09336ebe

See more details on using hashes here.

Provenance

The following attestation bundles were made for openstat_sdk-0.2.1-py3-none-any.whl:

Publisher: workflow.yml on kezuflow/openstat

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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