Swaps
This module contains examples of interest rate swaps.
Swap
dataclass
Bases: EventsMixin
In a Vanilla Swap, at the end of each period the holder pays a fixed rate and receives a floating rate. In this simple version the floating rate payment is replaced by receiving notional at the beginning of the period and paying the notional at the end of the period.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ccy |
str
|
the currency of the swap. |
required |
dates |
List[datetime]
|
the period datetimes of the swap, including the inception and maturity. |
required |
strike_rate |
float
|
the strike rate of the swaption (in units, i.e. 0.02 means 200 bps). |
required |
track |
str
|
an optional identifier for the contract. |
''
|
Examples:
>>> dates = pd.bdate_range(datetime(2023, 12, 31), datetime(2024, 12, 31), freq="2QE")
>>> Swap("USD", dates, strike_rate = 0.03).print_events()
time op quantity unit track
12/31/2023 + 1.000 USD .swp
06/30/2024 + -1.015 USD .swp
06/30/2024 + 1.000 USD .swp
12/31/2024 + -1.015 USD .swp
Source code in qablet_contracts\ir\swap.py
simple_swap_period(ccy, start, end, fixed_rate, track='')
Simple representation of a swap period, paying fixed, receiving floating rate.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ccy |
str
|
the currency of the swap. |
required |
start |
datetime
|
the start of the period. |
required |
end |
datetime
|
the end of the period. |
required |
fixed_rate |
float
|
the fixed annual rate of the swap. |
required |
track |
str
|
an optional identifier for the contract. |
''
|