FinancePy

FinancePy API Reference

Ibor Swap

financepy.products.rates.ibor_swap

Classes

IborSwap

IborSwap(effective_dt: financepy.utils.date.Date, term_dt_or_tenor: financepy.utils.date.Date | str, fixed_leg_type: financepy.utils.global_types.SwapTypes, fixed_cpn: float, fixed_freq_type: financepy.utils.frequency.FrequencyTypes, fixed_dc_type: financepy.utils.day_count.DayCountTypes, notional: float = 1000000, float_spread: float = 0.0, float_freq_type: financepy.utils.frequency.FrequencyTypes = <FrequencyTypes.QUARTERLY: 4>, float_dc_type: financepy.utils.day_count.DayCountTypes = <DayCountTypes.THIRTY_E_360: 2>, cal_type: financepy.utils.calendar.CalendarTypes = <CalendarTypes.WEEKEND: 2>, bd_type: financepy.utils.calendar.BusDayAdjustTypes = <BusDayAdjustTypes.FOLLOWING: 2>, dg_type: financepy.utils.calendar.DateGenRuleTypes = <DateGenRuleTypes.BACKWARD: 2>, end_of_month: bool = False)
Class for managing a standard Fixed vs IBOR swap. This is a contract in which a fixed payment leg is exchanged for a series of floating rates payments linked to some IBOR index rate. There is no exchange of principal. The contract is entered into at zero initial cost. The contract lasts from a start date to a specified maturity date. The floating rate is not known fully until the end of the preceding payment period. It is set in advance and paid in arrears. The value of the contract is the NPV of the two cpn streams. Discounting is done on a supplied discount curve which is separate from the curve from which the implied index rates are extracted.

Methods

get_fixed_rate

get_fixed_rate(self)
easy read access to the coupon (fixed rate)

set_fixed_rate

set_fixed_rate(self, new_rate: float)
Sometimes we need to reset the coupon (fixed rate) This function updates caches that depend on it

set_fixed_rate_to_atm

set_fixed_rate_to_atm(self, value_dt: financepy.utils.date.Date, discount_curve: financepy.market.curves.discount_curve.DiscountCurve, index_curve: financepy.market.curves.discount_curve.DiscountCurve = None, first_fixing: float = None)
Reset fixed rate to atm given curve(s). returns the new atm

value

value(self, value_dt: financepy.utils.date.Date, discount_curve: financepy.market.curves.discount_curve.DiscountCurve, index_curve: financepy.market.curves.discount_curve.DiscountCurve = None, first_fixing_rate=None, pv_only=True)
Value the interest rate swap on a value date given a single Ibor discount curve.

valuation_details

valuation_details(self, value_dt: financepy.utils.date.Date, discount_curve: financepy.market.curves.discount_curve.DiscountCurve, index_curve: financepy.market.curves.discount_curve.DiscountCurve = None, first_fixing_rate=None)
A long-hand method that returns various details relevant to valuation in a dictionary Slower than value(...) so should not be used when performance is important We want the output dictionary to have the same labels for different bechmarks (depos, fras, swaps) because we want to present them together so please do not stick new outputs into one of them only

pv01

pv01(self, value_dt, discount_curve)
Calculate the value of 1 basis point coupon on the fixed leg.

swap_rate

swap_rate(self, value_dt: financepy.utils.date.Date, discount_curve: financepy.market.curves.discount_curve.DiscountCurve, index_curve: financepy.market.curves.discount_curve.DiscountCurve = None, first_fixing: float = None)
Calculate the fixed leg cpn that makes the swap worth zero. If the valuation date is before the swap payments start then this is the forward swap rate as it starts in the future. The swap rate is then a forward swap rate and so we use a forward discount factor. If the swap fixed leg has begun then we have a spot starting swap. The swap rate can also be calculated in a dual curve approach but in this case the first fixing on the floating leg is needed.

cash_settled_pv01

cash_settled_pv01(self, value_dt, flat_swap_rate, freq_type)
Calculate the forward value of an annuity of a forward starting swap using a single flat discount rate equal to the swap rate. This is used in the pricing of a cash-settled swaption in the IborSwaption class. This method does not affect the standard valuation methods.

print_fixed_leg_pv

print_fixed_leg_pv(self)
Prints the fixed leg amounts without any valuation details. Shows the dates and sizes of the promised fixed leg flows.

print_float_leg_pv

print_float_leg_pv(self)
Prints the fixed leg amounts without any valuation details. Shows the dates and sizes of the promised fixed leg flows.

print_payments

print_payments(self)
Prints the fixed leg amounts without any valuation details. Shows the dates and sizes of the promised fixed leg flows.

macaulay_duration

macaulay_duration(self, value_dt, discount_curve, swap_type, payment_periods: float)
Calculation of the Macaulay Duration in an Interest Rate Swap Based on Bond Math: The Theory Behind the Formulas, Second Edition by Donald J. Smith

modified_duration

modified_duration(self, value_dt, discount_curve, swap_type, payment_periods: float)
Computation of the Modified Duration for the Fixed-Rate Payer's Perspective in Interest Rate Swap

change_in_market_value

change_in_market_value(self, value_dt, discount_curve, swap_type, payment_periods: float, swap_rate_changes: float)
Computation of the Profits for the Fixed-Rate Payer's Perspective in Interest Rate Swap

basis_point_value

basis_point_value(self, value_dt, discount_curve, swap_type, payment_periods: float)
calculate the basis‐point‐value (BPV) of the swap, which is swap's modified duration times the notional principal, times one basis point (0.0001)
Generated automatically from the FinancePy source code. Do not edit this file manually.