Token Price API - discrepancy

Hey there.
I just found about the Moralis and I love it! It’s basically everything I was looking for past 3 months to have something like this and be able to build quickly apps.

I have a problem tho.

When it comes to the prices for the token it seems there is a big Discrepancy for the tokens that have a Hight supply and low price per token.

All is good when the price is no less than 0.00001 I guess but everything lower seems to bring a big discrepancy.
For example, given the Baby Doge token prices

Current price :
0.00000000194071 (taken from PooCoin)

0.000000001 (taken from Moralis API)

0.0000000019356 (taken from my own Price Calculation)

As U can see there Is aaa big difference between the Price and impact on calculations it implies.

Consider this transaction

73,530,000,000 ($139.71) - BSC SCAN

73,530,000,000 ($142.70) (0.00000000194071 * 73530000000) - PooCoin

73,530,000,000 ($73.53) (0.000000001* 73530000000) - Moralis API

73,530,000,000 ($142.32) (0.0000000019356* 73530000000) - MyOwn

As U can see there is almost a 50% ~difference in Price for MORALIS!!!

I had the same issue with my API and what I could suggest is to either increase the decimals up to the price is calculated for or expose a parameter for flexibility that user could define how many decimal places should be taken into consideration for price calculation

Currently seems Moralis is restricted to the Token Decimals price calculation which in this case is 9 decimals. If I would be able to define in parameter for the API CALL for example 13 decimals the price calculation would be closer to what It should be.

This is a big flaw to me currently which restricts me from using Moralis APIs in its full potential and I need to sitck to my own solutions.

Until this is somehow fixed I can’t fully use Moralis the way I would like to :frowning:

P.S.
Also good idea would be to think about priceUSD type representation. Currently it seems it doesn’t handle big numbers so low prices like 0.00000000012312 are represented as 1e-8 for example instead of the number. Maybe worth considering would be an option to represent numbers as strings like bignumber.js does.

3 Likes

Hi @Mugen,

Yes, this is a very valid issue and we are fully aware of it. Infact, this is what one of our core developers have to say –

This is how javascripts displays large/small numbers (try writing 0.000000002 in your console). You can format it to a string to display it differently (2e-9.toFixed(9))
Note: an update is comming soon to display more decimals for usd values (18 instead of 9)

So, yes, a new update is coming that will resolve this issue and and make the Price API even more powerful.

Will take note of this as well.

Thank you so much for your support. With devs like you supporting us, we can achieve great things together! :heart_eyes:

Happy BUIDLing. Will update you once the new fix is pushed! :raised_hands:

3 Likes

Awesome! Glad to hear that!
Can’t wait then for the update and possibility to use Moralis in it’s full potential <3

Thank you for such a great product!

2 Likes

@malik Hey there,
any updates on this topic?

Are there any updates on this?

Hey @ryan11

I don’t understand the problem a bit. Api returns the price in the number format.

For example Baby Doge price:

6.23210872e-10

It's the same as:
0.000000000623210872

Hey @Yomoo

Apologies I must have missed the update.

Previously (few months backs), the price I had for Zep was 3e-9, which wasn’t enough accuracy as it was still only converting to like 0.0000000009 or whatever

I can see now that the accuracy is much better like 2.80041852e-9 :slight_smile:

image

2 Likes

Yes, we had an update. Now the data is more accurate.