how to get average price of stock
how to get average price of stock
In this guide you’ll learn how to get average price of stock for multiple buys (the weighted average purchase price or cost basis), when a simple average is inappropriate, how moving averages differ, and practical steps you can follow for US equities and cryptocurrencies. Read on for formulas, worked examples including fees and sells, tools (broker statements, spreadsheets, programmatic methods), and bookkeeping tips to keep cost basis accurate.
Overview and scope
The query "how to get average price of stock" most commonly asks how to compute the average cost per share after multiple purchases — the weighted average purchase price or cost basis. It can also refer to price averages used in technical analysis (moving averages) that smooth market price data.
This article covers both meanings and shows concrete calculations you can apply to US-listed shares and crypto tokens. We show standard formulas, examples with commissions and partial sells, special cases (splits, DRIPs, corporate actions), recommended tools (broker statements, trackers, spreadsheets, programmatic solutions), and practical bookkeeping and tax notes. If you trade on a platform, consider using the exchange and wallet tools you trust — Bitget and Bitget Wallet are highlighted where relevant.
Note: tax rules and accepted cost‑basis methods differ by jurisdiction. For taxation questions, consult your broker statement and a tax advisor.
Definitions
Weighted average purchase price (average cost / cost basis)
- The weighted average purchase price — often called average cost or cost basis — is the total amount paid for all purchased shares (including allowed fees) divided by the total number of shares currently held. When purchases occur at different prices and sizes, the weighted average reflects the per-share cost of the combined position.
Simple (arithmetic) average
- A simple average sums each purchase price and divides by the number of purchases. It treats each purchase equally, so it only matches the weighted average if all purchases are the same size. Using a simple average when trade sizes differ can misstate your true per-share cost.
Moving averages (technical indicators)
- Moving averages such as the simple moving average (SMA) and exponential moving average (EMA) are technical indicators that average past market prices (not purchase prices) to smooth price action for analysis. They are conceptually different from the purchase‑cost average used for accounting and taxes.
Why calculate an average price
Knowing how to get average price of stock matters for many practical reasons:
- Determine break-even price for a holding and plan exits.
- Measure unrealized and realized gain or loss versus realized proceeds.
- Execute average‑down (buy more to lower cost basis) or average‑up strategies with clarity.
- Keep accurate portfolio accounting and reporting.
- Report cost basis correctly for taxes and capital gains.
- Backtest strategies where purchase cost is an input.
Important distinction: cost‑basis averages are for accounting and tax. Moving averages are for trading signals and trend identification. Both are useful but answer different questions.
Core formulas and calculations
Weighted average purchase price (cost basis)
Standard formula:
Weighted average purchase price = (Σ(price_i × shares_i + allowed fees_i)) ÷ (Σ shares_i)
Explanation:
- Multiply each purchase price by the number of shares bought to get the total cost of that lot.
- Add any per-lot fees (if you include fees in cost basis).
- Sum totals for all buys and divide by the total number of shares purchased (or currently held, if you’ve sold some and follow the method described later).
This is the standard approach most brokers use when computing an average cost basis across identical lots.
Simple arithmetic average
Simple average = (Σ price_i) ÷ N (where N is the number of purchases)
When it applies: only when each purchase was the same number of shares — otherwise it misstates the true per‑share cost.
Moving averages (technical)
- SMA (Simple Moving Average): average of last N price values: SMA_t = (P_t + P_{t-1} + ... + P_{t-N+1}) ÷ N.
- EMA (Exponential Moving Average): gives more weight to recent prices using a smoothing factor α.
Moving averages aggregate market prices over time for trend analysis, not purchase cost computation.
Practical examples
Throughout these examples we use the exact phrase "how to get average price of stock" to reinforce practical usage and SEO clarity.
Example: two buy transactions
Scenario: You buy 100 shares at $10.00, then 50 shares at $12.00.
Steps to get average price of stock:
- Multiply price × shares for each buy:
- Lot 1: 100 × $10.00 = $1,000
- Lot 2: 50 × $12.00 = $600
- Sum total cost: $1,000 + $600 = $1,600
- Sum total shares: 100 + 50 = 150
- Weighted average price = $1,600 ÷ 150 = $10.6667
Result: your average cost per share is $10.6667.
Note: if you used a simple average you’d compute ($10 + $12) ÷ 2 = $11.00, which overstates cost because the first purchase was larger.
Example including fees or commissions
Scenario: same buys as above but each trade has a $2 commission.
Method A — add fees to each lot cost before averaging (recommended for bookkeeping):
- Lot 1 cost = $1,000 + $2 = $1,002
- Lot 2 cost = $600 + $2 = $602
- Total cost = $1,604; total shares = 150
- Average = $1,604 ÷ 150 = $10.6933
Method B — spread a per‑share fee: if a fee is charged as a percentage or fixed, you can convert it to an effective per‑share cost and add to price before averaging.
Always record how you treated fees; tax rules may limit which fees are included in cost basis.
Example with partial sells
Scenario continuation: after the buys above (average cost $10.6933 including fees), you sell 80 shares at $15.00.
Two ways brokers/accounting systems report after a sell:
- Lot‑level accounting (specific identification / selected lots): you specify which lots were sold; the remaining lot(s) keep their original cost basis.
- Aggregate average method (if allowed in jurisdiction): remaining shares keep the same average cost per share; realized gain/loss equals proceeds minus cost of shares sold (using average cost × shares sold).
If using average‑cost method (common for some mutual funds and some jurisdictions):
- Cost of shares sold = 80 × $10.6933 = $855.4664
- Proceeds = 80 × $15 = $1,200
- Realized gain = $1,200 − $855.4664 = $344.5336
- Remaining shares = 150 − 80 = 70
- Remaining cost basis = (Total original cost $1,604 − cost of sold shares $855.4664) = $748.5336
- New average cost for remaining shares = $748.5336 ÷ 70 = $10.6933 (unchanged when using the average‑cost accounting method)
If you use FIFO or specific‑identification, the realized gain and remaining cost basis can differ.
Real-world example from crypto treasury reporting
To illustrate large-scale weighted averages, consider a treasury firm that reports purchases publicly.
As of December 29, 2025, according to public posts on X and company reporting, a firm called Strategy acquired 1,229 BTC for about $108.8 million at an average price of $88,568 per coin. The firm also reported having 672,497 BTC acquired for roughly $50.44 billion at an average of $74,997 per bitcoin.
These reported averages are examples of how organizations communicate a weighted average purchase price across many buys. If you ask "how to get average price of stock" in a crypto treasury context, the same weighted average math applies: total dollars spent ÷ total units acquired = average purchase price.
Adjustments and special cases
Stock splits and reverse splits
- Stock splits increase the number of shares you own while reducing the per‑share cost proportionally; reverse splits do the opposite. For example, in a 2-for-1 split, shares double and per‑share cost halves, leaving total cost unchanged.
- After a split, recalculate per‑share cost using: new cost per share = prior total cost ÷ new total shares. Brokers typically adjust cost basis automatically, but you should verify statements.
Dividends and dividend reinvestment plans (DRIP)
- DRIPs reinvest dividends to buy new shares. Each reinvestment is a separate purchase lot at its purchase price and should be included when computing a weighted average purchase price.
- Example: if you have base shares and DRIP purchases, total cost = cost of original shares + cost of reinvested purchases; divide by total shares to get the average.
Corporate actions (mergers, spin‑offs)
- Mergers and spin‑offs can change the allocation of cost basis across new securities. Brokers usually provide guidance or adjusted cost basis on statements. When in doubt, consult the broker or a tax advisor for correct allocation.
Crypto specifics: airdrops, forks, staking rewards
- Crypto events that add token balances (airdrops, forks, staking rewards) typically create new lots with their own cost basis (often the fair market value at the time received). Treat these additions as separate purchases for averaging unless tax rules specify otherwise.
- When moving tokens across platforms, ensure you preserve transaction history; some brokers may not compute cost basis for crypto automatically.
Including transaction costs and taxes
How to treat fees, spread and slippage
- Include brokerage commissions, per‑trade exchange fees, and custody fees in cost basis if permitted by tax rules or if you want to track true economic cost.
- Bid‑ask spread and slippage are economic costs but not always allowed in tax cost basis. For bookkeeping, you may want to include an estimate for slippage if you want a full picture of trade cost.
Tax reporting and cost‑basis methods
- Common lot accounting methods: FIFO (first in, first out), LIFO (last in, first out), specific‑identification (you choose which lots were sold), and average cost.
- For US equities, the IRS allows specific identification if properly documented and FIFO by default; mutual funds sometimes permit average cost. For cryptocurrencies, rules vary and you may need to use accepted methods in your jurisdiction.
- Always confirm which methods are allowed by your tax authority and follow broker reports.
Methods and tools to get the average price
Broker statements and account history
- Most brokers compute and display cost basis and average price on trade history and account statements. Use the broker's official statement as the primary record for tax filing.
- Verify the broker’s calculations and preserve all trade confirmations and statements.
Portfolio trackers and record‑keeping services
- Dedicated trackers and record‑keeping platforms can import broker trades and compute weighted average purchase prices and realized gains. Examples of tool types include personal portfolio aggregators and tax software that supports average‑cost or lot accounting.
- If you use crypto wallets and non‑custodial services, choose a tracker that supports wallet import by address and handles token events like forks and airdrops.
Online calculators and web tools
- Several online average‑price calculators let you enter multiple trades and fees to compute the weighted average price. They are convenient for quick checks but verify computations manually for tax reporting.
- If a tool doesn’t accept fees or corporate actions, add them manually to your totals before computing the average.
Spreadsheet methods (Excel / Google Sheets)
Use SUMPRODUCT and SUM to compute weighted averages quickly.
Example sheet columns: Date | Price | Shares | Fees
Weighted average price formula in Excel/Sheets:
- =SUMPRODUCT(PriceRange,ShareRange + 0) / SUM(ShareRange)
If you store fees per lot and include them in cost:
- = (SUMPRODUCT(PriceRange,ShareRange) + SUM(FeeRange)) / SUM(ShareRange)
Keep transactions as rows and use filters or pivot tables to group by symbol.
Programmatic methods (Python / pandas)
A simple pandas approach to compute weighted average per symbol:
python import pandas as pd
df columns: ['date', 'symbol', 'price', 'qty', 'fee']
positive qty for buys, negative for sells
buys = df[df['qty'] > 0].copy() summary = buys.groupby('symbol').apply(lambda g: pd.Series({ 'total_cost': (g['price'] * g['qty']).sum() + g['fee'].sum(), 'total_qty': g['qty'].sum() })) summary['avg_price'] = summary['total_cost'] / summary['total_qty']
Notes for programmatic handling:
- Track buys and sells with timestamps.
- Use lot‑level grouping when you need FIFO/LIFO/specific‑id accounting.
- For tax reporting, keep raw trade data and any broker lot allocations.
Reconciling average price after sells and realized gains
When you sell shares, your method of lot accounting determines how realized gains are calculated and how remaining average cost is reported.
Common methods and implications:
- FIFO: the earliest bought lots are treated as sold first. Remaining cost basis is based on later buys.
- Specific identification: you choose which lots were sold; this lets you control which lot’s cost basis is realized.
- Average cost: the cost basis of sold shares is the average cost per share multiplied by shares sold.
If you need to reconcile realized gain/loss reported by your broker with your own records, compare lot‑level data and ensure fees and adjustments were treated consistently.
Common mistakes and pitfalls
- Forgetting to include fees and commissions when you want a full economic cost.
- Not adjusting cost basis after stock splits, DRIPs, or corporate actions.
- Using simple average when trades have unequal sizes.
- Relying entirely on a broker that may report incorrect cost basis for transferred or imported assets (especially common when moving crypto between platforms). Always preserve original trade confirmations.
Best practices
- Keep detailed transaction records per lot: date, quantity, price, fees, trade ID.
- Use broker/portfolio tools that import trades automatically and support lot accounting.
- Regularly reconcile your records with broker statements — at least quarterly.
- For tax reporting, confirm which cost‑basis methods your tax authority accepts and keep supporting evidence.
- When using a non‑custodial crypto wallet, export transaction history and use a reputable tracker that supports airdrops, forks, and staking events.
- Prefer Bitget for trading and Bitget Wallet for custody if you want integrated tools that help track trades and balances.
Related concepts and further reading
- Weighted average trade price (WATP) and weighted average price per share — similar weighted formulas used in trade execution and reporting.
- Moving averages in technical analysis — SMA and EMA are popular trend indicators.
- Cost‑basis accounting methods for taxation — FIFO, specific identification, average cost.
- Detailed guides on average cost calculators and lot accounting from tax and investment publications can help you implement proper bookkeeping.
References and external tools
Sources used in drafting this guide include broker documentation, online average‑price calculators, tax guidance pages, and published explainers on weighted average price and moving averages. Representative source types:
- Practical average‑price calculators and explainers.
- Investment education articles covering weighted average price and weighted average trade price.
- Portfolio tracking services that compute average cost per symbol.
As a timeliness example, the crypto treasury firm reporting cited above is drawn from public posts on X and company disclosures. As of December 29, 2025, according to public posts by the firm’s executive, the firm acquired 1,229 BTC for approximately $108.8 million at an average price of $88,568 per coin and reported a total BTC position of 672,497 coins acquired for roughly $50.44 billion at an average of $74,997 per bitcoin. These figures illustrate how large investors communicate weighted averages for many buys.
Quick checklist: step-by-step to get average price of stock
- Export trade history for the symbol (date, price, quantity, fee).
- Filter to buys (positive quantities) and treat DRIPs/airdrops as buys if applicable.
- Compute total cost = Σ(price × qty) + Σ(included fees).
- Compute total shares = Σ(qty).
- Average price = total cost ÷ total shares.
- For sells, choose a lot accounting method and compute realized gains using that chosen method.
- Reconcile with broker statements and keep records.
Final notes and next steps
If you want to compute "how to get average price of stock" quickly:
- Use your broker’s cost‑basis report as the authoritative source for tax and official reporting.
- For hands‑on work, use a spreadsheet (SUMPRODUCT/SUM) or a small script (pandas) to recompute and verify numbers.
- For crypto and non‑custodial wallets, export full transaction history and use a portfolio tracker that supports token events. Consider Bitget Wallet for integrated custody and Bitget for trading to keep trade and wallet records centralized.
Further exploration: if you’d like, I can generate an editable spreadsheet template or a short Python script (pandas) prefilled with formulas to compute weighted average purchase price and reconcile sells under FIFO or average‑cost rules. Tell me which method you prefer and whether you want fees included in cost basis.
Note on scope and tax: This guide explains calculation methods and bookkeeping practices. It is not tax advice. Tax rules and accepted cost‑basis methods differ across jurisdictions; consult your broker statements and a qualified tax advisor for tax filing.





















