Skip to content

coupon

CouponPaymentRule: settles coupon payments on adjusted coupon dates.

At settlement, the coupon amount (from the payment schedule) may differ from the total accrued interest (from QL's day count convention). The transaction carries an accrued_portion in metadata so the AccountingService can post a three-leg entry:

Dr  Cash                         (coupon amount)
Cr  Accrued Interest Receivable  (what was actually accrued)
Cr  Interest Income              (catch-up difference)

Classes:

  • CouponPaymentRule

    Settle coupon payments on scheduled (business-day-adjusted) dates.

CouponPaymentRule

Settle coupon payments on scheduled (business-day-adjusted) dates.

Methods:

  • applies_to

    Return True for LONG positions on a coupon date.

  • generate

    Generate a settlement transaction with the accrued portion for three-leg posting.

applies_to

applies_to(
    instrument: Instrument,
    position: Position,
    context: RuleContext,
) -> bool

Return True for LONG positions on a coupon date.

Coupon settlement is income-side: Dr Cash / Cr AIR / Cr Interest Income. SHORT positions (bond issuance) would require an expense-side rule, which is not implemented here.

generate

generate(
    instrument: Instrument,
    position: Position,
    context: RuleContext,
) -> list[Transaction]

Generate a settlement transaction with the accrued portion for three-leg posting.