# Interest

The formula for calculating interest on a loan is a critical component of any lending platform. It is essential that the formula is designed to accurately reflect the underlying risk and reward of the loan, as well as the liquidity of the lending pool.

Our proposed formula takes into account several key factors to arrive at a fair and accurate interest rate. The formula starts with the base interest rate, which is the minimum interest rate that can be charged on the loan. This rate is typically set by the lender and is intended to cover the administrative costs associated with the loan.

Next, the formula takes into account the remaining liquidity in the pool. Liquidity is calculated by subtracting the total amount borrowed from the total amount in the pool. The interest rate is then adjusted based on the ratio of liquidity to total pool size, using a coefficient called curveRate. This adjustment is intended to account for the added risk of lending when the pool is less liquid. The formula also takes into account the duration of the loan, using a coefficient called curveRateDay. This coefficient adjusts the interest rate based on the ratio of duration to maximum loan duration. This adjustment is intended to incentivize shorter-term loans, as they are typically considered to be less risky than long-term loans.

Finally, the formula returns the maximum value between the base interest rate and the product of the interest curve and the exponential function of the curve rate day multiplied by the duration divided by the maximum duration. The values for the coefficients and the base interest rate should be determined based on the desired lending strategy and market conditions. The formula should also be tested and validated before being used in a production environment.

In summary, our proposed formula for calculating interest on a loan takes into account the following factors:

- Base interest rate
- Liquidity in the pool
- Duration of the loan

By considering these factors, our formula aims to provide a fair and accurate interest rate for borrowers while also taking into account the underlying risk and reward of the loan and the liquidity of the lending pool.