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")
Release files for currency-open-exchange 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| currency_open_exchange-0.0.6.tar.gz | 4.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| currency_open_exchange-0.0.6-py2-none-any.whl | Python 2 | none | any | Details |
Total release size: 14.3 kB
Release files / currency_open_exchange-0.0.6.tar.gz
| Download URL | currency_open_exchange-0.0.6.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
43c08f3391927532a5d0ae706a5c08dce7295d97e0097fb3df739a88989a90d1
|
|
BLAKE2b-256 checksum How to use checksums |
43d6b3b8d1d9f77ab0aeae747a31b7f703a0460bc80ad2f0238ecffd1ebfbe92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / currency_open_exchange-0.0.6-py2-none-any.whl
| Download URL | currency_open_exchange-0.0.6-py2-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
cf93bad2720b985194e45d060eaae38a4860afefb2cf1b79f7c1f3f8fb245990
|
|
BLAKE2b-256 checksum How to use checksums |
3ecf2a3e9a9ab0934df7a9793c6309de7e191593a21145a533e24f6f4709e960
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |