If you build tools for Filipino sellers, sooner or later you hit a boring but sneaky problem. Money math.
Supplier rates come in one currency, often with four or five decimal places. Your customers want clean peso prices. And somewhere between the two, rounding errors quietly eat your margin.
Here's how I'd handle peso pricing in a small reseller or SMM tool.
Rule 1: never use floats for money
>>> 0.1 + 0.2 0.30000000000000004
Enter fullscreen mode
Exit fullscreen mode
Fine for physics. Terrible for invoices. Use Decimal in Python (or integer centavos everywhere).
from decimal import Decimal , ROUND_HALF_UP , ROUND_CEILING
def to_peso ( value ) -> Decimal : return Decimal ( str ( value )). quantize ( Decimal ( " 0.01 " ), rounding = ROUND_HALF_UP )
Enter fullscreen mode
Exit fullscreen mode
Rule 2: prices are per 1,000, orders aren't
Most social media service APIs quote a rate per 1,000 units. Customers order 250, 1,500 or 3,333.…