Skip to main content

A Pythonic currency calculator with real-time exchange rates

Project description

Currex

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 git+https://github.com/stared/currex.git

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.0.tar.gz (8.1 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.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: currex-0.1.0.tar.gz
  • Upload date:
  • Size: 8.1 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.0.tar.gz
Algorithm Hash digest
SHA256 9811c57bf7ff59549c3c53b55f1b132a7df2d50a500aeb50047c9a7d3c283ed1
MD5 8e12c6da0929d25ce075f7b752b00329
BLAKE2b-256 d763f730b277bbb485547c0d20d21eb7df8fa59076ac0c20b18b3ab39102f8f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for currex-0.1.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: currex-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0079ecb7c2f815278ee98902fea555ad0b00ccdb275a0887a1f00f9a84277f08
MD5 0bf0cc7af4046fc8e5f0a94e49001eab
BLAKE2b-256 c790f8051208f247012fea8442b308d2fcab9aa6133ccea325096c867df5ce91

See more details on using hashes here.

Provenance

The following attestation bundles were made for currex-0.1.0-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