JavaMoney/javamoney-examples

How to write custom ExchangeRateProvider

Closed this issue · 2 comments

I want to write custom exchange provider to provide the exchange rate manually with a csv file.

keilw commented

This example may not run right now, but it worked based on CSV files already: https://github.com/JavaMoney/javamoney-examples/tree/master/web/javamoney-tradingapp. Furthermore, javamoney-lib contains ExchangeRateProvider implementations for Yahoo, which is also CSV based.

You can take a look on IdentityRateProvider.java which is simplest provider which can be. In the same package you can find other rates providers.

Also here is more sophisticated rate provider fro cryptocurrencies
https://github.com/ConsensusJ/consensusj/blob/7b7ecc33038795e4e539cf9e991b3da0adfcd0f7/bitcoinj-money/src/main/java/com/msgilligan/bitcoinj/money/BaseXChangeExchangeRateProvider.java