Exchange rates

5 views
Skip to first unread message

Mario Majcica

unread,
May 12, 2011, 4:51:35 AM5/12/11
to NMoneys
Hi,

did you tough about creating a class that will manage exchange between
currencies? How about creating a class that will contain the exchange
logic and will use a provider pattern in order to gain the data. On of
the providers could use http://www.ecb.int/stats/exchange/eurofxref/html/index.en.html#dowloads
in order to easily get the newest exchange rates.
Do you need dev help on this project?

Mario Majcica

dgon

unread,
May 12, 2011, 5:21:24 AM5/12/11
to NMoneys
Hi Mario,

Some other users have already asked for this feature, so it is
something that definitely will get added.
I am trying to get my head around the design of such feature. And yes,
a provider pattern with a default implementation will make a lot of
sense to me.

But definitely such design will encapsulate the exchange logic
somewhere. Problem is, I do not have any experience in performing
calculations to exchange monetary quantities.
For example, I do not know what rules have to be applied (if any). Is
that something that you could help with?

Regards

On May 12, 10:51 am, Mario Majcica <mario.majc...@gmail.com> wrote:
> Hi,
>
> did you tough about creating a class that will manage exchange between
> currencies? How about creating a class that will contain the exchange
> logic and will use a provider pattern in order to gain the data. On of
> the providers could usehttp://www.ecb.int/stats/exchange/eurofxref/html/index.en.html#dowloads

Mario Majcica

unread,
May 12, 2011, 5:31:28 AM5/12/11
to nmo...@googlegroups.com
Hi Daniel,

there is no particular logic in a pure exchange. The exchange is based
on a rate that is established by a competent authority for your
country. In EU at ex. that is ECB, which offers daily this data as an
xml file.
If you check up this document, you will see that this rates refers to
EUR as currency, <Cube rate="1.4357" currency="USD"/>, it means that
for 1 € you will get 1.4357 $, and so on.
If we create a proper class that will manage all exchange operations,
and "feed her" with data from different sources (based on provider
model), anyone if needed can implement a provider for gathering this
data from the source that he needs to use and still preserve all app
logic and use all the features of the exchange class.

This weekend I will have some spare time and I will get a deeper look
on your work and try to write down a couple of ideas.

Regards,

Mario Majcica

Daniel González García

unread,
Jun 2, 2011, 1:00:12 PM6/2/11
to nmo...@googlegroups.com
Hi again Mario,

I have been doing some work on a Exchange extension to NMoneys that allows convert moneys from one currency to another.
The implementation provides the functionality as extension methods to Money. The whole exchange arithmetic is swappable by implementing a complete IExchangeRateProvider or by tweaking the existing TabulatedExchangeProvider by providing an inheritor of ExchangeRate.

Have a look at the source code in http://code.google.com/p/nmoneys/source/browse/#svn%2Fbranches%2FExchange and let me know your opinion. It is a different project included in the NMoneys solution that will be released as another package dependent of NMoneys.

Cheers
Reply all
Reply to author
Forward
0 new messages