A Double Entry bookkeeping system stores both values, and requires that all transactions balance, as described in the Rule of Double Entry Accounting.
When we introduce the notion of having multiple currencies, or stocks that may vary in price, the identities get a little more complicated, and we introduce the following formulae:
value=exch-rate*amount (for currency accounts)
value=price*num-shares (for stocks/mutual-funds)
Thus, buying a widget in Japan (JPY) and using US Dollars (USD) to pay for it would appear thus:
SpendAcct: (an ordinary bank/cash acct valued in USD)
Date xfer from memo cost 1/5/99 [JPYAcct] Buy widget $1.00
JPYAcct: (a currency trading account valued in yen)
Date xfer from memo purchase rate 1/5/99 [SpendAcct] Buy widget Y150 0.00667
The engine links together all three of these values (1.0, 150, 0.00667) permanently and makes it impossible to change one without changing another, so that the grand total is always zero, thereby guaranteeing satisfaction of the rule of double entry accounting.