Close Portfolio Lot
ClosePortfolioLotRecord that the USER sold (or covered, or let expire) all or part of a lot, at a price and on a date. The lot moves out of the open positions and its realized profit is kept. Ask the user for the closing price and date; never guess them from a market quote.
Closing PART of a lot splits it: the closed part keeps the original cost basis and the rest stays open on that same basis, so a later sale is still priced against what was actually paid.
An option that expired worthless closes at a price of 0. An option that was exercised or assigned closes here too, and the resulting shares are a separate AddPortfolioLot.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lotId | Yes | The lot id shown by GetMyPortfolio, e.g. a1b2c3d4. | |
| quantity | No | Optional. How much of the lot to close, as a positive size. Omit to close all of it. | |
| closeDate | Yes | The closing date, as yyyy-MM-dd. Cannot be in the future or before the lot was acquired. | |
| portfolio | Yes | The portfolio holding the lot, by name. | |
| closePrice | Yes | Price per share received (or paid, to cover a short). Zero for an option that expired worthless. |