PnLLiquidationBreak-evenTarget ExitPosition SizerFunding CostAverage EntryScenarioMax LeverageFunding ArbHedge RatioCompound FundingCrypto ProfitCrypto DCAAverage Buy PriceTarget Sell PricePresent ValueFuture ValueNPVIRRCAGRAPY / APRBond PricePre-Trade CheckRisk / RewardPortfolio RiskCarry TradeDCA EntryAverage Down?Scale-OutFunding BreakevenRug Pull CheckerSwap Price ImpactBonding CurveMarket Cap CalculatorWallet CheckerImpermanent Loss CalculatorProbability CalculatorMarket-Implied OddsKelly CalculatorUp/Down Fair ValueSpread CheckerArbitrage CheckerBlack-Scholes CalculatorOptions Payoff CalculatorStraddle & Strangle CalculatorCovered Call & Protective Put CalculatorImplied Volatility CalculatorSpread & Iron Condor CalculatorBarrier Touch CalculatorAmerican Option CalculatorOption Greeks CalculatorOptions Profit CalculatorOptions Strategy PickerMax Pain CalculatorCash-Secured Put CalculatorPip Value CalculatorMargin Level CalculatorBreakeven CalculatorPnL CalculatorRisk/Reward CalculatorScenario CalculatorAverage Entry CalculatorMargin Required CalculatorCurrency ConverterPosition Size CalculatorSwap / Rollover CalculatorCorrelation CalculatorFibonacci Retracement CalculatorOpen AnalysisSession StructureValue MigrationBreakout AcceptanceVaR / CVaR CalculatorSharpe Ratio CalculatorHurst Exponent CalculatorCointegration TestPortfolio TearsheetGARCH Volatility CalculatorRisk Parity CalculatorDeflated Sharpe Ratio CalculatorKelly Growth-Security FrontierReturn Unsmoothing CalculatorEVT Tail Risk CalculatorMonte Carlo Simulation CalculatorEvent Study CalculatorOrder-Book Impact CalculatorDocs

Average Buy Price Calculator

CRYPTO SPOT · BUYS AND SELLS · FEES INCLUDED

You bought and sold the same coin several times. What is the real entry price of what you still hold? Enter the trades in order with their fees.

4 trades in the order they happened
Example · three buys and a sale

Each line: buy or sell, coins, price, and the fee of that trade in percent (optional, 0 if left out).

Average buy price of what you hold

$53,453.4

1 coins held

Cost basis of the coins held

$53,453.40

Break-even sell price

$53,506.90691

Average before fees

$53,400

Total invested in buys

$64,864.80

Realized profit on sales

+$1,575.60

Fees paid so far

$77.80

A sale takes coins out at your current average, so it never changes the average of what is left; only a later buy does.

How to use the average buy price calculator

  1. Write your trades in the order they happened, one per line: buy or sell, the coins, the price.
  2. Add the fee of each trade in percent at the end of the line, or leave it out for no fee.
  3. Enter the sell fee you expect when you sell the coins you still hold.
  4. Read the average buy price of what you hold and the break-even sell price.
  5. Open Show the math to see how the cost basis moved.

Average buy price formula

  • Buy: cost += quantity × price × (1 + fee); held += quantity
  • Sell: cost basis removed = quantity × cost / held; held −= quantity
  • Realized profit += quantity × price × (1 − fee) − cost basis removed
  • Average buy price = cost / held
  • Break-even sell price = average buy price / (1 − sell fee)

Where to go next

Equal buys at a list of prices? Use the Crypto DCA Calculator. Where should you sell to make a target return? Try the Target Sell Price Calculator, or see the result of a finished trade in the Crypto Profit Calculator.

Use via API or MCP

The same calculation is available as the MCP tool workflow.run_average_buy_price: a portfolio tracker, a tax-prep script or an AI agent gets the exact average price, with every step reproducible from the formulas above.

EMBED ON YOUR SITE

<!-- TradingCalc widget: please keep the link below exactly as given (address and words) -->
<div class="tradingcalc-widget" data-widget="average-buy-price-calculator"><a href="https://tradingcalc.io/average-buy-price-calculator?utm_source=embed&amp;utm_medium=backlink&amp;utm_campaign=average-buy-price-calculator">Average Buy Price Calculator by TradingCalc.io</a></div>
<script async src="https://tradingcalc.io/embed.js"></script>

Free, no signup. Keep the text link in the code exactly as given, with its address and its words: it is the attribution and it points visitors to the full calculator. Change colors, size and start values or read the installation guide and FAQ.

FAQ
Q.01

What assumptions and edge cases does this calculator use?

Trades are read in the order you list them, 1 to 1000 lines, each as buy or sell, coins, price and an optional fee in percent (0 if left out, at most 5%). The buy fee is part of the cost basis; a sale removes coins at the current average and never changes it. Selling everything resets the average, and the next buy starts a new one; with nothing held the average and break-even show as not available. A sale before any buy, or of more than you hold at that point, is an error naming the line. A sale within 1e-12 of the largest holding since the position was last flat counts as selling everything, which absorbs float noise such as 0.1 + 0.2 - 0.3. Realized profit can be negative. Prices can be in any currency and results come back in it. Not covered: taxes, FIFO or LIFO lots (this is a moving average cost only), slippage, withdrawal or network fees, currency conversion, leverage and funding.

Q.02

How do I calculate my average buy price after selling some coins?

A sale takes coins out at your current average cost, so the average of what is left does not change. Only a later buy changes it. If you hold 2 coins at an average of $150 and sell 1, you still hold 1 coin at $150.

Q.03

Is the buy fee part of the average?

Yes. The average buy price shown is the cost per coin with the buy fee in it; the average before fees is shown beside it.

Q.04

What happens when I sell everything?

The average resets. Nothing is held, the profit is realized, and the next buy starts a new average.

Q.05

What if I sell more than I hold?

That is an error, and the message names the trade where the holding runs out, so a typo in a quantity is easy to find.

Q.06

How is this different from the DCA calculator?

The DCA calculator takes equal cash amounts at a list of prices. This one takes any buys and sells, each with its own size and fee.