2026-01-08 · Kiveo Stock

How to calculate weighted average cost for A-shares

Step-by-step guide to calculating your true cost basis when you buy the same stock at multiple prices. Includes Excel formulas and a free tracker.

When you buy the same A-share at different prices, your weighted average cost is the real number that tells you whether you’re up or down. This guide shows you how to compute it by hand and why our free A-share portfolio tracker does it for you.

What is weighted average cost?

Your weighted average cost is the average price you paid per share, weighted by how many shares you bought at each price.

If you bought 100 shares of 平安银行 at ¥10, then another 100 at ¥12:

  • Total cost: 100 × 10 + 100 × 12 = ¥2,200
  • Total shares: 200
  • Weighted average cost: 2,200 / 200 = ¥11

That’s the number to compare against the current price to know your P&L.

Why it matters

A common mistake is to look at the latest buy price and call it your “cost”. If you bought 100 at ¥10 and then 1 share at ¥12, your cost is closer to ¥10.01, not ¥12.

When to use FIFO or LIFO instead

  • FIFO (First In, First Out) matches each sell to the oldest buy. Required by some tax authorities.
  • LIFO (Last In, First Out) matches each sell to the newest buy. Useful for tax-loss harvesting.
  • Weighted average is the simplest mental model and what most retail investors use.

The formula

For each buy:

weighted_cost = sum(buy_price × buy_shares) / sum(buy_shares)

When you sell, the weighted cost of the remaining position adjusts.

A free tool to track this for you

Kiveo Stock is a free, privacy-first A-share portfolio tracker that computes weighted average cost (and FIFO and LIFO) automatically. It runs in your browser, stores nothing on a server, and supports 5,000+ A-shares.

Try it: Open the app.

Ready to take control of your A-share portfolio?

Start using the free A-share portfolio tracker in under 30 seconds. No signup, no credit card.

Open the App