Tax-loss harvesting before December 31
tax_loss_harvestComputes, on the lots the user gives (ticker, shares, price, date, account and its type), the losses a sale before December 31 would realize and what they offset, with the engine of Portfolio Terminal's "Before December 31" panel. US resident: FIFO lots per account, short vs long term, this year's realized gains, the year netted as Schedule D nets it (the $3,000 off ordinary income, the carryforward), and the wash-sale rule across every account, IRA and 401(k) included: losses it took this year, windows still open, and the first day the same security can be bought back without one (IRS Publication 550). French resident: weighted average cost across accounts at ECB rates, PEA and crypto left out, and the flat tax those losses erase against this year's net gains (CGI art. 150-0 D, 200 A). Funds on the same index are flagged, never judged "substantially identical". Current prices are fetched unless given in prices. Nothing is stored. Use it for "how much tax can my losses save before December 31", "would this be a wash sale".
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"residence": "<residence>",
"lots": "<lots>"
},
"name": "tax_loss_harvest"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lots | Yes | Every purchase of the shares held, one per lot; add this year's sales (side "sell") with the purchases they came from, so realized gains and wash sales count. At most 300. | |
| prices | No | Current price per share by ticker, in the lots' currency, when the user gave it. Tickers left out are priced from Yahoo Finance. At most 150. | |
| carryover | No | US only: capital losses carried into this year from last year's return, in dollars, by term. | |
| residence | Yes | Where the user pays tax: US or FR (France). | |
| filing_status | No | US only: Form 1040 filing status (default single). Married filing separately caps the deduction at $1,500. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| us | No | ||
| url | Yes | ||
| asOf | Yes | ||
| rows | Yes | ||
| rule | Yes | ||
| year | Yes | ||
| leftOut | Yes | ||
| currency | Yes | ||
| daysLeft | Yes | ||
| lossTotal | Yes | ||
| notAdvice | No | ||
| residence | Yes | ||
| approximate | No | ||
| flatTaxRate | No | ||
| realizedNet | Yes | ||
| taxErasable | No | ||
| substantiallyIdentical | No |