LTV calculation

to get the LTV I use a formula like

loanOrder.CurrentLTV = loanOrder.TotalDebt / (loanOrder.CollateralAmount * assetPrice) * 100

how can I calculate how much more collateral I need to add in order to decrease the LTV

To calculate how much more collateral you need to add in order to decrease the Loan-to-Value (LTV) ratio, you can use the following approach:

  1. Determine the desired LTV: Let’s call this desiredLTV.
  2. Calculate the current total debt: This is loanOrder.TotalDebt.
  3. Calculate the current collateral value: This is loanOrder.CollateralAmount * assetPrice.

The formula for LTV is:

CurrentLTV=CollateralAmount×assetPriceTotalDebt​×100