Creating Custom Exchange Objects and Groups
Imagine that you have the following problem. You have exchange rates for many currencies, but all of the rates are for converting currencies to and from US Dollars. There are no rates for directly converting currency A to currency B when neither A nor B are US Dollars. However, it’s likely that you have rates for exchanging A and B to and from US Dollars. In such cases, you can employ an indirect conversion strategy for converting A to B, using US Dollars as the base currency.
This section describes how you can create a class called
USDollarBaseExchange to implement such an exchange strategy. The class created here can be used by itself or as an implementation for the
RWExchange class.