original_docstring:  cash-on-hand without and with home equity 
docstring: cash-on-hand without and with home equity
docstring_tokens: cash - on - hand without and with home equity
code: def mx_func(t,iota_lag,i_h_lag,i_p,LTV_lag,a_lag,par):
      """ cash-on-hand without and with home equity """
  
      LTV = np.nan # for renters, this will not be updated
  
      # a. cash-on-hand
      m = (1+par.ra)*a_lag + par.Gamma[t]*par.grid_p[i_p]
      
      # b. interest rate and repayments
      if i_h_lag >= 0:
          
          # i. prep
          LTV_mortgage_lag = np.fmin(LTV_lag,par.kappa_h_mortgage)
          LTV_bank_loan_lag = np.fmax(LTV_lag-par.kappa_h_mortgage,0.0)    
          repayments = 0.0
  
          # ii. stocks
          housing_value_lag = par.ph*par.grid_h[i_h_lag]
          mortgage_lag = LTV_mortgage_lag*housing_value_lag
          bank_loan_lag = LTV_bank_loan_lag*housing_value_lag
  
          # iii. interest payments
          m -= (par.rm*mortgage_lag + par.rb*bank_loan_lag) # interest
          if iota_lag > 0: m -= par.delta*mortgage_lag # extra IO fee
          
          # iv. repayments
          if iota_lag == 0: repayments += par.gamma_m*mortgage_lag # repayment mortgage
          repayments += par.gamma_b*bank_loan_lag # repayment bank_loand
          m -= repayments
  
          # v. debt and LTV
          debt = (mortgage_lag + bank_loan_lag) - repayments
          LTV = debt/housing_value_lag
  
      # b. total ressources
      x = m
      if i_h_lag >= 0:
          x += housing_value_lag - debt
  
      return m,x,LTV
code_tokens: def mx_func ( t , iota_lag , i_h_lag , i_p , LTV_lag , a_lag , par ) : LTV = np . nan m = ( 1 + par . ra ) * a_lag + par . Gamma [ t ] * par . grid_p [ i_p ] if i_h_lag >= 0 : LTV_mortgage_lag = np . fmin ( LTV_lag , par . kappa_h_mortgage ) LTV_bank_loan_lag = np . fmax ( LTV_lag - par . kappa_h_mortgage , 0.0 ) repayments = 0.0 housing_value_lag = par . ph * par . grid_h [ i_h_lag ] mortgage_lag = LTV_mortgage_lag * housing_value_lag bank_loan_lag = LTV_bank_loan_lag * housing_value_lag m -= ( par . rm * mortgage_lag + par . rb * bank_loan_lag ) if iota_lag > 0 : m -= par . delta * mortgage_lag if iota_lag == 0 : repayments += par . gamma_m * mortgage_lag repayments += par . gamma_b * bank_loan_lag m -= repayments debt = ( mortgage_lag + bank_loan_lag ) - repayments LTV = debt / housing_value_lag x = m if i_h_lag >= 0 : x += housing_value_lag - debt return m , x , LTV
short_docstring: cash-on-hand without and with home equity
short_docstring_tokens: cash - on - hand without and with home equity
comment: """ cash-on-hand without and with home equity """$SEP$# for renters, this will not be updated$SEP$# a. cash-on-hand$SEP$# b. interest rate and repayments$SEP$# i. prep$SEP$# ii. stocks$SEP$# iii. interest payments$SEP$# interest$SEP$# extra IO fee$SEP$# iv. repayments$SEP$# repayment mortgage$SEP$# repayment bank_loand$SEP$# v. debt and LTV$SEP$# b. total ressources