Financial markets ORM, engines, and application management extensions for Main Sequence.
Project description
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 package version:
0.0.18 - 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.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 DataNode 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, and pricing helpers installed with thepricingextramsm.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 and SDK-managed MetaTable migration commands
Repository areas:
docs/: MkDocs documentation, tutorials, knowledge guides, ADRs, and API reference scaffoldexamples/msm/: core assets, accounts, calendars, platform, and row-workflow examplesexamples/msm_portfolios/: single portfolio construction example with index linkage and canonical portfolio DataNodesexamples/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
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 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__)"
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 project only when you explicitly want them available to agents in that project:
msm copy-msm-skills --path /path/to/project
Importing msm never mutates the current directory or auto-copies skills. The
command writes only to <project>/.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
Publish a tagged release to PyPI:
git tag v0.0.2
git push origin v0.0.2
Pushing a v* tag triggers
.github/workflows/publish-to-pypi.yml, which builds the distribution and
publishes it to PyPI through GitHub Actions using trusted publishing for the
repository pypi environment.
Core Dependencies
Runtime dependencies are declared in pyproject.toml. The core stack starts with:
mainsequencefor platform integrationSQLAlchemyfor market-domain ORM modelspydanticfor typed configuration and serialized row contractspandasandnumpyfor tabular market data
Optional extras provide documentation, development, portfolio, public API,
pricing, and Streamlit UI tooling. 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 and pricing-streamlit extras install QuantLib and the optional
pricing runtime exposed as msm_pricing.
Package Metadata
- Distribution name:
ms-markets - Import packages:
msm,msm_portfolios, and optionalmsm_pricing - Python:
>=3.11 - 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ms_markets-0.0.50.tar.gz.
File metadata
- Download URL: ms_markets-0.0.50.tar.gz
- Upload date:
- Size: 581.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c18183795963545a92370259421c0f7c374ccf55bf1cbdebbd5711db7f13e750
|
|
| MD5 |
a4a06596078f5b7742ecdccea6abc891
|
|
| BLAKE2b-256 |
978ba5e4a0d6a630ce22daee5b1755e3bb749c5f9c39b11c76d96bfa1ae351a3
|
Provenance
The following attestation bundles were made for ms_markets-0.0.50.tar.gz:
Publisher:
publish-to-pypi.yml on mainsequence-projects/MainSequenceMarkets
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ms_markets-0.0.50.tar.gz -
Subject digest:
c18183795963545a92370259421c0f7c374ccf55bf1cbdebbd5711db7f13e750 - Sigstore transparency entry: 1776356412
- Sigstore integration time:
-
Permalink:
mainsequence-projects/MainSequenceMarkets@fdc4c29223398a7aceaa68c3e0fb29e79bfd4366 -
Branch / Tag:
refs/tags/v0.0.50 - Owner: https://github.com/mainsequence-projects
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@fdc4c29223398a7aceaa68c3e0fb29e79bfd4366 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ms_markets-0.0.50-py3-none-any.whl.
File metadata
- Download URL: ms_markets-0.0.50-py3-none-any.whl
- Upload date:
- Size: 431.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a5153543c83cba3b927497adc0f08d5ff5620cf5c4da78f4a74cee5f9eb6e13
|
|
| MD5 |
1b123cfadfe346c75b5a5f1379bb7185
|
|
| BLAKE2b-256 |
129ada0aa156e49663405aa2dd1a6c939238b72183aebe2602ec468d3e904c2d
|
Provenance
The following attestation bundles were made for ms_markets-0.0.50-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on mainsequence-projects/MainSequenceMarkets
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ms_markets-0.0.50-py3-none-any.whl -
Subject digest:
2a5153543c83cba3b927497adc0f08d5ff5620cf5c4da78f4a74cee5f9eb6e13 - Sigstore transparency entry: 1776356468
- Sigstore integration time:
-
Permalink:
mainsequence-projects/MainSequenceMarkets@fdc4c29223398a7aceaa68c3e0fb29e79bfd4366 -
Branch / Tag:
refs/tags/v0.0.50 - Owner: https://github.com/mainsequence-projects
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@fdc4c29223398a7aceaa68c3e0fb29e79bfd4366 -
Trigger Event:
push
-
Statement type: