File size: 547 Bytes
4320328
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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)