Skip to content

bonds

Bond instrument classes for the core domain model.

Classes:

  • CoveredBond

    A class to represent covered bond instruments.

  • FixedRateBond

    A class representing a fixed rate bond.

  • TreasuryBond

    Represents a Treasury Bond with a fixed interest rate and maturity greater than ten years.

  • TreasuryNote

    Represents a Treasury Note with a fixed interest rate and maturity between one and ten years.

CoveredBond

CoveredBond(**kwargs: object)

Bases: Instrument

A class to represent covered bond instruments.

Methods:

  • accept

    Accept a visitor.

  • is_composite

    Check if the instrument is composite.

  • repricing_date

    Return the next repricing date for variable-rate instruments.

Attributes:

book_type property writable

book_type: BookType | None

Get the book type of the instrument.

credit_rating property writable

credit_rating: CreditRating

Get the instrument's credit rating.

issuer property writable

issuer: Issuer

Get the instrument's issuer.

parent property writable

parent: Instrument | None

Get the parent instrument.

accept

accept(visitor: Visitor) -> None

Accept a visitor.

is_composite

is_composite() -> bool

Check if the instrument is composite.

repricing_date

repricing_date(as_of: date) -> date | None

Return the next repricing date for variable-rate instruments.

Returns None for fixed-rate instruments (repricing_frequency is None).

FixedRateBond

FixedRateBond(
    *,
    face_value: float,
    coupon_rate: float,
    issue_date: Date,
    maturity_date: Date,
    frequency: Period = Semiannual,
    settlement_days: int = 0,
    calendar: Calendar = UnitedStates(GovernmentBond),
    day_count: DayCounter = Thirty360(BondBasis),
    business_convention: int = Following,
    date_generation: DateGeneration = Backward,
    month_end: bool = False,
    book_type: Optional["BookType"] = None,
    credit_rating: Optional["CreditRating"] = None,
    issuer: Optional["Issuer"] = None,
    parent: Optional["Instrument"] = None,
    measurement_basis: Optional["MeasurementBasis"] = None,
)

Bases: Instrument

A class representing a fixed rate bond.

Parameters:

  • face_value

    (float) –

    The face value of the bond.

  • coupon_rate

    (float) –

    The coupon rate of the bond.

  • issue_date

    (Date) –

    The issue date of the bond.

  • maturity_date

    (Date) –

    The maturity date of the bond.

  • frequency

    (Period, default: Semiannual ) –

    The frequency of coupon payments. Defaults to ql.Semiannual.

  • settlement_days

    (int, default: 0 ) –

    The number of settlement days. Defaults to 0.

  • calendar

    (Calendar, default: UnitedStates(GovernmentBond) ) –

    The calendar used for date calculations. Defaults to ql.NullCalendar().

  • day_count

    (DayCounter, default: Thirty360(BondBasis) ) –

    The day count convention for interest calculations. Defaults to ql.Thirty360(ql.Thirty360.BondBasis).

  • business_convention

    (int, default: Following ) –

    The business convention. Defaults to ql.Unadjusted.

  • date_generation

    (DateGeneration, default: Backward ) –

    The date generation rule for coupon dates. Defaults to ql.DateGeneration.Backward.

  • month_end

    (bool, default: False ) –

    Whether the coupon dates should be adjusted to the end of the month. Defaults to False.

  • book_type

    (BookType, default: None ) –

    The book type of the instrument.

  • credit_rating

    (CreditRating, default: None ) –

    The credit rating of the instrument.

  • issuer

    (Issuer, default: None ) –

    The issuer of the instrument.

  • parent

    (Instrument, default: None ) –

    The parent instrument.

  • measurement_basis

    (MeasurementBasis, default: None ) –

    The instrument class.

Methods:

Attributes:

book_type property writable

book_type: BookType | None

Get the book type of the instrument.

credit_rating property writable

credit_rating: CreditRating

Get the instrument's credit rating.

issue_date property

issue_date: date

Get the issue date of the bond.

issuer property writable

issuer: Issuer

Get the instrument's issuer.

maturity_date property

maturity_date: date

Get the maturity date of the bond.

parent property writable

parent: Instrument | None

Get the parent instrument.

accept

accept(visitor: Visitor) -> None

Accept a visitor.

is_composite

is_composite() -> bool

Check if the instrument is composite.

notional

notional(date: date) -> float

Calculate the notional value of the bond on a given date.

Parameters:

  • date

    (date) –

    The date for which to calculate the notional value.

Returns:

  • float ( float ) –

    The notional value of the bond on the given date.

payment_schedule cached

payment_schedule() -> list[tuple[date, float]]

Generate the payment schedule for the bond.

Returns:

  • list ( list[tuple[date, float]] ) –

    A list of tuples representing the payment schedule. Each tuple contains the payment date and amount.

repricing_date

repricing_date(as_of: date) -> date | None

Return the next repricing date for variable-rate instruments.

Returns None for fixed-rate instruments (repricing_frequency is None).

set_pricing_engine

set_pricing_engine(engine: PricingEngine) -> None

Set the pricing engine.

TreasuryBond

TreasuryBond(
    *,
    face_value: float,
    coupon_rate: float,
    issue_date: Date,
    maturity_date: Date,
    frequency: Period = Semiannual,
    settlement_days: int = 0,
    calendar: Calendar = UnitedStates(GovernmentBond),
    day_count: DayCounter = Thirty360(BondBasis),
    business_convention: int = Following,
    date_generation: DateGeneration = Backward,
    month_end: bool = False,
    book_type: Optional["BookType"] = None,
    credit_rating: Optional["CreditRating"] = None,
    issuer: Optional["Issuer"] = None,
    parent: Optional["Instrument"] = None,
    measurement_basis: Optional["MeasurementBasis"] = None,
)

Bases: FixedRateBond

Represents a Treasury Bond with a fixed interest rate and maturity greater than ten years.

Parameters:

  • face_value

    (float) –

    The face value of the bond.

  • coupon_rate

    (float) –

    The coupon rate of the bond.

  • issue_date

    (Date) –

    The issue date of the bond.

  • maturity_date

    (Date) –

    The maturity date of the bond.

  • frequency

    (Period, default: Semiannual ) –

    The frequency of coupon payments. Defaults to ql.Semiannual.

  • settlement_days

    (int, default: 0 ) –

    The number of settlement days. Defaults to 0.

  • calendar

    (Calendar, default: UnitedStates(GovernmentBond) ) –

    The calendar used for date calculations. Defaults to ql.NullCalendar().

  • day_count

    (DayCounter, default: Thirty360(BondBasis) ) –

    The day count convention for interest calculations. Defaults to ql.Thirty360(ql.Thirty360.BondBasis).

  • business_convention

    (int, default: Following ) –

    The business convention. Defaults to ql.Unadjusted.

  • date_generation

    (DateGeneration, default: Backward ) –

    The date generation rule for coupon dates. Defaults to ql.DateGeneration.Backward.

  • month_end

    (bool, default: False ) –

    Whether the coupon dates should be adjusted to the end of the month. Defaults to False.

  • book_type

    (BookType, default: None ) –

    The book type of the instrument.

  • credit_rating

    (CreditRating, default: None ) –

    The credit rating of the instrument.

  • issuer

    (Issuer, default: None ) –

    The issuer of the instrument.

  • parent

    (Instrument, default: None ) –

    The parent instrument.

  • measurement_basis

    (MeasurementBasis, default: None ) –

    The instrument class.

Methods:

Attributes:

book_type property writable

book_type: BookType | None

Get the book type of the instrument.

credit_rating property writable

credit_rating: CreditRating

Get the instrument's credit rating.

issue_date property

issue_date: date

Get the issue date of the bond.

issuer property writable

issuer: Issuer

Get the instrument's issuer.

maturity_date property

maturity_date: date

Get the maturity date of the bond.

parent property writable

parent: Instrument | None

Get the parent instrument.

accept

accept(visitor: Visitor) -> None

Accept a visitor.

is_composite

is_composite() -> bool

Check if the instrument is composite.

notional

notional(date: date) -> float

Calculate the notional value of the bond on a given date.

Parameters:

  • date

    (date) –

    The date for which to calculate the notional value.

Returns:

  • float ( float ) –

    The notional value of the bond on the given date.

payment_schedule cached

payment_schedule() -> list[tuple[date, float]]

Generate the payment schedule for the bond.

Returns:

  • list ( list[tuple[date, float]] ) –

    A list of tuples representing the payment schedule. Each tuple contains the payment date and amount.

repricing_date

repricing_date(as_of: date) -> date | None

Return the next repricing date for variable-rate instruments.

Returns None for fixed-rate instruments (repricing_frequency is None).

set_pricing_engine

set_pricing_engine(engine: PricingEngine) -> None

Set the pricing engine.

TreasuryNote

TreasuryNote(
    *,
    face_value: float,
    coupon_rate: float,
    issue_date: Date,
    maturity_date: Date,
    frequency: Period = Semiannual,
    settlement_days: int = 0,
    calendar: Calendar = UnitedStates(GovernmentBond),
    day_count: DayCounter = Thirty360(BondBasis),
    business_convention: int = Following,
    date_generation: DateGeneration = Backward,
    month_end: bool = False,
    book_type: Optional["BookType"] = None,
    credit_rating: Optional["CreditRating"] = None,
    issuer: Optional["Issuer"] = None,
    parent: Optional["Instrument"] = None,
    measurement_basis: Optional["MeasurementBasis"] = None,
)

Bases: FixedRateBond

Represents a Treasury Note with a fixed interest rate and maturity between one and ten years.

Parameters:

  • face_value

    (float) –

    The face value of the bond.

  • coupon_rate

    (float) –

    The coupon rate of the bond.

  • issue_date

    (Date) –

    The issue date of the bond.

  • maturity_date

    (Date) –

    The maturity date of the bond.

  • frequency

    (Period, default: Semiannual ) –

    The frequency of coupon payments. Defaults to ql.Semiannual.

  • settlement_days

    (int, default: 0 ) –

    The number of settlement days. Defaults to 0.

  • calendar

    (Calendar, default: UnitedStates(GovernmentBond) ) –

    The calendar used for date calculations. Defaults to ql.NullCalendar().

  • day_count

    (DayCounter, default: Thirty360(BondBasis) ) –

    The day count convention for interest calculations. Defaults to ql.Thirty360(ql.Thirty360.BondBasis).

  • business_convention

    (int, default: Following ) –

    The business convention. Defaults to ql.Unadjusted.

  • date_generation

    (DateGeneration, default: Backward ) –

    The date generation rule for coupon dates. Defaults to ql.DateGeneration.Backward.

  • month_end

    (bool, default: False ) –

    Whether the coupon dates should be adjusted to the end of the month. Defaults to False.

  • book_type

    (BookType, default: None ) –

    The book type of the instrument.

  • credit_rating

    (CreditRating, default: None ) –

    The credit rating of the instrument.

  • issuer

    (Issuer, default: None ) –

    The issuer of the instrument.

  • parent

    (Instrument, default: None ) –

    The parent instrument.

  • measurement_basis

    (MeasurementBasis, default: None ) –

    The instrument class.

Methods:

Attributes:

book_type property writable

book_type: BookType | None

Get the book type of the instrument.

credit_rating property writable

credit_rating: CreditRating

Get the instrument's credit rating.

issue_date property

issue_date: date

Get the issue date of the bond.

issuer property writable

issuer: Issuer

Get the instrument's issuer.

maturity_date property

maturity_date: date

Get the maturity date of the bond.

parent property writable

parent: Instrument | None

Get the parent instrument.

accept

accept(visitor: Visitor) -> None

Accept a visitor.

is_composite

is_composite() -> bool

Check if the instrument is composite.

notional

notional(date: date) -> float

Calculate the notional value of the bond on a given date.

Parameters:

  • date

    (date) –

    The date for which to calculate the notional value.

Returns:

  • float ( float ) –

    The notional value of the bond on the given date.

payment_schedule cached

payment_schedule() -> list[tuple[date, float]]

Generate the payment schedule for the bond.

Returns:

  • list ( list[tuple[date, float]] ) –

    A list of tuples representing the payment schedule. Each tuple contains the payment date and amount.

repricing_date

repricing_date(as_of: date) -> date | None

Return the next repricing date for variable-rate instruments.

Returns None for fixed-rate instruments (repricing_frequency is None).

set_pricing_engine

set_pricing_engine(engine: PricingEngine) -> None

Set the pricing engine.