Tax-lot accounting (FIFO / HIFO / SpecID)
Problem: You have a live taxable account with multiple lots of AAPL bought at different prices. When you sell, the IRS lets you choose which lots to dispose of. The choice matters — it can save real money.
Solution: Configure mts1b-treasury's tax-lot ledger to optimize.
The three methods
| Method | What it does | When to use |
|---|---|---|
| FIFO (default) | Sell oldest lots first | Simplest; brokers' default |
| HIFO | Sell highest-cost lots first (minimize current-year gain) | Defer taxes |
| SpecID | Operator picks specific lots | Maximum control |
Setup
mts mts1b-treasury fund edit --fund-id live-equities \
--tax-lot-method hifo
Choices: fifo, lifo, hifo, loifo (lowest cost first), specid.
Walking example
You own 4 lots of AAPL:
| Lot | Open Date | Qty | Cost basis | Market price |
|---|---|---|---|---|
| L1 | 2025-01-15 | 100 | $150 | $200 |
| L2 | 2025-06-01 | 50 | $200 | $200 |
| L3 | 2025-12-10 | 200 | $180 | $200 |
| L4 | 2026-03-20 | 100 | $195 | $200 |
You want to sell 200 shares to realize $10k of gross cash (irrelevant — we sell 200 either way).
Under FIFO
Sell L1 (100 @ $150 → $200): gain = 100 × $50 = $5,000 short-term*
Sell L2 (50 @ $200 → $200): gain = 50 × $0 = $0 short-term
Sell L3 (50 @ $180 → $200): gain = 50 × $20 = $1,000 short-term
─────────
Total gain: $6,000 (all short-term)
*L1 was held > 1 year at the 2026-03-20 sale, so it's long-term, but L2 + L3 are short-term.
Under HIFO
Sell L4 (100 @ $195 → $200): gain = 100 × $5 = $500 short-term
Sell L2 (50 @ $200 → $200): gain = 50 × $0 = $0 short-term
Sell L3 (50 @ $180 → $200): gain = 50 × $20 = $1,000 short-term
─────────
Total gain: $1,500 (all short-term)
HIFO realized $4,500 less taxable gain. At the U.S. short-term rate (37% top bracket), that's ~$1,665 of tax deferred until the remaining lots are sold.
Under SpecID
You explicitly pick:
mts mts1b-oms order submit \
--fund-id live-equities \
--symbol AAPL --side sell --qty 200 \
--tax-lots L1:100,L3:100
This sells L1 entirely (long-term gain of $5,000 at 15-20% LT rate) + 100 of L3 (short-term $2,000). For some operators, paying LT rate on a known win is preferable to deferring more ST gain.
Wash-sale handling
If you sell at a loss and rebuy within 30 days, the IRS disallows the loss. mts1b-treasury tracks this automatically:
# After selling at a loss
sale = await oms.sell_order(symbol="MSFT", qty=100)
# realized loss = -$1,200
# Within 30 days, you buy back
buy = await oms.buy_order(symbol="MSFT", qty=50)
# mts1b-treasury detects the wash sale:
# Disallows 50 / 100 of the loss = $600
# Increases cost basis of the new 50 shares by $600 (the disallowed amount)
Reported in the settlement report under "Wash-sale adjustments".
Across funds (be careful)
Wash-sale rule applies across all accounts owned by the same taxpayer — including IRA + spouse's accounts. mts1b-treasury only tracks across funds you've registered. For full coverage, register all funds (even retirement) so the wash-sale tracker sees them.
mts mts1b-treasury fund create --fund-id ira-fidelity --type read-only --broker fidelity
read-only funds are tracked for tax purposes but not traded by MTS1B.
Long-term vs short-term
Holding period crosses 365 days → long-term capital gains (currently 0/15/20% federal, vs 10-37% short-term).
mts1b-treasury warns you before closing positions that are close to crossing the threshold:
mts mts1b-oms order submit --fund-id live-equities --symbol AAPL --side sell --qty 100
⚠️ Holding-period warning:
Lot L1 (100 shares @ $150) — held 358 days as of today.
Wait 8 more days to qualify for long-term capital gains rate.
Estimated tax saving: ~$1,000 (at 37% ST vs 15% LT bracket).
Proceed anyway? [y/N]
Disable warnings if they're noisy:
mts mts1b-treasury config --no-holding-period-warnings
Reporting
End of year:
mts1b-report settlement --fund-id live-equities --year 2026
Outputs:
2026-realized-gains.pdf— full lot-by-lot breakdown2026-realized-gains.csv— TurboTax-importable format2026-form-8949.pdf— drafted Form 8949 (US: sales of capital assets)
⚠️ The PDF is a draft for your accountant. MTS1B does not file your taxes.
When to override the default
| Scenario | Recommended method |
|---|---|
| You're in a high-income year and want to defer | HIFO |
| You're in a low-income year and want to harvest losses | LIFO/LOIFO |
| You have a specific lot crossing into long-term in days | SpecID (wait, then sell oldest) |
| You're a long-term holder with mostly ST losses | FIFO is fine |
See also
mts1b-treasury— tax-lot ledgermts1b-reportslibrary— settlement reports- Tutorial: Multi-fund treasury — full setup