When I exchange in TOKEN for WETH or WHET for a TOKEN, the result obtained with trade.outputAmount always gives me the same result as in the uniswap UI.
But when I go to obtain the output price in a TOKEN TRADE for another TOKEN erc-20 I get a different result. Always lower than the one offered by the uniswap UI at the same time.
My code
const TOKENP = new Token(ChainId.MAINNET, tokenw.hash, tokenw.decimals);
const TOKEN_M = new Token(ChainId.MAINNET, tokenm.hash, tokenm.decimals); //
const pair3 = await Fetcher.fetchPairData(TOKEN_M ,TOKEN_P);
const route3 = new Route([pair3], TOKEN_P);
let qtyToken = Math.pow(10, 18)*1;
const tradeM = new Trade(route3, new TokenAmount( TOKEN_P, qtyToken ), TradeType.EXACT_INPUT)
return tradeM.outputAmount.toSignificant(6);
Shouldn't this code give me the exact data from the uniswap UI just like it happens to me when I trade with ETH? This difference increases when the amount of the input token increases. In this case this 1 unit.