Skip to main content

Multi-Portfolio Asset Ledger (mpal) - A minimal CLI tool for manual asset tracking and capital management.

Project description

mpal

mpal — Multi-Portfolio Asset Ledger — is a minimal CLI tool for manual asset tracking and capital management.

The CLI command is mpal. The package/distribution name is mpal-cli. Current version: 0.6.0. License: MIT.

Installation

mpal requires Python 3.11 or later.

For a future PyPI release:

python -m pip install mpal-cli
mpal --help

From a project checkout:

python -m pip install -e .
mpal --help

Storage

mpal stores records in a local SQLite database named mpal.db. By default it uses the platform data directory, but you can set MPAL_DATA_DIR to choose a different directory:

MPAL_DATA_DIR=/path/to/mpal-data mpal init

What mpal is

  • A manual capital ledger.
  • A portfolio tracker.
  • A deterministic, record-based calculator.
  • A local database-backed CLI.
  • A foundation for future extensions.

mpal calculates its results only from manually recorded operations.

Scope

mpal is intentionally simple. It does not fetch market data, calculate live prices, calculate market value, calculate unrealized PnL, connect to market APIs or other external services, or provide financial advice.

mpal only works with the records you enter manually.

mpal tracks capital, cash, open positions by book cost, manually recorded asset income, realized P&L, and return. Portfolio summaries use book/accounting values. Book Value is derived from manual records and is not market value.

Quick Start

mpal init
mpal summary
mpal summary --explain
mpal portfolio create stocks
mpal deposit 1000 -p stocks
mpal withdraw 250 -p stocks
mpal capital -p stocks
mpal capital log -p stocks
mpal asset add AAPL -p stocks
mpal asset buy AAPL -p stocks --price 234.43 --quantity 3 --fee 2.30
mpal asset list
mpal summary -p stocks
mpal summary -p stocks -a AAPL
mpal asset log AAPL -p stocks

Command Hierarchy

mpal groups commands by the records they manage:

mpal init

mpal summary
mpal summary --explain
mpal summary -p stocks
mpal summary -p stocks -a AAPL

mpal portfolio create stocks
mpal portfolio create stocks --initial 5000
mpal portfolio list
mpal portfolio allocation
mpal portfolio reset stocks --yes
mpal portfolio delete stocks --yes

mpal deposit 1000 -p stocks
mpal withdraw 250 --portfolio stocks --date 2026-06-19 --note "withdrawal"
mpal capital -p stocks
mpal capital log -p stocks
mpal capital entry edit 2 -p stocks --amount 500
mpal capital entry delete 2 -p stocks

mpal asset add AAPL AMZN MSFT -p stocks
mpal asset list
mpal asset list -p stocks
mpal asset log AAPL -p stocks
mpal asset delete AAPL -p stocks --yes
mpal asset entry edit AAPL 2 -p stocks --price 234.50 --quantity 3
mpal asset entry delete AAPL 2 -p stocks --yes
mpal asset income AAPL 32 -p stocks --date 2026-06-20 --note "Distribution"
mpal asset buy AAPL -p stocks --price 234.43 --quantity 3 --fee 2.30
mpal asset sell AAPL -p stocks --price 235.50 --quantity 1 --fee 1.25

mpal summary is the unified summary/reporting command. With no options it shows a global dashboard summary across all active portfolios: total capital, total cash, positions, book value, total income, realized P&L, and return. mpal summary --explain prints concise definitions below that global table. mpal summary -p <portfolio> summarizes one active portfolio. mpal summary -p <portfolio> -a <asset> summarizes one active asset within one active portfolio; -a requires -p. Positions are open position book cost, not market value. Book Value is total cash plus open position book cost. Summary views do not use live prices, market value, or unrealized PnL. Global return is computed from global totals, not by averaging portfolio returns.

mpal portfolio allocation shows active portfolio allocation by book value. BOOK VALUE = TOTAL CASH + POSITIONS, where positions are open position book cost. Allocation is not based on capital, cash alone, market value, live prices, or unrealized PnL.

Portfolio-scoped capital and asset operations require --portfolio or -p. Global collection views such as mpal summary and mpal asset list do not require -p. No compatibility aliases are kept in this CLI redesign.

Use mpal deposit <amount> -p <portfolio> for external capital deposits and mpal withdraw <amount> -p <portfolio> for external capital withdrawals. Use mpal capital -p <portfolio> to inspect current capital and mpal capital log -p <portfolio> to inspect capital history.

Asset list output uses an Asset/Portfolio column. Combined labels display as <SYMBOL> • <Portfolio>, such as AAPL • Stocks; portfolio capitalization there is display-only, and command syntax still uses -p <portfolio>. The symbol uses the key style while the portfolio segment is muted for scanning.

Entry numbers shown by mpal capital log are stable, portfolio-local numbers. Internal database IDs are not part of the CLI contract. Capital entry correction is under mpal capital entry edit/delete; mpal capital log remains the historical entry view, and mpal capital -p <portfolio> is the capital-only current-state view.

Explicit transaction dates must use YYYY-MM-DD and cannot be in the future. If --date is omitted, mpal uses the current local date.

The current release covers initialization, portfolio creation, optional initial capital, deposits, withdrawals, summaries, logs, capital-entry correction and deletion, portfolio reset, and soft deletion of portfolios. The asset foundation adds manual symbol creation, current-state views, and soft deletion under existing portfolios. The read-only asset log and its transaction storage foundation are also present. Manual asset income updates asset and portfolio summaries. Manual buys update open quantity, Cost Basis, portfolio Cash, and Positions. Manual sells use moving-average book cost and update open quantity, Cost Basis, Cash, Positions, and Realized PnL. Individual asset transactions can be edited or soft-deleted by asset-local entry number, with active transactions replayed before commit. asset list is the current asset collection view, and summary -p <portfolio> -a <asset> reports current open quantity, Cost Basis, Average Cost, Realized PnL, Income, and Realized Return for one asset from active manual transactions. Asset transaction correction is under mpal asset entry edit/delete; mpal asset log remains the historical transaction view.

summary owns global, portfolio, and asset summary/reporting views. Daily capital actions are top-level commands, and capital -p owns the current capital view.

Planned capabilities

Later releases are planned to extend portfolio tracking, record management, calculations, reporting, backup, import and export, audit tooling, and release automation.

See the roadmap for the phased plan.

Financial advice disclaimer

mpal is a record-keeping and calculation tool. It does not provide financial, investment, tax, or legal advice. Users are responsible for verifying their records and decisions.

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

mpal_cli-0.6.0.tar.gz (75.1 kB view details)

Uploaded Source

Built Distribution

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

mpal_cli-0.6.0-py3-none-any.whl (39.4 kB view details)

Uploaded Python 3

File details

Details for the file mpal_cli-0.6.0.tar.gz.

File metadata

  • Download URL: mpal_cli-0.6.0.tar.gz
  • Upload date:
  • Size: 75.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for mpal_cli-0.6.0.tar.gz
Algorithm Hash digest
SHA256 b19850c4993fe48a16238ca5a0018e067ec5be990999ec20dd1a8ba60aaac3d9
MD5 7c192ae3b357d746bb2133b89dfa5372
BLAKE2b-256 c3d95dd1adfe0f5ae954f340fc55d3c4665851a3f3c142ed08aa7cab5b8d86ee

See more details on using hashes here.

File details

Details for the file mpal_cli-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: mpal_cli-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 39.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for mpal_cli-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4b8b4c3b200e0f9778233095f7ba7e3cde2411b07b33d772d6b3f7b5c1b5a5a6
MD5 f0c82c26951d220d540d545402e58040
BLAKE2b-256 16db8b2f96a679c3f2ed74af2895f40054ed46768a5a5d9c32f976a73311ce00

See more details on using hashes here.

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