You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The calculation of a user's position's generated APR requires knowledge of:
the value that the user deposited into a pool: ie. the equivalent reserve value at that point in time
(available from /tx_query each deposit and withdrawal has Reserves[0/1][Deposited/Withdrawn])
the value of those user's shares now: ie. the most recent equivalent reserve value
(using current pools state: value = userShares/totalShares*(reserve0*price0 + reserve1*price1))
Solution
This would be best calculated via the indexer so that the query for original deposited value can be calculated from all of the matching rows and return only that value (rather than having to send the entire paginated history of the user's deposits and withdrawals to calculate the previous deposit value).
This endpoint could receive a query of /users/deposits/{address}/APY and that could return a single number for each deposit pair. Or if extended a query of /dualitylabs/duality/dex/user/deposits/{address} could have APY appended to the rest of the row data.
The text was updated successfully, but these errors were encountered:
Required
User stats: Pair position APR
The calculation of a user's position's generated APR requires knowledge of:
(available from
/tx_query
each deposit and withdrawal hasReserves[0/1][Deposited/Withdrawn]
)(using current pools state:
value = userShares/totalShares*(reserve0*price0 + reserve1*price1)
)Solution
This would be best calculated via the indexer so that the query for original deposited value can be calculated from all of the matching rows and return only that value (rather than having to send the entire paginated history of the user's deposits and withdrawals to calculate the previous deposit value).
This endpoint could receive a query of
/users/deposits/{address}/APY
and that could return a single number for each deposit pair. Or if extended a query of/dualitylabs/duality/dex/user/deposits/{address}
could have APY appended to the rest of the row data.The text was updated successfully, but these errors were encountered: