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).

Important — Legal & Non-Affiliation Notice: xoms-rs and pyxoms are independent open-source software projects with no affiliation, endorsement, or sponsorship from Primary S.A., A3 Mercados (Matba Rofex), or BYMA.

  • Market Data Only (0.1.x): Order routing is intentionally omitted in the MVP.
  • Bring Your Own Credentials: Users are solely responsible for complying with their broker/ALyC terms, exchange market data licensing, and Primary homologation requirements.
  • Zero Real Market Data: This repository strictly forbids committing or pasting real exchange quotes, catalogs, tokens, or account numbers.

Installation

pip install pyxoms
# or with uv
uv add 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 --group 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 --group 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.3 (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.3

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.3
File Size Uploaded Provenance Actions
pyxoms-0.1.3.tar.gz 138.6 kB With provenance Details for pyxoms-0.1.3.tar.gz

Built distributions (wheels)

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

Total release size: 15.0 MB

Release files / pyxoms-0.1.3.tar.gz

Download URL pyxoms-0.1.3.tar.gz
Size 138.6 kB
Tags Source
SHA-256 checksum
How to use checksums
de7986482654fb0873137ef98bad7d8b19cb12b31029686567d456730209aa82
BLAKE2b-256 checksum
How to use checksums
d75f2a4e054a79d4f52d1d61bcd0f44aba897bd6768e9fa53ef748e82bb63323
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.3-cp312-abi3-win_amd64.whl

Download URL pyxoms-0.1.3-cp312-abi3-win_amd64.whl
Size 2.9 MB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
d03aa31cc78ddfa70df56fef5941f3832761762126b2fd884060e4c8d8c00c15
BLAKE2b-256 checksum
How to use checksums
3f60ee805644d1fb6ba31627d2d8903b59d0c61eafb8752ed7a1be3036f33192
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.3-cp312-abi3-manylinux_2_28_x86_64.whl

Download URL pyxoms-0.1.3-cp312-abi3-manylinux_2_28_x86_64.whl
Size 3.1 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
a93f195bf0f271bbee7152e5b8e56b255e768f1a0897912ac018fe5c80f67464
BLAKE2b-256 checksum
How to use checksums
aa6d96a27959e64537b1824d32a46a328557271a032cd0546c02231947a16254
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.3-cp312-abi3-manylinux_2_28_aarch64.whl

Download URL pyxoms-0.1.3-cp312-abi3-manylinux_2_28_aarch64.whl
Size 2.9 MB
Tags CPython 3.12 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
adacbbfb6b9e570084dfa432efa35f16aab0d5ed41744666918d4dd05d400cd1
BLAKE2b-256 checksum
How to use checksums
c2fbdcb144768a0ed239bd76f5e2ddad50d23d2e2c8446cba171fb5ce299909f
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.3-cp312-abi3-macosx_11_0_arm64.whl

Download URL pyxoms-0.1.3-cp312-abi3-macosx_11_0_arm64.whl
Size 2.9 MB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
02c5c052c7d3fe1a07fcd18164c41a832a7a84fd45f650f33d152ed0a3c9db47
BLAKE2b-256 checksum
How to use checksums
e403ae0bc52bad808727bc12c8faa564e60e02e1558551cfb9c142dfa3f19340
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.3-cp312-abi3-macosx_10_12_x86_64.whl

Download URL pyxoms-0.1.3-cp312-abi3-macosx_10_12_x86_64.whl
Size 3.0 MB
Tags CPython 3.12 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
315800e7fef4939f593f0154c3db7e633f7580e336d5ee2fd5e5e055f8c6080d
BLAKE2b-256 checksum
How to use checksums
cd03976eebf75dc06f7445d913ab51008795d9427aee266be7f755d9e636f357
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.3

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.3.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