Algorithm to Find Optimal Yield Allocations
Hermes is our off-chain yield optimizer (keeper) program, designed to dynamically allocate liquidity across lending platforms for optimal yield while managing risk. Below, we break down its algorithmic approach and the rationale behind each step.
How Hermes Optimizes Yield
Key Factors Affecting APR
Amount Borrowed
Higher utilization (more borrowed) increases APR for depositors.
Amount Deposited
More deposits dilute the APR, as interest is shared among more depositors.
Interest Rate Model
Each platform’s model determines how APR changes with utilization.
Step-by-Step: Optimal Allocation Algorithm
1. Divide Liquidity into Portions
Liquidity is split into small portions (e.g., 100+), configurable by admin.
2. Simulate Deposits Across Platforms
For each portion, simulate depositing it into every lending platform and calculate the resulting APR.
3. Select Highest APR
Assign the portion to the platform offering the highest simulated APR.
4. Update Simulated Allocations
Update the simulated allocation and repeat until all liquidity is distributed.
5. Compare to Previous Allocation
If the new allocation differs from the previous by more than 0.1%, trigger a rebalance.