Skip to main content

Data Science Tools for Monetary Information and Conversions.

Project description

Overview

Project Summary

This package is primarily intended to be used in the domain of Data Science to simplify the process of analysing data sets which contain money information. Often, the financial information within, and very often between, data sets is separated in time (inflation), currency (conversion) as well as the ways in which these sources refer to the currency being used (e.g., country codes vs. currency codes). Conventionally, this has required handcrafting a solution to control for these differences on a case-by-case basis. EasyMoney is intended to streamline this process to make comparisons across these dimensions extremely simple and straightforward.

Feature Summary

  • Computing Inflation

  • Currency Conversion

  • Adjusting a given currency for Inflation

  • ‘Normalizing’ a currency, i.e., adjust for inflation and then convert to a base currency.

  • Relating ISO Alpha2/3 Country Codes, Currency Codes as well as a Region’s Name to one another.

  • This tool automatically obtains the latest inflation and exchange rate information from online databases.

NOTICE: THIS TOOL IS FOR INFORMATION PURPOSES ONLY.


Dependencies

EasyMoney requires: numpy, pandas, pycountry, requests and wbdata.


Installation

Python Package Index:

$ pip install easymoney

Latest Build:

$ pip install git+git://github.com/TariqAHassan/EasyMoney@master

EasyMoney is compatible with Python 2.7 and 3.3+.


Examples

Import the tool

from easymoney.money import EasyPeasy

Create an instance of the EasyPeasy Class

The standard way to do this is as follows:

ep = EasyPeasy()

However, fuzzy searching can also easily be enabled.

ep = EasyPeasy(fuzzy_threshold=True)

Prototypical Conversion Problems

1. Currency Converter

ep.currency_converter(amount=100000, from_currency="USD", to_currency="EUR", pretty_print=True)

# 94,553.71 EUR

2. Adjust for Inflation and Convert to a base currency

ep.normalize(amount=100000, region="CA", from_year=2010, to_year="latest", pretty_print=True)

# 76,357.51 EUR

3. Convert Currency in a more Natural Way

ep.currency_converter(amount=100, from_currency="Canada", to_currency="Ireland", pretty_print=True)

# 70.26 EUR

Handling Common Currencies

1. Currency Conversion

ep.currency_converter(amount=100, from_currency="France", to_currency="Germany", pretty_print=True)

# 100.00 EUR

EasyMoney understands that these two nations share a common currency.

2. Normalization

ep.normalize(amount=100, region="France", from_year=2010, to_year="latest", base_currency="USD", pretty_print=True)

# 111.67 USD
ep.normalize(amount=100, region="Germany", from_year=2010, to_year="latest", base_currency="USD", pretty_print=True)

# 113.06 USD

EasyMoney also understands that, while these two nations may share a common currency, the rate of inflation in these regions could differ.

Region Information

EasyPeasy’s region_map() method exposes some of the functionality from the pycountries package in a streamlined manner.

ep.region_map('GB', map_to='alpha_3')

# GBR
ep.region_map('GB', map_to='currency_alpha_3')

# GBP

If fuzzy searching is enabled, the search term does not have to exactly match those stored in the databases cached by an EasyPeasy instance.

For example, it is possible to find the ISO Alpha 2 country code for ‘Germany’ by passing ‘German’.

ep.region_map('German', map_to='alpha_2')

# DE

Options

It’s easy to explore the terminology understood by EasyPeasy, as well as the dates for which data is available.

ep.options()

Region

Alpha 2

Alpha 3

Currenci es

InflationD ates

ExchangeDates

Overlap

Austral ia

AU

AUS

AUD

[1960, 2015]

[04/01/1999, 29/11/2016]

[04/01/1999, 31/12/2015]

Austria

AT

AUT

EUR

[1960, 2015]

[04/01/1999, 29/11/2016]

[04/01/1999, 31/12/2015]

Belgium

BE

BEL

EUR

[1960, 2015]

[04/01/1999, 29/11/2016]

[04/01/1999, 31/12/2015]

Above, the ‘InflationDates’ and ‘ExchangeDates’ columns provide the range of dates for which inflation and exchange rate information is available, respectively. Additionally, all dates for which data is available can be show by setting the range_table_dates parameter to False. The ‘Overlap’ column shows the range of dates shared by the ‘InflationDates’ and ‘ExchangeDates’ columns.


License

This software is provided under a BSD License.


Resources

Indicators used:

  1. Consumer price index (2010 = 100)

    • Source: International Monetary Fund (IMF), International Financial Statistics.

      • Notes:

        1. All inflation-related results obtained from easymoney (including, but not necessarily limited to, inflation rate and normalization) are the result of calculations based on IMF data. These results do not constitute a direct reporting of IMF-provided data.

  2. Euro foreign exchange reference rates - European Central Bank

    • Source: European Central Bank (ECB).

      • Notes:

        1. The ECB data used here can be obtained directly from the link provided above.

        2. Rates are updated by the ECB around 16:00 CET.

        3. The ECB states, clearly, that usage of this data for transaction purposes is strongly discouraged. This sentiment is echoed here; as stated above, this tool is for information purposes only.

        4. All exchange rate-related results obtained from easymoney (including, but not necessarily limited to, currency conversion and normalization) are the result of calculations based on ECB data. These results do not constitute a direct reporting of ECB-provided data.

Sherouse, Oliver (2014). Wbdata. Arlington, VA.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

easymoney-1.5.0.tar.gz (30.8 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page