
- BEST FREE CURRENCY CONVERTER API INSTALL
- BEST FREE CURRENCY CONVERTER API FULL
- BEST FREE CURRENCY CONVERTER API DOWNLOAD
currencies # doctest: +SKIP set ([ 'SGD', 'CAD', 'SEK', 'GBP'. date ( 2016, 11, 14 )Ĭurrencies is a set containing all available currencies date ( 1999, 1, 4 ) > last_date # doctest: +SKIP datetime. convert ( 100, 'EUR', 'USD', date = date ( 2013, 3, 21 )) Decimal ( '129.100' ) Other attributesīounds lets you know the first and last available date for each currency > c = Currenc圜onverter ( decimal = True ) > c. This will slow down the load time by a factor 10 though. If you need exact conversions, you can use the decimal option to use decimal.Decimal internally when parsing rates. convert ( 100, 'EUR', 'USD', date = date ( 1986, 2, 2 )) Traceback ( most recent call last ): RateNotFoundError : 1986 - 02 - 02 not in USD bounds 1999 - 01 - 04 / 2016 - 04 - 29 > c = Currenc圜onverter ( fallback_on_wrong_date = True ) > c. We also have a fallback mode for dates outside the currency bounds: > c = Currenc圜onverter () > c. The fallback method can be configured with the fallback_on_missing_rate_method parameter, which currently supports "linear_interpolation" and "last_known" values. convert ( 100, 'BGN', date = date ( 2010, 11, 21 )) Traceback ( most recent call last ): RateNotFoundError : BGN has no rate for 2010 - 11 - 21īut we have a fallback mode for those, using a linear interpolation of theĬlosest known rates, as long as you ask for a date within the currency date bounds: > c = Currenc圜onverter ( fallback_on_missing_rate = True ) > c. urlretrieve ( ECB_URL, filename ) c = Currenc圜onverter ( filename ) Fallbacks
BEST FREE CURRENCY CONVERTER API DOWNLOAD
Since the raw data is updated only once a day, it might be better to only download it once a day: import os.path as op import urllib.request from datetime import date from currency_converter import ECB_URL, Currenc圜onverter filename = f "ecb_.

Current value is: # c = Currenc圜onverter ( SINGLE_DAY_ECB_URL ) # Load your custom file c = Currenc圜onverter ( './path/to/currency/file.csv' ) Current value is: # c = Currenc圜onverter ( ECB_URL ) # Dowload only the latest available day.
BEST FREE CURRENCY CONVERTER API FULL
You can use your own currency file, as long as it has the same format (ECB): from currency_converter import ECB_URL, SINGLE_DAY_ECB_URL # Load the packaged data (might not be up to date) c = Currenc圜onverter () # Download the full history, this will be up to date. You can change the date of the rate: > from datetime import date # datetime works too > c.

BEST FREE CURRENCY CONVERTER API INSTALL
Or use the Python package: $ pip install -user currencyconverter Command line toolĪfter installation, you should have currency_converter in your $PATH: $ currency_converter 100 USD -to EUR 100.000 USD = 87.512 EUR on Python APIĬreate once the currency converter object: > from currency_converter import Currenc圜onverter > c = Currenc圜onverter ()Ĭonvert from EUR to USD using the last available rate: > c. You can install directly after cloning: $ python setup.py install -user If you need the latest data, please refer to the data section. It uses embedded data in the library, which might not be up to date. Note that the currency converter does not query the API in real time, to avoid the overhead of the HTTP request. The converter can use different sources as long as the format is the same. It can be downloaded here: eurofxref-hist.zip. This is the ECB historical rates for 42 currencies against the Euro since 1999.

The default source is the European Central Bank. This is a currency converter that uses historical rates against a reference currency (Euro).
