prefer-decimal-money
Carry monetary amounts as Decimal or a money type, not float.
Why
Binary floating-point arithmetic can round monetary amounts and make totals disagree with their component transactions.
Fix
Use Decimal or a dedicated money type and preserve the agreed serialization format at the boundary. Integer minor units are also valid when the contract defines them.
Examples
from pydantic import BaseModel
class Deal(BaseModel): purchase_price: floatfrom decimal import Decimalfrom pydantic import BaseModel
class Deal(BaseModel): purchase_price: Decimal