The problem I'm trying to solve here is that with the current solution for fetching historical token data at the time of writing this (the solution being fetching the data from Uniswap-v2 graph), I'm not able to fetch data for native chain tokens (eth, matic) and thus the calculation of profit/loss is wrong.
Use coingecko API's/coins/{id}/history endpoint to fetch historical price data for native tokens.
The problem I'm trying to solve here is that with the current solution for fetching historical token data at the time of writing this (the solution being fetching the data from Uniswap-v2 graph), I'm not able to fetch data for native chain tokens (eth, matic) and thus the calculation of profit/loss is wrong.
Use coingecko API's
/coins/{id}/history
endpoint to fetch historical price data for native tokens.