Display money format and its filthy currencies, for all money lovers out there.

Overview

Python Currencies

Display money format and its filthy currencies, for all money lovers out there.

Build Status https://codecov.io/gh/Alir3z4/python-currencies/branch/master/graph/badge.svg?token=Ag25YMSuEX

Installation

currencies is available on PyPi

http://pypi.python.org/pypi/currencies

So easily install it by pip

$ pip install currencies

Or by easy_install

$ easy_install currencies

Another way is by cloning currencies's git repo

$ git clone git://github.com/Alir3z4/python-currencies.git

Then install it by running:

$ python setup.py install

Usage

Displaying money format:

>>> from currencies import Currency
>>>
>>> currency = Currency('USD')
>>> currency.get_money_format(13)
>>> '$13'
>>> currency.get_money_format(13.99)
>>> '$13.99'
>>> currency.get_money_format('13,2313,33')
>>> '$13,2313,33'
>>>
>>> # Displaying with currency as well
>>>
>>> currency.get_money_with_currency_format(13)
>>> '$13 USD'
>>> currency.get_money_with_currency_format(13.99)
>>> '$13.99 USD'
>>> currency.get_money_with_currency_format('13,2313,33')
>>> '$13,2313,33 USD'

Tests

currencies is well tested, to run the test suite:

$ PYTHONPATH=$PYTHONPATH:. python setup.py test

Available currencies

  • AED
  • AFN
  • ALL
  • AMD
  • ANG
  • AOA
  • ARS
  • AUD
  • AWG
  • AZN
  • BAM
  • BBD
  • BDT
  • BGN
  • BHD
  • BND
  • BOB
  • BRL
  • BSD
  • BTN
  • BWP
  • BYR
  • BZD
  • CAD
  • CHF
  • CLP
  • CNY
  • COP
  • CRC
  • CZK
  • DKK
  • DOP
  • DZD
  • EGP
  • ETB
  • EUR
  • FJD
  • GBP
  • GEL
  • GHS
  • GMD
  • GTQ
  • GYD
  • HKD
  • HNL
  • HRK
  • HUF
  • IDR
  • ILS
  • INR
  • ISK
  • JEP
  • JMD
  • JOD
  • JPY
  • KES
  • KGS
  • KHR
  • KRW
  • KWD
  • KYD
  • KZT
  • LBP
  • LKR
  • LTL
  • LVL
  • MAD
  • MDL
  • MGA
  • MKD
  • MMK
  • MNT
  • MOP
  • MUR
  • MVR
  • MXN
  • MYR
  • MZN
  • NAD
  • NGN
  • NIO
  • NOK
  • NPR
  • NZD
  • OMR
  • PEN
  • PGK
  • PHP
  • PKR
  • PLN
  • PYG
  • QAR
  • RON
  • RSD
  • RUB
  • RWF
  • SAR
  • SCR
  • SEK
  • SGD
  • STD
  • SYP
  • THB
  • TND
  • TRY
  • TTD
  • TWD
  • TZS
  • UAH
  • UGX
  • USD
  • UYU
  • VEF
  • VND
  • VUV
  • WST
  • XAF
  • XBT
  • XCD
  • XOF
  • XPF
  • ZAR
  • ZMW

Source https://github.com/Alir3z4/python-currencies
Website http://alir3z4.github.com/python-currencies
Issues https://github.com/Alir3z4/python-currencies/issues
PyPi http://pypi.python.org/pypi/currencies
Author Alireza Savand
License GNU GPL 3
Comments
  • Should symbol work?

    Should symbol work?

    Should this work?

    >>> pycountry.currencies.lookup(u'EUR')
    Currency(alpha_3='EUR', name='Euro', numeric='978')
    >>> pycountry.currencies.lookup(u'€')
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/Users/michele/bitbucket/splitti/telegram/venv36/lib/python3.6/site-packages/pycountry/db.py", line 43, in load_if_needed
        return f(self, *args, **kw)
      File "/Users/michele/bitbucket/splitti/telegram/venv36/lib/python3.6/site-packages/pycountry/db.py", line 121, in lookup
        raise LookupError('Could not find a record for %r' % value)
    LookupError: Could not find a record for '€'
    
    opened by mmic 2
  • Make Currencies comparable

    Make Currencies comparable

    Hi there! Out of curiosity, was there any decision behind not implementing the __eq__ method inside the Currency class?

    In my - maybe naive - understanding, it would make sense to be able to compare Currency objects like so: Currency('USD') == Currency('USD') which as of now returns False, as the object's pointers are compared, not the values.

    My workaround for this is as follows (python 3.10 code, for python < 3.10 the __ne__ method also needs to be implemented)

    class ComparableCurrency(Currency):
        def __eq__(self, other):
            return isinstance(other, Currency) and self.get_money_currency() == other.get_money_currency()
    

    If for any reason, it doesn't make sense to compare two Currencies with each other, or the implementation on currency.get_money_currency() is too simple, I would really like to undestand the problems with that.

    opened by CGaul 0
  • Adding functionality for Full Currency Name look up

    Adding functionality for Full Currency Name look up

    What is the purpose of your pull request?

    As per Issue: https://github.com/Alir3z4/python-currencies/issues/12

    To add functionality to the main class whereby you can get the full currency name.

    Important

    • Added JSON file to 'currencies' folder called "currency_name.json"
    • This JSON file is a basic key/value setup
    • Most of these full name values should be the official/correct ones
    • Source is mainly Google preview after search, as well as https://www.worlddata.info/currencies

    Useage

    from currencies import Currency

    currency = Currency('USD')

    currency.getname()

    >>> 'United States Dollar'

    Other Info

    Resolves https://github.com/Alir3z4/python-currencies/issues/12 which can be closed now

    opened by Connor-Steward 1
  • Adding the currency Name

    Adding the currency Name

    It would be really great if the library would know the full name of the currency. For example:

    >>> Currency('USD').get_name()
    "United States dollar"
    

    or

    >>> Currency('EUR').get_name()
    "Euro"
    

    I think english names would be a good starting point, but I think there should be a way to translate the names? I thought of JSON files for each language that contains the name for each currency. The library could then choose the correct file automatically.

    opened by mame98 4
  • Countries for currencies

    Countries for currencies

    Would be nice if you could just write the country and get the currency, like

    
    >>> portugal = Country('PORTUGAL')
    >>> portugal.get_currency()
    >>> EUR
    >>> portugal.get_money_format(13)
    >>> '€13'
    >>> portugal.get_money_format(13.99)
    >>> '€13.99'
    >>> portugal.get_money_format('13,2313,33')
    >>> '€13,2313,33'
    >>>
    >>> # Displaying with currency as well
    >>>
    >>> portugal.get_money_with_currency_format(13)
    >>> '€13 EUR'
    >>> portugal.get_money_with_currency_format(13.99)
    >>> '€13.99 EUR'
    >>> portugal.get_money_with_currency_format('13,2313,33')
    >>> '€13,2313,33 EUR'
    
    enhancement 
    opened by jusce17 2
Releases(2020.12.12)
Owner
Alireza Savand
I am Alireza Savand, a Software Architect.
Alireza Savand
Portfolio and E-commerce site built on Python-Django and Stripe checkout

StripeMe Introduction Stripe Me is an e-commerce and portfolio website offering communication services, including web-development, graphic design and

3 Jul 05, 2022
A modular, high performance, headless e-commerce platform built with Python, GraphQL, Django, and React.

Saleor Commerce Customer-centric e-commerce on a modern stack A headless, GraphQL-first e-commerce platform delivering ultra-fast, dynamic, personaliz

Mirumee Labs 17.7k Dec 31, 2022
A web application to search for input products across several supermarkets' e-commerce to return price, detail of products running on Python.

Price Checker A web application to search for input products across several supermarkets' e-commerce to return price, detail of products. Requirements

3 Jun 28, 2022
Python money class with optional CLDR-backed locale-aware formatting and an extensible currency exchange solution.

Python Money Money class with optional CLDR-backed locale-aware formatting and an extensible currency exchange solution. This is version 1.4.0-dev. De

Carlos Palol 214 Dec 22, 2022
Domain-driven e-commerce for Django

Domain-driven e-commerce for Django Oscar is an e-commerce framework for Django designed for building domain-driven sites. It is structured such that

Oscar 5.6k Dec 30, 2022
An Unofficial Alipay API for Python

An Unofficial Alipay API for Python Overview An Unofficial Alipay API for Python, It Contain these API: Generate direct payment url Generate partner t

Eric Lo 321 Dec 24, 2022
A Django e-commerce website

BRIKKHO.com E-commerce website created with Django Run It: Clone the project or download as zip: $ git clone https://github.com/FahadulShadhin/brikkho

Shadhin 1 Dec 17, 2021
A Django app to accept payments from various payment processors via Pluggable backends.

Django-Merchant Django-Merchant is a django application that enables you to use multiple payment processors from a single API. Gateways Following gate

Agiliq 997 Dec 24, 2022
Re-write of floppshop e-commerce site

Floppshop V2 Python: 3.9.5 FastAPI: 0.68 Tortoise-orm: 0.17.8 pytest: 5.2 PostgreSQL: 13.4 Setup Srak jak nie wiesz jak Clone repository $ git clone

jakub-figat 3 Nov 30, 2022
Ecommerce app using Django, Rest API and ElasticSearch

e-commerce-app Ecommerce app using Django, Rest API, Docker and ElasticSearch Sort pipfile pipfile-sort Runserver with Werkzeug (django-extensions) .

Nhat Tai NGUYEN 1 Jan 31, 2022
EasyShop User Interface - a shopping program we created for people who want to buy specific cloth wear

EasyShop-User-Interface Welcome to the EasyShop User Interface! This program fetches images from urls as per choices of clothes made by you and displa

Adit Sinha 1 Apr 23, 2022
PVE with tcaledger app for payments and simulation of payment requests

tcaledger PVE with tcaledger app for payments and simulation of payment requests. The purpose of this API is to empower users to accept cryptocurrenci

3 Jan 29, 2022
Fully functional ecommerce website with user and guest checkout capabilities and Paypal payment integration.

ecommerce_website Fully functional ecommerce website with user and guest checkout capabilities and Paypal payment integration. pip install django pyth

2 Jan 05, 2022
Django_E-commerce - an open-source ecommerce platform built on the Django Web Framework.

Django E-commerce Django-ecommerce is an open-source ecommerce platform built on the Django Web Framework. Demo Homepage Cartpage Orderpage Features I

Biswajit Paloi 6 Nov 06, 2022
An eBay-like e-commerce auction site that will allow users to post auction listings, place bids on listings, comment on those listings, and add listings to a watchlist.

e-commerce-auction-site This repository is my solution to Commerce project of CS50’s Web Programming with Python and JavaScript course by Harvard. 🚀

3 Sep 03, 2022
A modular, high performance, headless e-commerce platform built with Python, GraphQL, Django, and React.

Saleor Commerce Customer-centric e-commerce on a modern stack A headless, GraphQL commerce platform delivering ultra-fast, dynamic, personalized shopp

Saleor Commerce 17.7k Jan 01, 2023
E-Commerce Platform

Shuup Shuup is an Open Source E-Commerce Platform based on Django and Python. https://shuup.com/ Copyright Copyright (c) 2012-2021 by Shuup Commerce I

Shuup 2k Dec 30, 2022
Currency Conversion in Python

CurrencyConversion connect to an API to do currency conversions, save as json text or screen output exchangeratesAPI.py -h Exchange Rates via 'api.cur

soup-works 1 Jan 29, 2022
Foreign exchange rates, Bitcoin price index and currency conversion using ratesapi.io

forex-python Forex Python is a Free Foreign exchange rates and currency conversion. Note: Install latest forex-python==1.1 to avoid RatesNotAvailableE

MicroPyramid 540 Jan 05, 2023
imager is a modern ecommerce & social network platform that helps users to find the most matching products

imager is a modern ecommerce & social network platform that helps users to find the most matching products. Users can follow their favourite brands and to be aware of friends' actions. If you have se

Sardor 1 Jan 11, 2022