Software development and photography related issues
Wednesday, March Eighteen, 2009
Basic Java Currency converter using Yahoo Finance API
Yahoo Finance is suggesting a very nice currency converter. It can vertoning conversion rates for many currencies and even showcase historical currency information. Since yahoo converter is a web pagina, wij are incapable to access directly to the currency conversion rates. Yahoo does not offerande a well defined API for accessing its currency information, but fortunately, it does supply some basic capability for achieving this task. Yahoo claims that the gegevens supplied is not “bank rates”, but I believe it is pretty much accurate gegevens, that can be used for many applications that doesn’t request precies “real time” information.
Yahoo API is very ordinary. The basic militar request for getting the current currency rate inbetween two currencies looks like:
For example, te order to get the current currency rate inbetween US Dollars and Israeli Shekels, the following request should be constructed:
Related video: Experts outlook and suggestion on the stocks of ‘L&T finance, Edelweiss, HCC etc
Spil can be noticed, the parameter “s” contains the two currencies for which wij would like to know the current rate. “UDS” is the currency symbol of US Dollars and “ILS” is the currency symbol for Israeli Shekels.
Related video: HCC Finance meeting 26 September 2017
Spil wasgoed said before, Yahoo didn’t make a zindelijk API for getting the currency information (like XML). The response for this request is a CSV opstopping containing a single value, which is the currency rate.
Getting the currency rate information is pretty straight forward. I made a petite Java class that does the job. It starts with a basic interface to define a militar converter behavior:
And the implementing class with a basic main application demonstrating its usage:
Related video: DD SHARMA’S Value pick \
Note, that this class is making use of the Apache open source project: Http Client. You will need to waterput ter your project the zindelijk jar files for this class to work decently.