Cost basis and holding period for a sale, by FIFO, specific identification or average cost

One command in the Portfolio pack, available in the CLI, as an MCP tool and as a JavaScript import: portfolio cost-basis.

What it needs, and why

Every input is checked before anything is calculated. lots and sale are required; the rest refine the answer.

InputRequiredThe question it asksWhy it matters
lotsyesWhich lots are held: quantity, price paid and purchase date for each?Basis and holding period come from the lots actually sold.
saleyesHow many shares are being sold, on what date, and at what price?The sale date sets each lot’s holding period.
methodoptionalWhich method applies: FIFO, specific identification, or average cost?It changes both the basis and the short/long-term split.

Requests it answers

An agent with this pack loaded picks the command from phrasing like that, asks for whatever input is missing, and reports the figures with the method that produced them.

Limits it inherits from wealth-portfolio

The full pack, its other 10 commands and what it deliberately leaves alone are on the Portfolio page.