Fixed Bond
This module contains examples of fixed rate bonds.
FixedCashFlows
dataclass
Bases: Contract
A set of Fixed Cashflows in a single currency. This example also shows how to create a timetable from arrays instead of a list of dictionaries, which is more efficient.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ccy |
str
|
the currency of cashflows. |
required |
times |
a list or ndarray of cashflows times. |
required | |
amounts |
List[float]
|
a list ndarray of cashflows amounts. |
required |
track |
str
|
an optional identifier for the contract. |
''
|
Examples:
>>> times = [datetime(2023, 12, 31), datetime(2024, 6, 30), datetime(2024, 12, 31)]
>>> amounts = [0.05, 0.05, 1.05]
>>> FixedCashFlows("USD", times, amounts).print_events()
time op quantity unit track
12/31/2023 + 0.05 USD
06/30/2024 + 0.05 USD
12/31/2024 + 1.05 USD
Source code in qablet_contracts\bnd\fixed.py
FixedBond
dataclass
Bases: Contract
A Fixed Rate Bond pays a fixed rate at regular intervals, and the principal at maturity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ccy |
str
|
the currency of cashflows. |
required |
coupon |
float
|
the coupon rate per year. |
required |
maturity |
datetime
|
the maturity of the bond. |
required |
freq |
str
|
the number of coupon payments per year. |
'2BQE'
|
track |
str
|
an optional identifier for the contract. |
''
|
Examples:
>>> FixedBond("USD", 0.05, datetime(2023, 12, 31), datetime(2025, 12, 31), "2QE").print_events()
time op quantity unit track
06/30/2024 + 0.025 USD
12/31/2024 + 0.025 USD
06/30/2025 + 0.025 USD
12/31/2025 + 1.025 USD