Dealing with money

Hello all,

I’ve had a look at the Money gem and some others but I think they may be
overkill for what I want. Some advice would be nice.

I have a site where people pledge some money to an account. The amounts
could come from all over the world and I want the user to be able to
mark
the currency that they’re pledging in their currency.

I was thinking of having a table of currencies (symbols etc) and just
allowing the free selection of those. Store the amounts as decimal (no
calculations are being done on the values) along with the currency ID.

The formatting of the amounts will be ###,###.## (it doesn’t have to be
locale specific). I also wanted to have a breakdown of the different
currencies that go towards making the total …

55.00 GBP
175.00 USD
3000.00 CAN

3230.00

Something like that. It’s not overly important.

I have looked around for currencies in easily downloadable format
(JSON/YAML/XML) but haven’t found any good resources. Does anyone know
of
something?

CIA

-ants

Ants P. wrote in post #983192:

The formatting of the amounts will be ###,###.## (it doesn’t have to be
locale specific). I also wanted to have a breakdown of the different
currencies that go towards making the total …

55.00 GBP
175.00 USD
3000.00 CAN

3230.00

How does this total make any sense? The number 3230.00 is a meaningless
value without the currency unit and exchange rate.

I have looked around for currencies in easily downloadable format
(JSON/YAML/XML) but haven’t found any good resources. Does anyone know
of
something?

Downloadable format for what? Do you mean currency exchange rates?
Wouldn’t you need to know that? If someone were to pledge 55.00 GBP, do
you plan on converting that into a common local currency at the time of
the pledge? Or, do you plan on converting that pledge to a local
currency at the time the final donation is processed, based on the
exchange rate at that time?

What I’m saying is that not only does it not make sense to sum the
pledges, without first converting them to a common unit, but the
conversion factor between the units changes over time.

Hey,

I think you’re just looking for a simple database of known currency
labels. I don’t know of anything off the top of my head, but if you
check out Bloomberg’s currency conversion system:

http://www.bloomberg.com/markets/currencies/

You can view source and probably rip out the currency labels from the
select lists.

To re-iterate Robert’s point above, if it’s the conversion you’re
looking to do, I’d really recommend looking at a subscription-based
web service that your application can “talk to” in order to perform
the conversions, because global currency exchange rates fluctuate
every day, sometimes multiple times per day. It would be a NIGHTMARE
keeping up with that yourself, so a third party to do the conversions
for you would be a real life-saver! Unfortunately I can’t make any
specific recommendations for that kind of service, but I’m sure there
are plenty of companies out there who you could work with.

I hope this helps you out. Good luck!

On Feb 23, 2011, at 3:16 AM, Phoenix R. wrote:

To re-iterate Robert’s point above, if it’s the conversion you’re
looking to do, I’d really recommend looking at a subscription-based
web service that your application can “talk to” in order to perform
the conversions, because global currency exchange rates fluctuate
every day, sometimes multiple times per day. It would be a NIGHTMARE
keeping up with that yourself, so a third party to do the conversions
for you would be a real life-saver! Unfortunately I can’t make any
specific recommendations for that kind of service, but I’m sure there
are plenty of companies out there who you could work with.

If you can live with once per day updates, not closing rates or
anything specific, then this is a great resource:
http://www.bankofcanada.ca/en/markets/csv/exchange_eng.csv

All it sets out to do is document the difference between currencies
that day, nothing else.

I built a currency converter many years ago based on this file, and
it’s just CSV so it’s very easy to parse and use. Since it’s not SAAS
and it’s static (not analytical) I don’t think they pay too much
attention to the traffic numbers. My converter would just check to see
if the current cached copy was out of date, and get a new one if
needed, and then everything else was parsed into a hash and used to
drive the conversions from a base currency to a target.

Walter

On 23 February 2011 09:16, Phoenix R. [email protected]
wrote:

I hope this helps you out. Good luck!

3000.00 CAN

http://groups.google.com/group/rubyonrails-talk?hl=en.

Thanks for your replies.

To answer a few of your questions …

In my example, I gave a total of all amounts pledged. This of course
does
not make sense and I’m now not even sure why I wrote it (it was the last
thing I wrote before going to lala land). I have no intention of doing
that.

What I will do is, give totals for each currency used (which is what I
wanted to get over in my first mail).

As I said before, nothing complicated is happening with this. It’s just
a
simple pledge and people will make the actual payment on another site.
There
could be a lengthy time lapse between when the pledge was made and when
payment was made. It’s just a guide. That’s all. Hence, actual exchange
rates are not needed.

So I guess my question is; is it worth using the Money gem or is it
better
to store a few major currencies in a table, give the user the selection
and
then just add a simple general formatting rule.

I prefer the second option but I’m open to change my mind.

I will check out Bloomberg - Are you a robot? thank you
Phoenix R…

Again, thank you.