Coding Dojo

Edit on Github


Given a Wallet they contain Stocks like Euros, bitcoins and Dollars, build a function they compute the value of wallet in an other currency.


Value value = Wallet(Stock(5, USD)).value(EUR, rateProvider)

With rateProvider an implementation of this interface :

rateProvider.rate(FromCurrency, ToCurrency) -> float


Value value = compute_value(Wallet(Stock(5, USD), EUR, rateProvider))

Where rateProvider is a function with this signature :

rateProvider(FromCurrency, ToCurrency) -> float