MoneyMatters is a Python package designed to simplify several common monetary operations, such as currency conversion and money formatting. It integrates functionalities from multiple sources to provide a unified solution for handling monetary values, leveraging real-time data for accurate currency conversions and providing various formatting options.
- Currency Conversion: Convert amounts from one currency to another using real-time exchange rates.
- Money Formatting: Format monetary values into a more readable form or according to specific cultural norms.
To install MoneyMatters, run the following command:
pip install moneymatters
Ensure you have Python 3.7 or later installed on your system.
To convert currency, use the ExchangeAPI
class:
from moneymatters.api import ExchangeAPI
# Create an instance of the ExchangeAPI
converter = ExchangeAPI()
# Convert 100 USD to EUR
converted_amount = converter.convert(100, 'USD', 'EUR')
print(f"100 USD is equivalent to {converted_amount} EUR")
To format money values, use the Formatter
class:
from moneymatters.api import Formatter
# Format a price in a specific pattern
formatted_price = Formatter.apply_price_format(1234.56, '99.99')
print(f"The formatted price is {formatted_price}")
- API Sources:
- ECB for major 30 currencies.
- Fawaz Ahmed's exchange-api for 150+ currencies.
- XE.com for detailed and possibly more accurate data as a last resort.
Contributions are welcome! For major changes, please open an issue first to discuss what you would like to change. Ensure to update tests as appropriate.
This project is licensed under the Affero GNU Public License v3 - see the LICENSE file for details.
- Author: Gopala Krishna Koduri
- Email: gopal@riyazapp.com
- GitHub Repository
- Issue Tracker
- Learn to Sing with Riyaz App
Thanks to all contributors who have helped shape MoneyMatters, making it easier to deal with currency related stuff for developers around the globe.