Spaces:
Sleeping
Sleeping
| from datetime import datetime, timedelta | |
| def time_discounting(cashflow: float, days: int, rate: float) -> float: | |
| """ | |
| Discount cashflows by time using cost of capital. | |
| """ | |
| return cashflow / ((1 + rate) ** (days / 365)) | |
| def accelerate_receivable(amount: float, days_late: int, risk_score: float) -> float: | |
| """ | |
| Returns an adjusted value (lower risk ↑ higher value). | |
| """ | |
| discount_rate = 0.03 + (0.02 * (1 - risk_score)) | |
| adjusted = time_discounting(amount, days_late, discount_rate) | |
| return round(adjusted, 2) |