I want to get the latest and most accurate price data from Uniswap and found out that I can either call the getAmountsOut()
function which gives me the amount of tokens I will get in return of a given input amount of tokens. Also it's possible to get the wanted price data via an on-chain price oracle which I could implement by myself thanks to the Uniswap smart contract that stores cumulative price data.
So what's the difference, are their drawbacks with using one method vs the other?