This release is a pre-release and may not be stable for production use.
MainSequence Markets
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
- Status: initial scaffold and SDK extraction
- Current release line:
2.x - Documentation: Documentation Site
- Open issues: GitHub Issues
- Release history: CHANGELOG.md
- License: Apache License 2.0
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 APIsmsm.api.calendars: calendar identity, date, session, and event row APIsmsm.api: user-facing Pydantic row objects and typed class methods for markets MetaTable recordsmsm.api.http: installable provider-neutral collection, discovery, bulk-preflight, tabular-frame, observable-operation, and structured-error contractsmsm.constants: static built-in keys such as asset type constants used across applications and examplesmsm.client: client-facing Main Sequence market models and API wrappersmsm.data_nodes: market TimeIndexTableUpdater contracts, including account holdings, execution events, asset snapshots, and asset pricing detailsmsm.api.execution: order managers, target quantities, orders, events, trades, and execution error row APIsmsm.models: SQLAlchemy market-domain*Tabledeclarations and MetaTable registration ordermsm_portfolios: portfolio configuration, signal weights, rebalance strategies, virtual funds, and portfolio construction workflowsmsm_pricing: optional QuantLib-backed instruments, curves, fixings, pricing helpers, and pure-data analytics installed with pricing or analytics extrasmsm.repositories: compiled persistence operations over market-domain modelsmsm.services: application-level orchestration over repositories, including asset lookup and OpenFIGI service helpersmsmCLI: package maintenance helpers such as explicit agent-skill copying; MetaTable migrations run through themetatables migrationsCLI with--provider msm_migrations:migration
Repository areas:
docs/: MkDocs documentation, tutorials, knowledge guides, ADRs, and API reference scaffoldexamples/msm/: core assets, accounts, calendars, formula/custom indexes, platform, and row-workflow examplesexamples/msm_portfolios/: portfolio construction, rebalance simulation, lifecycle cash-flow, multi-currency valuation, and accounting examplesexamples/msm_pricing/: optional pricing and QuantLib-backed examples.agents/skills/ms_markets/: source agent skills for market-domain workflowstests/: automated tests
Documentation Map
The documentation is organized into four reading modes:
- Tutorial: guided learning material
- Knowledge: concept-oriented guides for each
msmpackage area - Architecture: ADRs that record implementation decisions
- Reference: generated API reference scaffold
Recommended entry points:
- Getting Started
- Tutorial
- FastAPI v1
- Knowledge Base
- Architecture Decision Records
- Changelog
- API Reference
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,<10for identity, login, Git source context, CodeRepository, jobs, and agentsmainsequence-metatable>=0.1.33,<0.2(importmetatables) for MetaTables, time-index table updaters, governed compiled SQL, and application-owned Alembic migrationsSQLAlchemyfor market-domain ORM modelspydanticfor typed configuration and serialized row contractspandasandnumpyfor 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
- Distribution name:
ms-markets - Import packages:
msm,msm_portfolios, and optionalmsm_pricing - Provider HTTP toolkit:
msm.api.http - Python:
>=3.13,<3.14 - License: Apache-2.0
- Repository: https://github.com/mainsequence-projects/MainSequenceMarkets
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.10.dev35
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ms_markets-2.2.10.dev35.tar.gz | 2.4 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ms_markets-2.2.10.dev35-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 3.1 MB
Release files / ms_markets-2.2.10.dev35.tar.gz
| Download URL | ms_markets-2.2.10.dev35.tar.gz |
|---|---|
| Size | 2.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
915593274da6f1a7f65d6d6dceb795d7a2ed527d9ac45f49f7c2a358f3cd8772
|
|
BLAKE2b-256 checksum How to use checksums |
8a9d15f641d2a6eb3dafbc14368b7a4a9edd7adf886786a465ef35efd9c85efe
|
| 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 logRelease files / ms_markets-2.2.10.dev35-py3-none-any.whl
| Download URL | ms_markets-2.2.10.dev35-py3-none-any.whl |
|---|---|
| Size | 716.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7ee845477e15c6625cd50f38ea0a49146429d6aeef6625ed6ce4c3492a051ca1
|
|
BLAKE2b-256 checksum How to use checksums |
7eb9a3252881d9645c168ab50fb608318e3c0e7e7783deb47153bc54028dd430
|
| 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