(Screenshot of the lak command in action)
Lakshmi is an open-source Python library and command-line tool (lak) for
managing an index-investing portfolio, inspired by the
Bogleheads
philosophy. It is built for US investors and reports values in dollars.
Most modern portfolio trackers require sharing sensitive credentials with third-party servers, struggle with tax-location strategies, or push active trading features. Lakshmi takes a different approach:
Lakshmi requires Python 3.9 or newer and is available on
PyPI. To use the lak command, install it
with pipx (or
uv), which keeps it in its own environment:
pipx install lakshmi
# Or, with uv
uv tool install lakshmi
To use Lakshmi as a library, pip install lakshmi inside your project’s
environment.
On Arch Linux, you can also install it from the AUR via an AUR helper or manually:
yay -S python-lakshmi
The fastest way to see what Lakshmi does is to try it on the example portfolio:
curl -o ~/portfolio.yaml https://sarvjeets.github.io/lakshmi/docs/portfolio.yaml
lak list assets total aa al
The first run is slow because it fetches names and prices. After that they are cached (prices for a day), so later runs are fast.
To build your own portfolio, either edit a copy of the example file, or use
lak to create one step by step:
lak init. This opens an editor with
an example allocation. If you want to keep the example as is, make any small
edit (e.g. delete a comment) before saving, since lak treats an unchanged
file as an aborted edit.lak add account.
Run it once per account.lak add asset -p TickerAsset -t <account>,
where <account> is a substring that uniquely matches an account name. Other
asset types (ManualAsset, VanguardFund, IBonds, EEBonds) are listed in
lak add asset --help.lak list assets total aa al.For a detailed walkthrough, see creating a portfolio in the lak user guide. For tips and tricks (moving config files, shell completion, multiple portfolios, automatic emails), see Lakshmi Recipes.
Plan
Decide
Track
yfinance) and Treasury/Vanguard
data. If a source is down or rate limits you, lak can’t refresh that asset.lak analyze allocate is a beta feature. Sanity check its suggestions
before acting on them.Run lak --help (or add --help to any command) for current options. The
lak user guide documents
every command in detail.
| To do this | Run |
|---|---|
| See assets, totals, allocation and location | lak list assets total aa al |
| See tax lots and gains | lak list lots |
| Try a hypothetical trade | lak whatif asset -a VTI -50 asset -a VXUS -t Taxable 50 |
| Decide where new money goes | lak whatif account -t Taxable 100 then lak analyze allocate -t Taxable |
| Check if rebalancing is needed | lak analyze rebalance |
| Look for tax-loss harvesting candidates | lak analyze tlh |
| Save a checkpoint for performance tracking | lak add checkpoint |
| See performance (IRR) | lak list performance |
The lakshmi library can also be used directly. The modules and classes are
well documented, and the
tests contain
numerous examples for each method and class.
Contributions are welcome. All development happens on the develop branch.
See CONTRIBUTING.md
for how to set up a development environment, run the tests and submit changes.
This project is inspired by the Bogleheads forum. Bogleheads focus on a simple but powerful philosophy that allows investors to achieve above-average returns after costs. This tool is built around the same principles to help an average investor manage their investing portfolio. The Bogleheads wiki is a great introduction to basic investing concepts like asset allocation and asset location.
Lakshmi (meaning “She who leads to one’s goal”) is one of the principal goddesses in Hinduism. She is the goddess of wealth, fortune, power, health, love, beauty, joy and prosperity.
Distributed under the MIT License. See LICENSE for more information.
I am indebted to the following folks whose wisdom has helped me tremendously in my investing journey: John Bogle, Taylor Larimore, Nisiprius, Livesoft, Mel Lindauer and LadyGeek.
This project would not have been possible without my wife Niharika, who helped me come up with the initial idea and encouraged me to start working on this project.
The author is not a financial adviser and you agree to treat this tool for informational purposes only. The author does not promise or guarantee that the information provided by this tool is correct, current, or complete, and it may contain technical inaccuracies or errors. The author is not liable for any losses that you might incur by acting on the information provided by this tool. Accordingly, you should confirm the accuracy and completeness of all content, and seek professional advice taking into account your own personal situation, before making any decision based on information from this tool.
In a nutshell: