Skip to main content

A Python module to get and save exchange rates in different formats

Project description

Xchanger

A Python module that scrapes data from https://www.xe.com/ and returns exchange rates for different currencies. Use it to get the latest exchange rates for any currency pair.

The code is compatible with both Python 2 and Python 3.

Installation:

pip install Xchanger

Example

Importing module

from fx.Xchanger import Xchanger

Create a Xchanger object.

converter = Xchanger()

Get the data of the specified currencies.

data = converter.get(from_currency="USD", to_currency="EUR")

print the data

print(data)

Output:

1 USD = 0.92374341 EUR

Save the exchange rate data to an Excel spreadsheet.

converter.save_to_excel(from_currency="USD", to_currency=None)

Output:

1 USD data1.xlsx saved succcessfully!

Save the exchange rate data to a CSV file.

converter.save_to_csv(from_currency=None, to_currency="EUR")

Output:

1 USD data1.csv saved succcessfully!

Save the exchange rate data to a JSON file.

converter.save_to_json(from_currency="EUR", to_currency=None)

Output:

1 USD data1.csv saved succcessfully!

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

Xchanger-0.1.3.tar.gz (6.9 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