Our Methodology
Exactly how MinMaxDoc turns your holdings into buy and sell suggestions — in plain English, with the assumptions and limits stated up front.
- We estimate each holding's expected return and how holdings move together (their covariance) from historical market data.
- We search for the mix of weights that gives the best risk-adjusted return — the highest Sharpe ratio — using the classic Markowitz mean-variance framework.
- The search itself is a Monte Carlo weight search: we sample thousands of candidate allocations and keep the best one. It is not a forecast of your future wealth.
- For selling, we track your individual tax lots so recommendations are tax-aware (short- vs. long-term gains, loss harvesting).
- This is an educational optimization tool, not personalized financial advice. See the limitations and disclaimer below.
MinMaxDoc is a "second opinion" for your portfolio. You tell us what you hold, your constraints, and your goals; we compute a suggested set of buys and sells. Here is what happens under the hood.
Estimating risk and return
Every optimization starts from two ingredients for each security you're considering:
- Expected return. We use an annualized return estimate derived from historical price history. This is a backward-looking estimate — a starting assumption, not a prediction.
- Risk and co-movement. We estimate each security's volatility and the covariance between securities — how much they tend to move together — from historical returns. Diversification is only meaningful because different holdings don't move in lockstep, and covariance is how we measure that.
The risk-free rate used in our risk-adjusted return calculation comes from current U.S. Treasury rates.
Mean-variance optimization (Markowitz)
We use Modern Portfolio Theory — the mean-variance framework introduced by Harry Markowitz. The idea: for a given level of risk, there is a mix of holdings that maximizes expected return (and vice versa). Rather than chase the highest raw return, we optimize for the best return per unit of risk.
Concretely, we score each candidate portfolio by its Sharpe ratio:
Sharpe = (expected portfolio return − risk-free rate) ÷ portfolio volatility
A higher Sharpe ratio means you're being compensated more for each unit of risk you take. The optimizer's job is to find the allocation that maximizes it, subject to your constraints (per-security minimum/maximum weights, sector caps, required holdings, and the cash you're investing).
Monte Carlo weight search
Finding the best weights is a search problem. MinMaxDoc solves it with a Monte Carlo weight search: we generate thousands of random candidate allocations (each respecting your weight and sector constraints), compute the Sharpe ratio of each, and keep the best one we find. Depending on your plan, we sample up to:
- Free — up to 2,500 candidate allocations
- Plus — up to 5,000
- Pro — up to 10,000
- Ultimate — up to 15,000
(The search stops early once additional samples stop improving the result, so a run may use fewer than the cap.) More samples explore the space of possible allocations more thoroughly, which can find a slightly better mix — they do not buy you a more certain future.
Our Monte Carlo step is a randomized search over portfolio weights to approximate the highest-Sharpe allocation from today's estimates. It is not a wealth-path outcome simulator: it does not simulate thousands of possible future market scenarios, and it does not produce a probability that you'll hit a retirement number or a distribution of ending balances. If you've seen "Monte Carlo retirement simulators" elsewhere, this is a different use of the same term.
Tax-aware lot handling
When a recommendation involves selling, taxes matter as much as returns. MinMaxDoc tracks your positions at the tax-lot level — each purchase, with its own cost basis and purchase date — and accounts for the tax consequences of a sale before recommending it:
- Holding period. Gains on lots held one year or less are treated as short-term; longer holds are long-term, using the capital-gains rates you provide.
- Loss harvesting. Realized losses are netted against realized gains to reduce the tax owed, so the engine can prefer selling lots that harvest losses.
- Minimizing tax drag. Among sell combinations that reach your target, the engine favors those with the lowest tax cost, and account type (e.g. taxable vs. Roth IRA) changes how gains are treated.
The result is a suggestion tuned not just for a better risk-adjusted mix, but for keeping more of your money after taxes.
Data sources
- Prices & historical returns: public market data via yfinance (Yahoo Finance). Expected returns, volatility, and covariance are all estimated from this history.
- Risk-free rate: current U.S. Treasury rates.
- Your inputs: your holdings, lot cost bases and dates, constraints, tax rates, and goals — which you control and can edit at any time.
Limitations & assumptions (read this)
We'd rather be honest about what the model can't do than oversell it:
- The past is not the future. Expected returns and covariances are estimated from historical data. Real markets shift — correlations that held for years can break during a crisis, exactly when diversification matters most.
- The optimizer is approximate and stochastic. A random weight search approaches, but does not guarantee, the true optimum, and two runs can differ slightly.
- Estimation error compounds. Mean-variance optimization is sensitive to its inputs; small errors in expected returns can produce meaningfully different weights ("garbage in, garbage out").
- It's not a wealth projection. We don't model your future spending, income, or the probability of reaching a goal.
- We don't model everything. Trading commissions, bid-ask spreads, market impact, dividend taxes, wash-sale rules across accounts, and your complete personal tax situation are outside the model.
- Data can be wrong or missing. Market data may be delayed, incomplete, or inaccurate, and some securities lack enough history to optimize confidently.
- You decide. Suggestions are a starting point for your own research, not instructions to follow blindly.
MinMaxDoc is for educational and informational purposes only and does not constitute financial, investment, or tax advice. Recommendations are generated by an algorithm from the data and assumptions above and may not be suitable for your individual circumstances. Always consult a qualified financial advisor before making investment decisions. Investing involves risk, including the possible loss of principal, and past performance is not indicative of future results. MinMaxDoc is an educational tool, not your broker, dealer, or fiduciary — MinMaxDoc and its authors are not registered investment advisors.
Questions about how any of this works? Get in touch — we're happy to explain. You can also read about the people behind the model on our About page.