Also, force a reload by switching "to currency" from settings tab, save, and reload the web pages. Try to reload the browser (F5 button) and check the internet connection. If conversion does not work, it probably means that there was no reply from Yahoo. Your location is used to set your default region and currency (for example Finland - euro). Settings can be reset to default with the "Reset" button.Ĭurrency quotes are taken from Yahoo Finance and updated when you start the program, reset the quotes. The settings tab is opened with the "Options" menu item.Ĭhanged settings are saved with the "Save" button in the settings tab. Open a quotes page that can be sorted by value and currency. The button will open a popup with the following items: After installation, you'll have a new button in the toolbar. 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 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. 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. 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).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |