Skip to main content

Currency conversion

Project description

Currency conversion

Quickstart

Install currency_open_exchange:

pip install currency-open-exchange

Then use it in a project:

import currency_open_exchange

In order to save exchange rates to your database, add currency_open_exchange to your INSTALLED_APPS in your project’s settings:

INSTALLED_APPS = (
    ...
    'currency_open_exchange',
    ...
)

Setup the Open Exchange Rates backend

Open an account at https://openexchangerates.org/ if you don’t have one already. Then, add this to your project’s settings:

'EXCHANGE_APP_ID': 'YOUR APP ID HERE',
'EXCHANGE_BASE_CURRENCY': 'USD' (optional, only USD for free accounts)

For more information on the Open Exchange Rates API, see https://openexchangerates.org/

Pull the latest Exchange Rates

Once your backend is setup, get the latest exchange rates:

$ ./manage.py update_rates

Convert from one currency to another

Here’s an example of converting 10 American Dollars to Chinese Renminbi:

from currency_open_exchange.utils import convert
amount, currency = convert(10, "EUR", "BRL")

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

currency_open_exchange-0.0.6.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

currency_open_exchange-0.0.6-py2-none-any.whl (9.4 kB view details)

Uploaded Python 2

File details

Details for the file currency_open_exchange-0.0.6.tar.gz.

File metadata

File hashes

Hashes for currency_open_exchange-0.0.6.tar.gz
Algorithm Hash digest
SHA256 43c08f3391927532a5d0ae706a5c08dce7295d97e0097fb3df739a88989a90d1
MD5 0dbf5f5f74345f08ca78223ae5f4b8a3
BLAKE2b-256 43d6b3b8d1d9f77ab0aeae747a31b7f703a0460bc80ad2f0238ecffd1ebfbe92

See more details on using hashes here.

File details

Details for the file currency_open_exchange-0.0.6-py2-none-any.whl.

File metadata

File hashes

Hashes for currency_open_exchange-0.0.6-py2-none-any.whl
Algorithm Hash digest
SHA256 cf93bad2720b985194e45d060eaae38a4860afefb2cf1b79f7c1f3f8fb245990
MD5 12a37fb3bca317c797f30d3d88599605
BLAKE2b-256 3ecf2a3e9a9ab0934df7a9793c6309de7e191593a21145a533e24f6f4709e960

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