This can be done using our balance history APIs. Example - Balance History of an address
You need USD data for these tokens to calculate P/L.
USD data can come through our DEX Trade APIs (Pancakeswap Liquidity, Price, ATH and ATL) or market data APIs from 3rd parties.