Skip to main content

xoms-rs

An unofficial, high-reliability market data client compatible with Primary API / xOMS endpoints, built with a pure Rust core (xoms-core) and ABI3 Python bindings (pyxoms).

Key Features

  • Memory-safe Rust core + pure rustls: #![forbid(unsafe_code)] in xoms-core, HTTPS-only REST (redirects disabled), wss://-only WebSockets, and openssl-sys banned via cargo-deny.
  • GIL-releasing Python ABI3 (>=3.12): Background Tokio WebSocket actor, single-wheel ABI3 compatibility across Python 3.12–3.14, and frozen Python objects.
  • Financial precision: Exact rust_decimal::Decimal / decimal.Decimal for prices, sizes, and volumes (never f64), plus UTC timestamps/dates.
  • Market structure correctness: Preserves separate BYMA settlements (CI, 24hs, 48hs) in BymaSettlementQuotes, supports BymaOther suffixes (72hs, T0, T1, T2, CN, PL), models PESOS / DOLAR / CABLE caucion term curves (1..=365 days), and enforces strict outbound smd key ordering (type first, symbol before marketId).
  • Resilient Sans-I/O WebSocket engine: Zero-f64 exponential backoff+jitter, 50-minute monotonic /auth/getToken TTL refresh, heartbeat/idle checks, stateful field-merging Conflator, and anti-batch-poisoning symbol pruning.

Quick Usage (Python asyncio)

import asyncio
from pyxoms import InstrumentCatalog, MarketDataClient, XomsConfig


async def main() -> None:
    # Reads XOMS_ENV (REMARKET | LIVE | LIVE:<BROKER>), XOMS_API_URL, XOMS_WS_URL, XOMS_USER, XOMS_PASSWORD
    cfg = XomsConfig.from_env()
    client = MarketDataClient(cfg)

    # Fetch and cache the catalog losslessly without rebuilding dicts in Python
    catalog = await client.fetch_catalog()
    cached_json = catalog.to_json()
    reloaded = InstrumentCatalog.parse_json(cached_json)
    print(f"Loaded {len(reloaded)} instruments")

    # Conflated WebSocket stream (example synthetic symbols)
    async with client.stream(["MERV - XMEV - SYNA - 24hs", "MERV - XMEV - PESOS - 1D"]) as stream:
        dirty = await stream.wait_dirty(timeout_ms=2_000)
        for quote in dirty:
            bid = quote.best_bid.price if quote.best_bid else None
            print(quote.instrument.symbol, bid)

        byma = stream.byma_settlements("SYNA")
        pesos_curve = stream.caucion_curve("PESOS")
        print(byma.t24h, pesos_curve.shortest())


asyncio.run(main())

Quick Path

Prerequisites: Rust stable (rustfmt, clippy), cargo-deny, and uv (Python >= 3.12).

# 1. Verify the Rust workspace
cargo test --workspace
cargo clippy --workspace --all-targets -- -D warnings
cargo deny check

# 2. Build the local Python extension (with offline testing feature) and run Python checks
uv sync --extra dev --no-install-project
uv run --no-sync maturin develop --features testing
uv run --no-sync ruff check . && uv run --no-sync ruff format --check .
uv run --no-sync mypy
uv run --no-sync pytest -q
uv run --no-sync python examples/adapter_pattern.py

# 3. Run offline synthetic benchmarks
cargo bench -p xoms-core --bench market_data_bench -- --warm-up-time 0.2 --measurement-time 0.5
uv run --no-sync python benchmarks/bench_pyxoms.py
uv run --no-sync python benchmarks/compare_pure_python.py

# 4. Mirror CI locally across Rust + Python 3.12 & 3.14 (committed HEAD)
./scripts/ci-local.sh

# 5. Optional manual reMarkets smoke check (outside CI; requires local .env with XOMS_ENV=REMARKET)
cargo test -p xoms-core --test remarkets_smoke -- --ignored --nocapture
uv run python examples/remarkets_smoke.py

Building a Wheel

uv sync --extra dev
uv run maturin build --release --out dist
uv pip install dist/pyxoms-*.whl

Synthetic Benchmark Snapshot

Measured offline via uv run python benchmarks/compare_pure_python.py on Linux x86_64 (CPython 3.14, --release ABI3 wheel) against an equivalent pure-Python baseline (stdlib json + Decimal):

Workload (100% synthetic) Pure Python (json + Decimal) pyxoms (Rust ABI3) Improvement
Catalog parse (1,600 instruments ×10) 7.20 ms median 2.72 ms median 2.6x faster
Batch parse + conflate (20k msgs) 114,991 msg/s 489,031 msg/s 4.3x throughput
Async burst & event-loop jitter (10k frames) 112,874 msg/s (p99 196.3 µs) 372,305 msg/s (p99 2.1 µs) 3.3x (max_stall 0.21 ms → 0.04 ms)
Python heap peak (tracemalloc, 10k frames) 79.0 KiB 24.7 KiB 3.2x smaller

Architecture

Component Role Stack
crates/xoms-core Pure Rust domain types, config guards, protocol codecs, and transport traits Rust (rustls, #![forbid(unsafe_code)])
crates/pyxoms Thin PyO3 ABI3 (>=3.12) FFI layer releasing the GIL Rust (pyo3) + maturin
python/pyxoms Typed Python package with PEP 561 .pyi stubs Python >= 3.12

See ADR 0001 for the rationale behind the workspace split, TLS backend, and financial precision choices.

Environment Profiles & Stream Scope

  • Fail-closed Environment profiles: XomsConfig / XOMS_ENV accepts only "REMARKET", "LIVE", or "LIVE:<BROKER>" (e.g. "LIVE:ECO"). Unprefixed broker names (such as "ECO") are rejected so mistyped configs never route silently to live endpoints.
  • Conflated stream (0.1.x): Conflator and MarketDataStream conflate deltas per instrument in Rust outside the Python GIL for low jitter and heap pressure; lossless tick-by-tick streaming (MarketDataMessage) is planned for v0.2.0.

Roadmap

  • Stage 0 (Done): OSS governance, dual license, cargo-deny, CI parity (scripts/ci-local.sh), workspace skeleton, and AI integration layer.
  • Stage 1 (Done): Domain & protocol (config environment guards, SecretString, Clock, BymaSettlementQuotes, strict smd field ordering, dual Md parser with rust_decimal and jiff::Timestamp, and status: ERROR missing-product parser).
  • Stage 2 (Done): Async REST client (auth /auth/getToken with 50m monotonic TTL, ReqwestTransport over rustls, InstrumentCatalog, and RestClient with 401 refresh and bounded retries).
  • Stage 3 (Done): Sans-I/O WebSocket engine (WsEngine / WsClient), WsTransport + TungsteniteTransport (rustls) / FakeWsTransport, zero-f64 backoff+jitter, caucion term-curve domain, stateful field-merging Conflator, and anti-batch-poisoning isolation.
  • Stage 4 & v0.1.2 (Current): Full pyxoms ABI3 async/conflated Python API (MarketDataClient, background-Tokio MarketDataStream, frozen Decimal/UTC domain objects, lazy cancel-safe asyncio bridge), criterion/Python benchmarks, CABLE cauciones, BymaOther suffixes, configurable WsConfig.subscription_entries, lossless InstrumentCatalog.to_json(), single-pass conflation, cancel-safe WsClient, structured Python error attributes, and production ABI3 PyPI packaging.
  • v0.2.0 (Planned): Optional lossless tick-by-tick stream mode (MarketDataMessage delivery alongside conflated snapshots).

AI-Friendly Integration

If you are using an AI coding agent to integrate xoms-rs or pyxoms into another repository:

License

Dual-licensed under MIT OR Apache-2.0 (LICENSE-MIT, LICENSE-APACHE).

Documentación en español disponible en README.es.md.

Metadata

Release files for pyxoms 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyxoms 0.1.2
File Size Uploaded Provenance Actions
pyxoms-0.1.2.tar.gz 138.6 kB With provenance Details for pyxoms-0.1.2.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pyxoms 0.1.2
File Actions
pyxoms-0.1.2-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details for pyxoms-0.1.2-cp312-abi3-win_amd64.whl
pyxoms-0.1.2-cp312-abi3-manylinux_2_28_x86_64.whl CPython 3.12 abi3 Linux glibc 2.28+ x86-64 Details for pyxoms-0.1.2-cp312-abi3-manylinux_2_28_x86_64.whl
pyxoms-0.1.2-cp312-abi3-manylinux_2_28_aarch64.whl CPython 3.12 abi3 Linux glibc 2.28+ ARM64 Details for pyxoms-0.1.2-cp312-abi3-manylinux_2_28_aarch64.whl
pyxoms-0.1.2-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details for pyxoms-0.1.2-cp312-abi3-macosx_11_0_arm64.whl
pyxoms-0.1.2-cp312-abi3-macosx_10_12_x86_64.whl CPython 3.12 abi3 macOS 10.12+ x86-64 Details for pyxoms-0.1.2-cp312-abi3-macosx_10_12_x86_64.whl

Total release size: 17.5 MB

Release files / pyxoms-0.1.2.tar.gz

Download URL pyxoms-0.1.2.tar.gz
Size 138.6 kB
Tags Source
SHA-256 checksum
How to use checksums
272529252d03cc648cf87b7e9cd1995ee6c2cb03c623bc1394eb66702d0a8d89
BLAKE2b-256 checksum
How to use checksums
4aa2896afbb65c3770feb291356520c34c161e81528a2406e5ba10b0c19b765e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Release files / pyxoms-0.1.2-cp312-abi3-win_amd64.whl

Download URL pyxoms-0.1.2-cp312-abi3-win_amd64.whl
Size 3.0 MB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
e1cce287efb20592b5ea4e0c78dbd637c701038d7d6f3124269c4afd687c75c7
BLAKE2b-256 checksum
How to use checksums
17d276fade03a6581774325ecccee66e000cf601a2dee0c6ee6a09fb71122b90
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Release files / pyxoms-0.1.2-cp312-abi3-manylinux_2_28_x86_64.whl

Download URL pyxoms-0.1.2-cp312-abi3-manylinux_2_28_x86_64.whl
Size 3.7 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
77d9fd5c757e8897c8e0f7b6898b533c6ffb4514c9402a6f53c3e3f1777620c7
BLAKE2b-256 checksum
How to use checksums
335f1398cc420922dbefbe9828668d4c5e5d459ac486a47c828b1ca417e3d7db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Release files / pyxoms-0.1.2-cp312-abi3-manylinux_2_28_aarch64.whl

Download URL pyxoms-0.1.2-cp312-abi3-manylinux_2_28_aarch64.whl
Size 3.7 MB
Tags CPython 3.12 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
34edb47c9c9fbbc1beb9f1287c2f67eb594c0199122e32b6131e75fb4190810a
BLAKE2b-256 checksum
How to use checksums
844cb0cd761f4cfc57d03a391d9debf7f6bb85b7de91bc499b3a0907f5f7e28f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Release files / pyxoms-0.1.2-cp312-abi3-macosx_11_0_arm64.whl

Download URL pyxoms-0.1.2-cp312-abi3-macosx_11_0_arm64.whl
Size 3.4 MB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1262fe70eb7dcbc3fb80f7870659e709f6a0af584c2801a50080170dc5639f24
BLAKE2b-256 checksum
How to use checksums
539a2ebdcca93a59ba1a1fa978415f85f1a57348c8a07c8f61c9dd0b12d1a1a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Release files / pyxoms-0.1.2-cp312-abi3-macosx_10_12_x86_64.whl

Download URL pyxoms-0.1.2-cp312-abi3-macosx_10_12_x86_64.whl
Size 3.5 MB
Tags CPython 3.12 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
ce1f1aaa9b36503ad300c1981ef5df588d8708a9d81f29829561aded94136c21
BLAKE2b-256 checksum
How to use checksums
8621d90c2dd46a1613948df38b8afcd16e0695156726a6f831b48c1794021e7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Security for pyxoms 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for pyxoms-0.1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page