Ensure correctness when recording amounts with floating points in your Blnk Ledger
precise_amount
parameter to store amounts with precision applied in your ledger.
Identify the smallest possible unit of the asset.
Convert this smallest unit into an integer.
Use the multiplication factor as your precision value.
amount
fieldprecise_amount
fieldamount
fieldamount
field, enter the amount as a floating-point value and specify its precision value when recording a transaction.
amount
field supports up to 15 digits. Exceeding this will throw a rounding error or truncation; switch to precise_amount
for accuracy with larger values.Field | Type | Description |
---|---|---|
amount | Float | The transaction value as is. |
precision | Number | The precision value (e.g. 100 converts USD to cents) |
precise_amount
is stored and used to compute your ledger balances.
Field | Type | Description |
---|---|---|
precise_amount | Number | The amount with precision applied. |
precise_amount
fieldprecise_amount
field:
precise_amount
field of your request.precision
value.Field | Type | Description |
---|---|---|
amount_string | String | Returns the amount with precision applied without rounding errors or cut offs. |
amount
and precise_amount
cannot be passed simultaneously when recording a transaction.
currency
should always have the same precision applied to their amounts.
amount
fieldamount
field:
amount
and precise_amount
fields in your request: