Coder Social home page Coder Social logo

django-money-rates's Introduction

django-money-rates

image

image

image

image

Currency conversion for money

Documentation

The full documentation is at https://django-money-rates.readthedocs.io/.

Quickstart

Install django-money-rates:

pip install django-money-rates

Then use it in a project:

import djmoney_rates

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

INSTALLED_APPS = (
    ...
    'djmoney_rates',
    ...
)

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:

DJANGO_MONEY_RATES = {
    'DEFAULT_BACKEND': 'djmoney_rates.backends.OpenExchangeBackend',
    'OPENEXCHANGE_URL': 'http://openexchangerates.org/api/latest.json',
    'OPENEXCHANGE_APP_ID': 'YOUR APP ID HERE',
    'OPENEXCHANGE_BASE_CURRENCY': 'USD',
}

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 Euros to Brazilian Reais:

from moneyed import Money
from djmoney_rates.utils import convert_money
brl_money = convert_money(10, "EUR", "BRL")

Features

  • Convert money from one currency to another with an easy to use API.

TODO List

  • Add money converter wrapper for util's convert_money function.
  • Add celery periodic task for getting daily exchange rates.

django-money-rates's People

Contributors

psykopear avatar silvanocerza avatar synasius avatar tzenderman avatar

Watchers

 avatar  avatar

Forkers

uptrader

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.