There are many terminologies specific to DeFi and leveraged yield farming protocols that might not be familiar to many users. Even amongst DeFi protocols, terminologies and calculations used can still vary greatly. As such, we believe it's worthwhile to explain the meanings of the key terms and calculations in Alpaca Finance, which we do below.

Total Value Locked (TVL) is a common metric within DeFi. It measures the total value of the capital invested into a protocol at a current time. For Alpaca Finance, we count the following elements within our TVL

Value of total LP tokens locked in the farms

Value of deposits that are not borrowed (the borrowed amount is already accounted for in the LP value)

Value of PCS ALPACA-BNB LP tokens staked

Value of sALPACA staked

**Lending APY **

Lending interest rate is a floating rate based on the utilization of the pool. We use a triple-slope interest model to optimize the borrowing rate. You can see our interest rate model here.

Lending APY accrues and autocompounds in your ibTokens. When withdrawing, you will see their value has grown above the base token, Learn more here.

Lending interest is compounded every second. Thus, lending APY shown is calculated using continuous compounding; APY = e ^ (APR) - 1.

**Staking APY **

Staking APY is earned in ALPACA by staking your ibTokens on the Stake page.

APR is calculated based on the value of ALPACA rewards being distributed per block divided by the total value of ibTokens being staked.

The APY shown assumes daily compounding of the rewards.

**ib Tokens**

Please refer to ibTokens section for more information.

**Yield Farming:**

This part of the yield refers to income from liquidity incentives provided by AMM platforms. For example, PancakeSwap provides CAKE token rewards for LPs in selected pools.

We compound CAKE rewards for you by selling CAKE into BNB/BUSD every 30 minutes and adding that back into your position as LP tokens. This yield will reflect in your position value rising over time.

APR is calculated based on the value of CAKE rewards being distributed per block divided by the total value of reserves in the liquidity pool.

Given the 30-minutes frequency for compounding, farming yield APY is calculated using a continuous compounding formula.

**Trading Fees:**

PancakeSwap charges 0.2% fees for every trade, of which .17% accrues to liquidity providers.

Trading fees APY is calculated using the average of the previous 7-days actual trading volume.

Note: Data shown for trading fees is delayed due to a block sync issue on PancakeSwap and may not reflect real APY.

**ALPACA Rewards:**

Leveraged yield farmers will earn ALPACA rewards based on the size of their borrowed assets relative to the total borrowed assets.

APR is calculated based on the total value of ALPACA rewards distributed per block divided by the total value of debt.

APY is calculated assuming daily compounding.

**Borrowing Interest:**

Borrowing interest is the Lending APR multiplied by the utilization level of the pool, after taking out the 10% of Lending APR for protocol fees.

Hence, borrowing interest APR is a floating rate based on the utilization of the lending pool. We use a triple-slope interest model to optimize the borrowing interest. You can see our interest rate model here.

Interest is calculated and compounded every second.

APY shown is based on a continuous compounding formula.

**Position Value**

The total value of your farming position.

This shows the value of the underlying assets in your position if they were converted into your borrowed primitive (BNB/BUSD). This is what this position size would give you in the borrowed primitive after price impact and trading fees (though it includes debt value).

**Debt Value**

Total debt value of your farming position.

This value is the sum of your borrowed principal and accrued interest.

**Equity Value**

Equity Value is what you can expect to receive back if you close your position and choose to receive all the assets back in borrowed primitive.

Equity Value = Position Value - Debt Value.

**Current APY**

APY calculation follows the same formula discussed above and is based on the current leverage level.

**Debt Ratio**

Debt Ratio = Debt Value / Position Value

**Liquidation Threshold**

This is the Debt Ratio threshold for your position. Beyond this limit, your position could be liquidated.

**Safety Buffer**

This is the buffer between the current Debt Ratio and the Liquidation Threshold, aka your safe space.