Coding Dojo

Edit on Github

Wallet

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

Object

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

With rateProvider an implementation of this interface :

rateProvider.rate(FromCurrency, ToCurrency) -> float

Functional

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

Where rateProvider is a function with this signature :

rateProvider(FromCurrency, ToCurrency) -> float