use better price feed
elee1766 opened this issue · 3 comments
right now the price feed being used is the coingecko price.
coingecko price for MTA right now is just wrong. coingecko is printing 7.40 when the price is really closer to 7.00
I propose using something like the 1inch price for some sort of size (100 dollars? 1000 dollars?) if it exists, otherwise fall back to coingecko. 1inch is more reflective of what actual price and therefore roi is
Does 1inch or uniswap provide an api to easily get this data?
There may be cases where uniswap offers better price but coingecko is just wayy easier to use in case of aggregating multiple sources. If there is 1inch API, I would def use that over coingecko.
there is 1inch api
here is an example for COMP -> USDC
comp is 18 decimals so for amount i put 1e18. RN the response im getting for toTokenAmount is 182240097. since USDC is 6 digits, we find the price of 1 COMP to USDC to be 182.24097. Of course I would recommend going the other way when calculating prices, and using a reasonable amount of USDC, say 1000 or 10000 USDC to calculate the price.
that's their documentation