Gloss Tools

Switching language or leaving the page discards the draft.

繁體中文

Stock Average Cost Calculator

Bought the same stock in several lots and sold part of it? Enter shares and prices in the order they happened (up to 20 trades), with one optional fee rate; the tool relieves cost on a FIFO basis and shows current holdings, remaining cost, average cost, and realized profit or loss per sell. It runs locally, never connects to a brokerage account, and uses the currency unit you enter.

Input

One rate applies to the whole list; 0 means no fees. 100 basis points = 1%. Buy fees add to cost, sell fees reduce proceeds; securities transaction tax is not included.

Trades

In the order they happened; the row order is the processing order and is never sorted for you.
SideSharesPrice per shareActions
Rules and limits
  • At most 20 trades; shares are whole numbers from 1 to 999,999,999; price per share has up to 7 integer digits and 4 decimal digits, minimum 0.0001.
  • Fee rate from 0 to 1000 basis points (0%–10%). Each fee is the trade amount times the rate, rounded half-up to 0.0001.
  • Sells relieve the earliest buy lots first (FIFO); a lot that is fully relieved settles at exactly its remaining cost, leaving no rounding residue.
  • Amounts are computed exactly in units of 0.0001 with no floating point; the average cost is rounded half-up to 0.0001.
  • A sell larger than the shares held at that point fails the whole run and points at that sell row.
  • Securities transaction tax, the health-insurance supplementary premium, and dividends are not included; results are estimates, not a brokerage statement or a tax document.

Enter trades, or load the example.

Frequently asked questions

How is sell cost relieved?
FIFO: the earliest buy lots are relieved first, and a lot that is fully relieved settles at exactly its remaining cost.
How are fees calculated?
Each trade's fee is its amount times the rate, rounded half-up to 0.0001; buy fees add to cost, sell fees reduce proceeds. The rate is entered in basis points (100 bps = 1%). Securities transaction tax is not included.