Nexto
HomeBlogAccounting
Accounting

Weighted Average Currency Cost — Know the True Cost of Each Currency

When you buy currency at different rates, what is the cost basis of each unit? The weighted average method and why, without it, exchange profit calculation comes out wrong.

6 min read · Nexto team · Last updated: August 7, 2026

The question seems simple: "How much did you buy each dollar for?" But at an active exchange, the answer to this simple question is not obvious at all. You do not buy dollars once; over days and weeks, you buy them in several rounds at different rates. After a few purchases, there is no longer a single "purchase price"; you have a set of different rates all mixed together in one till. Now when you want to sell part of these dollars, you need to know at what cost you sold them in order to figure out whether you made a profit or a loss.

The standard answer to this problem is the weighted average currency cost. This article explains that very method with a complete numeric example. If you want to see the overall picture of exchange accounting first, the complete guide to currency exchange accounting and operations is a good starting point.

Why doesn't "the last purchase rate" work?

It is tempting to say the cost of each dollar is the rate we paid on the most recent purchase. But this badly distorts profit. Suppose you bought dollars cheaply yesterday and the store is full; today you buy only 100 dollars at a high rate. If you value the whole balance at that same expensive rate today, it is as if your entire cheap balance became expensive overnight — and as a result you understate the sale profit. The reverse is just as misleading.

The correct method is to measure the cost basis on the weighted average of all purchases; that is, each purchase affects the average in proportion to its amount, not equally. A large purchase carries more weight in the cost basis; a small purchase, less weight. This logic is also followed from the angle of profit in the how exchange profit is calculated article.

The formula in plain language

The weighted average cost of each unit of currency comes from this ratio:

Weighted average = "total rial amount paid for purchases" divided by "total amount of currency purchased"

The important point is that this number is dynamic; it updates with every new purchase, but does not change with a sale. When you sell, you simply reduce the balance and apply the same current average cost to calculate profit; the average itself stays untouched until the next purchase.

A complete numeric example

Let us proceed with simple hypothetical numbers. Suppose the exchange starts with no dollars and makes two purchases:

Event Amount (dollars) Rate per dollar (rials) Amount paid (rials)
First purchase 10,000 60,000 600,000,000
Second purchase 5,000 66,000 330,000,000
Total balance 15,000 930,000,000

Now we calculate the weighted average cost of each dollar:

Weighted average = 930,000,000 ÷ 15,000 = 62,000 rials per dollar

Note that this number, 62,000, is neither equal to the first purchase rate nor the second; because the first purchase (10,000 dollars) carries more weight, the average falls closer to its rate. If we had naively taken the arithmetic mean of the two rates (60,000 and 66,000 would be 63,000), we would have gotten an incorrect number; because it ignored the different weight of the two purchases.

Now let us sell

Suppose a customer comes and buys 8,000 dollars from you; that is, you sell 8,000 dollars, at a sell rate of 65,000 rials:

Item Amount / rate Amount (rials)
Sale revenue 8,000 × 65,000 520,000,000
Cost basis (weighted average) 8,000 × 62,000 496,000,000
Trading profit 24,000,000

The profit on this sale is 24 million rials; equivalent to 3,000 rials of profit per dollar (65,000 minus 62,000). Now see what would happen if we got the cost basis wrong. If we calculated with the last purchase rate (66,000), the cost basis would be 528 million rials and the sale would appear to show an 8 million rial loss — whereas in reality we had made a profit! This single number can make your rate-setting decision completely wrong.

What remains after the sale?

After this sale, 7,000 dollars remain in the balance and — this is the key point — the average cost of each dollar is still 62,000 rials. A sale does not change the average. The book value of the remaining balance becomes 7,000 × 62,000 = 434 million rials. If tomorrow a new purchase is made at a different rate, then the average will be updated again on the basis of these remaining 7,000 dollars plus the fresh purchase.

Why must this be automatic in software?

On paper, this calculation is simple for one currency and a few purchases. But a real exchange has dozens of buys and sells a day and several currencies at once. Keeping each currency's average up to date by hand is both error-prone and practically impossible. That is why Nexto maintains the cost basis of each currency with the weighted average method automatically; with every purchase the average is recomputed, and with every sale the real profit is recorded on the basis of that same average.

This number is the basis of two important things. First, correct trading profit in the profit and loss report with Excel and PDF output. Second, correct valuation of the remaining balance, which becomes the basis of comparison when the current rate changes and you want to revalue the balance — a topic we have pursued in currency position and revaluation.

Conclusion

The weighted average currency cost is the correct answer to a seemingly simple question: "What did each unit of currency really cost me?" Taking the last rate or a simple arithmetic mean distorts profit and can make a profitable sale look like a loss and a losing sale look like a profit. The correct method is that each purchase affects the cost basis in proportion to its amount, the average updates with every purchase and stays untouched on a sale. When this calculation is automatic and precise, for the first time you can say with confidence how much profit each trade made.

See all of this inside Nexto

A complete, private instance with sample data — no install, no credit card.

Create free demo Related features ←
Chat on WhatsApp