APR Calculation (Detailed)
Realized APR Formula
When profits are realized (converted to USDC):
Unrealized APR Formula
When profits are credited (still in position):
Snapshot Logic
A snapshot of Total Credited USDC is recorded every time profits are realized or credited. This snapshot is used as the denominator in future APR calculations.
Daily Profit Rate Calculation
Based on the time difference from the last profit event. This allows APR to adapt dynamically depending on the frequency and scale of profit events.
Profit Accounting Methods
realizeProfit: Agent converts profit to USDC, adds to vault. APR is Realized.
creditProfit: Agent leaves profit in position but updates the vault’s accounting. APR is still treated as Realized.
If neither function is called recently, APR falls back to Unrealized based on the active DEX position value.
Last updated