You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently using msgspec for parsing financial (cryptocurrency) data from various exchanges. Precision in this context is crucial, so I use Decimal values quite a lot. Though for safety and documentation, I would also like to set constraints for these values, however msgspec currently does not support it.
Supporting numeric constraints for the Decimal type would add consistency with the int and float types:
Additionally (may be a separate feature), supporting the multiple_of constraint with a Decimal argument (e.g. Meta(multiple_of=Decimal('0.1'))) would provide users with a workaround to the false negatives due to precision loss, from this issue.
The text was updated successfully, but these errors were encountered:
Description
I am currently using msgspec for parsing financial (cryptocurrency) data from various exchanges. Precision in this context is crucial, so I use Decimal values quite a lot. Though for safety and documentation, I would also like to set constraints for these values, however msgspec currently does not support it.
Supporting numeric constraints for the
Decimal
type would add consistency with theint
andfloat
types:Additionally (may be a separate feature), supporting the
multiple_of
constraint with aDecimal
argument (e.g.Meta(multiple_of=Decimal('0.1'))
) would provide users with a workaround to the false negatives due to precision loss, from this issue.The text was updated successfully, but these errors were encountered: