Skip to main content

A Pythonic currency calculator with real-time exchange rates

Project description

Currex

currex version - PyPI PyPI status MIT license - PyPI Python version - PyPI GitHub Actions Twitter @pmigdal

A Pythonic currency calculator that makes working with currencies and exchange rates simple and smooth.

I often use Python as a command-line calculator. Yet, I need to go back to Google Search to convert between curriencies. So, for my own convenience, I created this library.

It is inteded to be used interactive python sessions (such as Jupyter Notebook, IPython, etc.) to get ballpark estimates of prices - e.g. when travelling, buying online, etc.

It is NOT intended to be used in production code. Every API design decision I made was to make it as simple as possible to use it in interactive sessions.

EVEN MORE IMPORTANT: Never use it for any important decisions - taxes, investments, etc. There is not quarantee that the exchange rates are correct.

Installation

pip install currex

Usage

from currex import *

# use currencies as if they were numbers
100 * USD  # USD(100)
12 * USD(100)  # USD(1200)

# convert currencies to other currencies
USD(100).to(EUR)  # EUR(85.3)
USD(100).to(PLN)  # PLN(430.5)

# this syntax is also supported
PLN(EUR(12))  # PLN(51.3312)

# add different currencies
USD(100) + EUR(100)  # USD(203.50500)
EUR(100) - USD(100)  # EUR(2.60500)

# divide currencies
USD(2) / JPY(14)  # 22.531428526365715

Features

  • Arithmetic operations with currencies
  • Currency conversion
  • Autocasting - when using a few currencies, automatically convert them to the first one

Requirements

  • Python 3.10 or higher
  • Internet connection for real-time exchange rates - it uses HexaRate

TODO

  • Installation with PyPI
  • Mock API for testing
  • More backends for exchange rates

License

MIT License by Piotr Migdał

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

currex-0.1.1.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

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

currex-0.1.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file currex-0.1.1.tar.gz.

File metadata

  • Download URL: currex-0.1.1.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for currex-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5b3c30a842a2e17c6090fba086302c0928c713955dca2ae8fa3f6daa28afa206
MD5 7b7f3d2092e60539cb2a6d5ba249fede
BLAKE2b-256 ac6028175263ef67b55db1a0354997a34e98d5c7815812a53f567a2ca93007c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for currex-0.1.1.tar.gz:

Publisher: publish.yml on stared/currex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file currex-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: currex-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for currex-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4b48c571797e4f52a91af69d6249f2cee72c1b966c5b7f1bb010c31ef4563b0f
MD5 4d1127f11b7983ff3e9ea633851aea43
BLAKE2b-256 01d89c157797ddcbc7c5a54c3bbf29c7544ba203e0855084d1ec672aaf61cea0

See more details on using hashes here.

Provenance

The following attestation bundles were made for currex-0.1.1-py3-none-any.whl:

Publisher: publish.yml on stared/currex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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