Help

Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here

Setting precision for 12 places after the decimal for Crypto API

Topic Labels: API
406 2
cancel
Showing results for 
Search instead for 
Did you mean: 

Hi all,
I’m getting crypto prices from the Coinmarketcap API and the prices have 12 decimal places E.g. $0.000000007269

However, when I fetch the prices into Airtable, the field [Prices] has precision set to 1.0000000 - 7 places and missing the remaining 5 places.

Is there a way to resolve this?

Thanks in advance,
Paul

2 Replies 2

One option is to save it into a text field. If you need to use it in any calculations, wrap the field reference in the VALUE() function to turn it back into a number. To display the result, concatenate it with an empty string to re-stringify it. It’s a few extra steps, but the precision should be maintained (knock on wood; I’ve never done super precise math with Airtable formulas, so I recommend running tests to ensure that this process will work for your use case).

A number/currency field is capable of storing a number with 12 decimal places if you set the value via scripting API. However, the user interface will not show these additional decimal places. You can see that the extra decimal places are stored in the editable field by using a formula field to convert the value to a string (e.g. {price} & "").