Financial Calculations & Valuation
Beginner
Calculate Working Capital Drawing Power (DP) from Stock & Book Debt Statement in Python
Automate monthly bank Cash Credit (CC) Drawing Power (DP) calculation in Python by deducting unpaid stocks (sundry creditors), margins, and >90 day debtors.
#pandas#numpy
Problem Statement
Commercial banks sanction Cash Credit (CC) limits against hypothecation of stock and book debts, but borrowers can only draw up to the monthly Drawing Power (DP) after deducting Sundry Creditors (unpaid stock), ineligible >90-day debtors, and stipulated bank margins.
Formula / Core Logic
Paid_Stock = Total_Inventory - Sundry_Creditors
Net_Stock_DP = max(0, Paid_Stock) * (1 - Stock_Margin_Pct)
Net_Debtor_DP = Eligible_Debtors_Under_90_Days * (1 - Debtor_Margin_Pct)
Allowable_Drawing_Power = min(Sanctioned_CC_Limit, Net_Stock_DP + Net_Debtor_DP)
Installation
pip install pandas numpy
drawing-power-dp-calculation-stock-statement-cc-limit-python.py
def calculate_drawing_power(sanctioned_limit, raw_material, wip, finished_goods, sundry_creditors, debtors_upto_90d, debtors_over_90d, stock_margin=0.25, debtor_margin=0.40):
total_stock = raw_material + wip + finished_goods
paid_for_stock = max(0.0, total_stock - sundry_creditors)
dp_from_stock = paid_for_stock * (1.0 - stock_margin)
# Debtors > 90 days are strictly excluded from DP
dp_from_debtors = debtors_upto_90d * (1.0 - debtor_margin)
total_computed_dp = dp_from_stock + dp_from_debtors
operative_limit = min(sanctioned_limit, total_computed_dp)
return {
'Total_Inventory': round(total_stock, 2),
'Paid_Stock_After_Creditors': round(paid_for_stock, 2),
'DP_Against_Stock': round(dp_from_stock, 2),
'DP_Against_Book_Debts': round(dp_from_debtors, 2),
'Ineligible_Debtors_Excluded': round(debtors_over_90d, 2),
'Computed_Drawing_Power': round(total_computed_dp, 2),
'Operative_CC_Limit': round(operative_limit, 2)
}
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: Why are Sundry Creditors deducted from Total Stock before applying margin?
Banks cannot finance unpaid inventory twice; deducting trade creditors ensures Drawing Power is computed strictly on paid-for stock.