Skip to main content

Canonical reference data for Money Ex Machina.

Project description

mxm-refdata

Version License Python Checked with pyright

Reference data and contract ontology for the Money Ex Machina (MXM) ecosystem.

mxm-refdata provides canonical, programmatic definitions of financial instruments and trading structures, currently focused on:

  • futures products,
  • futures contracts,
  • lifecycle rules,
  • trading calendars,
  • periods and period cycles,
  • and deterministic contract generation.

The package acts as the ontological reference layer for MXM systems such as mxm-v1.

Purpose

mxm-refdata defines what financial reference objects exist and how they are constructed.

For example, a futures contract such as:

cme_gbp_futures.Mar-2032

is treated as a deterministic construct derived from:

  • product specifications,
  • listing rules,
  • period systems,
  • and trading-calendar semantics.

This allows MXM systems to reason about financial structures independently of any specific market-data provider.

mxm-refdata therefore models the constructive ontology of financial instruments, while observed prices, trades, quotes, and exchange events belong to the separate market-observation layer (mxm-marketdata).

Architecture

mxm-refdata consists of four main layers:

  1. Reference specifications
    Human-authored product and lifecycle specifications bundled with the package.

  2. Deterministic generation
    Services that construct contracts, periods, lifecycle dates, and calendar relationships.

  3. Materialised reference store
    SQLite database containing generated products, contracts, periods, cycles, and lifecycle state.

  4. Query and inspection interfaces
    Typed Python API and operational CLI.

Installation

git clone https://github.com/moneyexmachina/mxm-refdata.git
cd mxm-refdata
poetry install

Usage

Build the local reference database:

mxm-refdata build

Rebuild from scratch:

mxm-refdata rebuild

Inspect products:

mxm-refdata products

Inspect contract coverage:

mxm-refdata coverage

Run operational smoke checks:

mxm-refdata smokecheck

Python API

from datetime import date

from mxm.refdata.api.ref_data_api import RefDataAPI

api = RefDataAPI()

products = api.get_all_products()

contracts = api.get_contracts_for_product(
    "comex_gold_futures"
)

active_contracts = api.get_active_contracts(
    as_of_date=date(2026, 5, 1),
)

Operating Modes

Buildable mode

In buildable mode, the reference database is treated as deterministic derived state.

If missing or empty, the package may automatically:

  • create the schema,
  • generate contracts,
  • and materialise the reference universe.

This mode supports:

  • development,
  • CI,
  • local experimentation,
  • and early-stage deployments.

Managed mode

Managed mode treats the reference database as governed operational state.

Updates occur explicitly through controlled management and reconciliation workflows.

Development

mxm-refdata is maintained as an mxm-foundry compliant package.

Primary development gate:

make check

Validate repository compliance:

mxm-foundry check .

Setup:

poetry install

Documentation

  • docs/design.md

Roadmap

v0

  • Futures product specifications
  • Deterministic futures contract generation
  • Trading calendar integration
  • Period and period-cycle models
  • Materialised SQLite reference store
  • Typed query API
  • Operational CLI and smoke checks
  • mxm-foundry compliance

v1

  • Broader futures product coverage
  • Stronger typed lifecycle-rule models
  • Explicit TradingCalendarId abstractions
  • Improved CLI inspection and filtering
  • Clearer ontology boundaries and documentation

v2

  • ETF and FX product support
  • Managed reference governance
  • Historical exchange rule evolution
  • External reconciliation workflows
  • Expanded multi-venue ontology
  • Integration boundaries with mxm-marketdata
  • Integration boundaries with future mxm-calendar

License

MIT License. See LICENSE.

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

mxm_refdata-0.3.0.tar.gz (38.6 kB view details)

Uploaded Source

Built Distribution

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

mxm_refdata-0.3.0-py3-none-any.whl (57.5 kB view details)

Uploaded Python 3

File details

Details for the file mxm_refdata-0.3.0.tar.gz.

File metadata

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

File hashes

Hashes for mxm_refdata-0.3.0.tar.gz
Algorithm Hash digest
SHA256 0696a120dbad9af12202af4a586223ff31289956b11d8ea7b48292679e6ec355
MD5 efdb998f5aaea84cd49f6056e2bc232a
BLAKE2b-256 3e3a73028cf034dce5a55e3de57d1c2f039fc303568bbf82a11b5fde9e5fabbc

See more details on using hashes here.

Provenance

The following attestation bundles were made for mxm_refdata-0.3.0.tar.gz:

Publisher: release.yml on moneyexmachina/mxm-refdata

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

File details

Details for the file mxm_refdata-0.3.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for mxm_refdata-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c7d7abd88e755155152fac0c184d6010cf2226bf729d29b3ce180b97a797693f
MD5 f56b3eccbcd0c432b345282ec969bcac
BLAKE2b-256 580f9ecdcce9a9ad8a04e6646799bbd62d3f3bd2417e3793c13a87c9fb129786

See more details on using hashes here.

Provenance

The following attestation bundles were made for mxm_refdata-0.3.0-py3-none-any.whl:

Publisher: release.yml on moneyexmachina/mxm-refdata

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