A Script A Day – ConvCurrency – Day 04/05

Day 4 out of 5 of my “A Script A Day” challenge. Day 4: ConvCurrency, a simple currency converter using WebServiceX.net’s currency conversion web API.

Example usage:

./sd1.sh convcurrency JPY USD 240098
240098.000 JPY -> 2280.931 USD

This one is pretty straightforward. It accepts a currency pair and does the conversion you ask of it. Without an amount argument, it’ll default to 1 of the source currency. It’ll print 3 decimal places regardless of the currency, and of course the rates aren’t guaranteed to be exactly what the API returns. Especially when you start considering fees and the like which this doesn’t account for at all. It should give a pretty good ballpark number though. Link to the script-a-day repo.

convcurrency

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>