Skip to content

Notional set to 0 if accural end date > today #320

@oszette

Description

@oszette

Hi!

With the new release, we found that trades where the accrual end date for the legs has passed but the payment date is still in the future relative to today, the notional is set to zero. The commit that introduced this is ba037a6, specifically the changes made to legdata.cpp on line 2649.

A crude way to solve it is to just add an additional check on the coupon payment date:

for (auto cf : leg) {
        QuantLib::ext::shared_ptr<Coupon> coupon = QuantLib::ext::dynamic_pointer_cast<QuantLib::Coupon>(cf);
        if ((coupon) && (coupon->accrualEndDate() > today || coupon->date() > today)) {
            return coupon->nominal();
        }
    }

Let me know what you think.

/Oskar

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions