Open gamarin2 opened 3 years ago
Is swap fee for the last hour too fine grained? I guess it's okay to start with. For greater APY stability I could see us going to swap fees for one day or even swap fees for 7 days.
Is swap fee for the last hour too fine grained? I guess it's okay to start with. For greater APY stability I could see us going to swap fees for one day or even swap fees for 7 days.
the problem is that we only get swapFees from the API .... to calculate APY we use TVL at that instance
last hour is too fine-grained (at least 1d would be representative of fees accrued) but TVL at a single instance for a whole days worth of fees is the opposite...
Ideally (and I raised the issue in slack) , APY should be calculated on the backend and cached....then we can construct a moving average from that and serve this on the API
Pool APY can be calculated using the following formula:
Value of swap fee can be obtained via this endpoint https://github.com/allinbits/demeris-backend/pull/105 It comes in both denoms of the pool
TVL is just reserve balances
So basically `(swapFeeCoin0ps + swapFeeCoin1) / (reserveBalanceCoin0ps + reserveBalanceCoin1) 24 365
where ps is the poolprice such that coin0*ps = coin1