Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

MainSequence Markets

MainSequence Markets

Docs License Python Package Open Issues Last Commit Maintained

ms-markets is the financial markets extension layer for the Main Sequence platform. It provides reusable market-domain ORM models, market DataNodes, portfolio construction utilities, repository operations, and application-facing helpers for building financial systems on top of Main Sequence. Portfolio and QuantLib-backed pricing capabilities are packaged as separate import surfaces so core msm stays focused on shared markets primitives.

The Python distribution is named ms-markets. The core import package is intentionally short:

import msm

Portfolio workflows import from msm_portfolios. Optional QuantLib-backed pricing imports from msm_pricing.

Project Status

The initial core package was migrated from mainsequence-sdk/mainsequence/markets into this repository under src/msm. Architecture and implementation decisions are tracked in Architecture Decision Records.

What This Repository Contains

Main package areas:

  • msm.api.accounts: account identity and account target assignment row APIs
  • msm.api.calendars: calendar identity, date, session, and event row APIs
  • msm.api: user-facing Pydantic row objects and typed class methods for markets MetaTable records
  • msm.api.http: installable provider-neutral collection, discovery, bulk-preflight, tabular-frame, observable-operation, and structured-error contracts
  • msm.constants: static built-in keys such as asset type constants used across applications and examples
  • msm.client: client-facing Main Sequence market models and API wrappers
  • msm.data_nodes: market TimeIndexTableUpdater contracts, including account holdings, execution events, asset snapshots, and asset pricing details
  • msm.api.execution: order managers, target quantities, orders, events, trades, and execution error row APIs
  • msm.models: SQLAlchemy market-domain *Table declarations and MetaTable registration order
  • msm_portfolios: portfolio configuration, signal weights, rebalance strategies, virtual funds, and portfolio construction workflows
  • msm_pricing: optional QuantLib-backed instruments, curves, fixings, pricing helpers, and pure-data analytics installed with pricing or analytics extras
  • msm.repositories: compiled persistence operations over market-domain models
  • msm.services: application-level orchestration over repositories, including asset lookup and OpenFIGI service helpers
  • msm CLI: package maintenance helpers such as explicit agent-skill copying; MetaTable migrations run through the metatables migrations CLI with --provider msm_migrations:migration

Repository areas:

  • docs/: MkDocs documentation, tutorials, knowledge guides, ADRs, and API reference scaffold
  • examples/msm/: core assets, accounts, calendars, formula/custom indexes, platform, and row-workflow examples
  • examples/msm_portfolios/: portfolio construction, rebalance simulation, lifecycle cash-flow, multi-currency valuation, and accounting examples
  • examples/msm_pricing/: optional pricing and QuantLib-backed examples
  • .agents/skills/ms_markets/: source agent skills for market-domain workflows
  • tests/: automated tests

Documentation Map

The documentation is organized into four reading modes:

  1. Tutorial: guided learning material
  2. Knowledge: concept-oriented guides for each msm package area
  3. Architecture: ADRs that record implementation decisions
  4. Reference: generated API reference scaffold

Recommended entry points:

Quick Start

ms-markets 2.x requires Python 3.13, Main Sequence SDK >=9.0.19,<10, and the MetaTables client mainsequence-metatable>=0.1.33,<0.2, which is imported as metatables. SDK 8 and earlier are not supported; install a 1.x ms-markets release when maintaining an SDK 8 project. See ADR 0043 and the 2.0.0 changelog entry for the breaking changes.

Install the package from this repository in editable mode:

python -m pip install -e ".[dev]"

Or with uv:

uv sync --extra dev

Install pricing support only when needed:

uv sync --extra pricing

Install the named analytics surface when working with optional spread analytics:

uv sync --extra analytics

Install portfolio workflow support only when needed:

uv sync --extra portfolios

Install the project-level FastAPI surface only when needed:

uv sync --extra public_api

Verify the core import:

python -c "import msm; print(msm.__version__)"

Provider APIs can import the shared HTTP toolkit directly from the wheel:

from msm.api.http import ResourceCollection, api_http_error

After installing the pricing extra, verify the optional pricing import:

python -c "import msm_pricing; print(msm_pricing.FixedRateBond)"

Copy the packaged ms-markets skills into a host Main Sequence CodeRepository only when you explicitly want them available to agents in that repository:

msm copy-msm-skills --path /path/to/code-repository

Importing msm never mutates the current directory or auto-copies skills. The command writes only to <code-repository>/.agents/skills/ms_markets/ and leaves unrelated .agents content alone. Use --dry-run or --json to inspect the copy plan.

Common Development Commands

Run tests:

pytest

Run focused linting for optional pricing:

ruff check src/msm_pricing

Serve the docs locally:

mkdocs serve

Build the docs:

mkdocs build --strict

Build the package:

uv build

Releases are published by GitHub Actions, never by hand. Work lands on the development branch, where every push publishes an X.Y.Z.devN build to PyPI. main is protected: merging a pull request from development publishes the declared X.Y.Z, creates its vX.Y.Z tag and deploys the documentation. See Releasing.

Core Dependencies

Runtime dependencies are declared in pyproject.toml. The core stack starts with:

  • mainsequence>=9.0.19,<10 for identity, login, Git source context, CodeRepository, jobs, and agents
  • mainsequence-metatable>=0.1.33,<0.2 (import metatables) for MetaTables, time-index table updaters, governed compiled SQL, and application-owned Alembic migrations
  • SQLAlchemy for market-domain ORM models
  • pydantic for typed configuration and serialized row contracts
  • pandas and numpy for tabular market data

Optional extras provide analytics, documentation, development, portfolio, public API, and pricing tooling. The analytics and pricing-analytics extras reserve the dependency boundary for optional analytics helpers; the current spread helpers use the core numpy and pandas dependencies. The portfolios extra installs portfolio-only helpers such as pandas-market-calendars. The public_api extra installs FastAPI and Uvicorn for the project-level apps/v1 surface. The pricing extra installs QuantLib and the optional pricing runtime exposed as msm_pricing.

Package Metadata

Project metadata is defined in pyproject.toml.

License

This project is open source under the Apache License 2.0.

Metadata

Release files for ms-markets 2.2.9.dev33

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

Source distribution (sdist)

Source distribution for ms-markets 2.2.9.dev33
File Size Uploaded
ms_markets-2.2.9.dev33.tar.gz 2.4 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for ms-markets 2.2.9.dev33
File Interpreter ABI Platform
ms_markets-2.2.9.dev33-py3-none-any.whl Python 3 none any Details

Total release size: 3.1 MB

Release files / ms_markets-2.2.9.dev33.tar.gz

Download URL ms_markets-2.2.9.dev33.tar.gz
Size 2.4 MB
Tags Source
SHA-256 checksum
How to use checksums
6c40e6223f3bf18b5c7f1d6458c67d5c055966bafd259a6d0a3c203f581ddca1
BLAKE2b-256 checksum
How to use checksums
7105693dc6632c08295b057d2d08ff2d17c249a4fa5d65cd6879270c0bfd26ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 11, 2026.

Transparency log

Release files / ms_markets-2.2.9.dev33-py3-none-any.whl

Download URL ms_markets-2.2.9.dev33-py3-none-any.whl
Size 716.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
613502c5184664ec266fdff955c86af84d232cea69da5e8111aeaa5e199b90ce
BLAKE2b-256 checksum
How to use checksums
35bb7eec1b23ead4cc9ff5486e1ad83f0336e502daaea76402712e99be8bbf8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 11, 2026.

Transparency log

Release history Release notifications | RSS feed

2.2.10

2 release files

2.2.9

2 release files

This release

2.2.9.dev33 This release

2 release files

2.2.8

2 release files

2.2.7

2 release files

2.2.6

2 release files

2.2.5

2 release files

2.2.4

2 release files

2.2.3

2 release files

2.2.2

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.2

2 release files

2.0.1

2 release files

1.0.16

2 release files

1.0.15

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

0.0.99

2 release files

0.0.98

2 release files

0.0.97

2 release files

0.0.96

2 release files

0.0.95

2 release files

0.0.94

2 release files

0.0.92

2 release files

0.0.85

2 release files

0.0.84

2 release files

0.0.83

2 release files

0.0.82

2 release files

0.0.81

2 release files

0.0.80

2 release files

0.0.79

2 release files

0.0.78

2 release files

0.0.77

2 release files

0.0.76

2 release files

0.0.75

2 release files

0.0.74

2 release files

0.0.73

2 release files

0.0.72

2 release files

0.0.71

2 release files

0.0.70

2 release files

0.0.69

2 release files

0.0.68

2 release files

0.0.67

2 release files

0.0.66

2 release files

0.0.65

2 release files

0.0.64

2 release files

0.0.63

2 release files

0.0.62

2 release files

0.0.61

2 release files

0.0.60

2 release files

0.0.59

2 release files

0.0.58

2 release files

0.0.57

2 release files

0.0.56

2 release files

0.0.55

2 release files

0.0.54

2 release files

0.0.53

2 release files

0.0.52

2 release files

0.0.51

2 release files

0.0.50

2 release files

0.0.16

2 release files

0.0.15

2 release files

0.0.14

2 release files

0.0.13

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

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