Financial Calculations & Valuation
Intermediate
Project Term Loan Moratorium & IDC (Interest During Construction) Schedule Generator in Python
Generate a project finance term loan repayment schedule in Python Pandas handling moratorium periods, Interest During Construction (IDC) capitalization, and stepped-up EMIs.
#pandas#numpy
Problem Statement
Industrial and infrastructure term loans include a 6 to 24 month moratorium (holiday period) before commercial operations date (COD). Modeling whether interest during moratorium is serviced monthly or capitalized into principal is critical for DSCR projections.
Formula / Core Logic
If Capitalize_IDC == True: Opening_Principal_At_Repayment = Sanctioned_Loan * (1 + r_month)^Moratorium_Months
Post-Moratorium EMI is computed over remaining Repayment_Months.
Installation
pip install pandas numpy
term-loan-moratorium-interest-capitalization-schedule-python.py
import pandas as pd
import numpy as np
def generate_moratorium_loan_schedule(principal, annual_rate, moratorium_months=12, repayment_months=60, capitalize_interest=True):
r = (annual_rate / 100.0) / 12.0
balance = float(principal)
rows = []
for m in range(1, moratorium_months + 1):
interest = balance * r
if capitalize_interest:
balance += interest
rows.append({'Month': m, 'Phase': 'Moratorium_Cap', 'Payment': 0.0, 'Interest': round(interest, 2), 'Principal': 0.0, 'Closing_Balance': round(balance, 2)})
else:
rows.append({'Month': m, 'Phase': 'Moratorium_Int_Only', 'Payment': round(interest, 2), 'Interest': round(interest, 2), 'Principal': 0.0, 'Closing_Balance': round(balance, 2)})
emi = balance * r * ((1 + r) ** repayment_months) / (((1 + r) ** repayment_months) - 1)
for m in range(moratorium_months + 1, moratorium_months + repayment_months + 1):
interest = balance * r
prin = emi - interest
balance = max(0.0, balance - prin)
rows.append({'Month': m, 'Phase': 'Repayment', 'Payment': round(emi, 2), 'Interest': round(interest, 2), 'Principal': round(prin, 2), 'Closing_Balance': round(balance, 2)})
return pd.DataFrame(rows)
Get the Complete 100+ Python Quant & Automation Bundle
Instant lifetime access to all production-ready scripts, valuation models, and trading bots ($19).
Buy Full Bundle on Gumroad ($19) →Frequently Asked Questions
Q: What is IDC in project finance?
Interest During Construction (IDC) is the interest accrued on term loan disbursements before the factory or project starts generating commercial revenue.