This commit is contained in:
Roger Oriol
2025-02-08 12:37:32 +01:00
parent 90d36397c5
commit a7523746aa
2 changed files with 87 additions and 6 deletions

View File

@@ -94,10 +94,11 @@ def get_solvency_ratio(balances, min):
result = round((get_net_worth(balances).number / total_assets.number) * 100, 2)
return f"{bcolors.FAIL if result < min else bcolors.OKGREEN}{result} %{bcolors.ENDC}"
def get_interest_coverage_ratio(gross_monthly_income, debt_payments, mortgage_payments, min):
def get_interest_coverage_ratio(gross_monthly_income, expenses, debt_payments, mortgage_payments, min):
living_expenses = expenses[0].position.get_only_position().units.number
interest = debt_payments.number + mortgage_payments.number
interest = interest if interest > 0 else 1
result = round(gross_monthly_income / interest, 2)
result = round((gross_monthly_income - living_expenses) / interest, 2)
return f"{bcolors.FAIL if result < min else bcolors.OKGREEN}{result}{bcolors.ENDC}"
def get_max_leveraged_investment(balances):
@@ -183,7 +184,7 @@ def print_report(date, balances, expenses, income, debt_payments, mortgage_payme
["Savings Ratio", get_savings_ratio(balances, income, savings, 20), "20 %"],
["Debt-Service Ratio", get_debt_service_ratio(balances, income, debt_payments, 35), "35 %"],
["Non-Mortgage Debt-Service Ratio", get_non_mortgage_debt_service_ratio(balances, income, mortgage_payments, 15), "15 %"],
["Interest Coverage Ratio", get_interest_coverage_ratio(income, debt_payments, mortgage_payments, 1.5), "1.5"]
["Interest Coverage Ratio", get_interest_coverage_ratio(income, expenses, debt_payments, mortgage_payments, 1.5), "1.5"]
]))
def get_balances(entries, options, date):