Interest rates are "floating," which means that they are dynamic and updated instantly depending on demand. This also means that rates are never "locked-in" at the time of opening a position and may change over the course of it being open.
There are separate rates for borrowing and lending per asset. The rates move based on utilization, which is the ratio of "amount borrowed" to "amount lent." As utilization increases, the interest rate will increase to incentivize more lenders. As utilization decreases, the interest rate decreases.
How Often is Interest Paid?
Interest is paid continuously so that you can close a position or withdraw funds at any time without worrying about a lock-up period. This also means that interest is continuously-compounding and all rates are in APR (with a higher percentage in APY).
How is Interest Rate Calculated?
Interest Rate for Borrowers
Interest rates are floating and are calculated based on the current utilization of the market. The utilization is the amount borrowed vs the amount lent for that particular market.
If the utilization is X, then the borrow interest is calculated as (accounting for the doubling of the rate specified in the latest update that was implemented on Feb. 25, 2021):
((0.1 * X) + (0.1 * X^32) + (0.3 * X^64))*2
For example if the utilization is 50%, then the interest is:
((0.1 * 50%) + (0.1 * 50%^32) + (0.3 * 50%^64))*2 = 10.00% APR
Therefore, the borrow interest rate scales non-linearly from 0% to 100% APR.
Interest Rate for Lenders
Mathematically, the interest rate for lenders must be less-than-or-equal-to the interest rate for borrowers; interest payments cannot accrue from thin-air. 5% percent of all interest accrued on the platform goes towards an insurance fund that helps to insure the protocol in times of extreme volatility. In addition, since the interest rate from borrowers is prorated across all funds lent, if the borrow interest rate is B and utilization is X, then the lender interest is calculated as:
95% * (B * X)
Interest Rate for Traders
Since all collateral in dYdX earns interest continuously, it is possible that your collateral is earning more interest than your borrow is paying. This will show up as a negative interest rate paid when using the Isolated tab on the trade page.
Your interest rate shown is the current interest rate that you expect to pay relative to your borrowed amount. Since your collateral earns interest (and there may be different collateral amounts depending on your leverage), changing the leverage of your position (before opening it) may change the interest rate shown.