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 details)

Uploaded Source

File details

Details for the file Xchanger-0.1.3.tar.gz.

File metadata

  • Download URL: Xchanger-0.1.3.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for Xchanger-0.1.3.tar.gz
Algorithm Hash digest
SHA256 c9efc9315a02ef985c570cccf46ad115f6e40ef2ebbde7163ba80044c22963a1
MD5 d40f57d6f8fba12b300177b0b28b4b16
BLAKE2b-256 4df0a097a36025125820bc6cde88c314331c5485688daf0dba711ec78fdaed1d

See more details on using hashes here.

Supported by

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