The Ripple Network supports currency definitions that have interest or demurrage built into the currency. This page demonstrates the use of ripple-lib to perform necessary operations on these currencies, including:
Be sure to check out the source code.
Display values show the actual worth of a currency amount at a given point in time. Since interest applies continually, the worth of the currency holdings are only meaningful when they come with a reference time.
Ledger values are written in rippled
's shared global ledger. As an optimization, these do not change to reflect demurrage or interest. Instead, client applications calculate the ledger amount as the theoretical value that equals the desired display amount after applying constant interest/demurrage since the Ripple Epoch. (This also removes the need to indicate a start point for demurrage.)