File size: 793 Bytes
9d4bd7c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from datetime import datetime, timedelta
from typing import List

def calculate_coupon_dates(start_date: datetime, maturity_date: datetime, interval_months: int = 6) -> List[datetime]:
    """Calculate coupon payment dates for a bond.
    
    Args:
        start_date: The effective date of the bond
        maturity_date: The maturity date of the bond
        interval_months: Interval between coupon payments in months (default 6)
        
    Returns:
        List of coupon payment dates
    """
    dates = []
    current_date = start_date
    
    while current_date < maturity_date:
        if current_date.weekday() < 5:  # Skip weekends
            dates.append(current_date)
        current_date += timedelta(days=interval_months * 30.44)  # Approximate months
    
    return dates