Description
The number one thing users care about is "Am I making money?"
Our frontend portfolio page currently just shows their raw token balances. We need a backend endpoint that calculates their Total PnL (Profit and Loss).
It needs to look at their initial deposit value (mocked data) versus the current USD value of their tokens and return the percentage and raw dollar change.
This endpoint will be the most frequently polled route on the entire platform.
Requirements
Description
The number one thing users care about is "Am I making money?"
Our frontend portfolio page currently just shows their raw token balances. We need a backend endpoint that calculates their Total PnL (Profit and Loss).
It needs to look at their initial deposit value (mocked data) versus the current USD value of their tokens and return the percentage and raw dollar change.
This endpoint will be the most frequently polled route on the entire platform.
Requirements
/api/v1/users/:address/pnl.totalInvestmentUSD,currentValueUSD,netProfitUSD, andpercentageChange.:addressstring ends with an even number, it returns a positive PnL, and if odd, a negative PnL (to help UI testing).successResponseJSON envelope.