How can i calculate "scale"? #446
-
I have currency rate like this: 0.0001234 How can i calculate "scale" and "amount" for dinero currency rate correctly? |
Beta Was this translation helpful? Give feedback.
Answered by
sarahdayan
Oct 17, 2021
Replies: 1 comment 3 replies
-
Hey @antpv! Your rate has seven fraction digits, meaning you can represent as an integer with a scale of An easy way to get the |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
sarahdayan
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey @antpv!
Your rate has seven fraction digits, meaning you can represent as an integer with a scale of
7
.An easy way to get the
amount
is to then multiply your rate by 10 to the power of the scale (0.0001234 * 10**7
), so in your case it would be{ amount: 1234, scale: 7 }
.