🧮 pricing_kit
A flexible and extensible Rust library for calculating and managing product pricing, markups, commissions, and currency conversions.
✨ Features
- Define a base (buy) price and calculate sell prices based on:
- Flat amount markups
- Percentage markups
- Commissions in other currencies
- Support for multi-currency operations using exchange rates, ensuring financial precision with
Decimaltypes. - Support for adjustments such as:
- Tax calculations with percentage-based rates
- Discounts based on percentage
- Fixed fees with customizable currencies
- Clean and extensible API design, ready for future enhancements.
⚡ Quick Start
use ;
⚡ Adjustment Feature Example
use ;
🎯 Crate Goals
This crate is designed to be:
- Easy to use for common e-commerce and fintech pricing scenarios.
- Accurate, currency-aware, and reliable in financial calculations through explicit
Decimalusage. - Ready for dynamic adjustments such as tax, discount, and fixed fees.
- Extensible for future features like tiered pricing, tax rules, and promotions.
♻️ Re-exports for Convenience
For ease of use and to ensure robust financial calculations, pricing_kit re-exports the following types and macros from the rust_decimal ecosystem:
Decimal(from therust_decimalcrate): Used for all currency amounts and exchange rates to ensure arbitrary precision arithmetic and avoid floating-point inaccuracies.dec!macro (from therust_decimal_macroscrate): A convenient macro for creatingDecimalliterals in your code.
This means you can use pricing_kit::Decimal and pricing_kit::dec! directly without needing to explicitly import them from their original crates, although you still need to declare rust_decimal and rust_decimal_macros in your Cargo.toml.
📖 License
This project is licensed under the Apache-2.0 license. LICENSE
🧑 Author
Jerry Maheswara jerrymaheswara@gmail.com
❤️ Built with Love in Rust
This project is built with ❤️ using Rust — a systems programming language that is safe, fast, and concurrent. Rust is the perfect choice for building reliable and efficient applications.
👋 Contributing
Pull requests, issues, and feedback are welcome! If you find this crate useful, give it a ⭐ and share it with others in the Rust community.