Interest Rate Instruments
This section contains financial instruments w.r.t. interest rates whose credit component is x.
Forward Rate Agreement
- class rivapy.instruments.fra_specifications.ForwardRateAgreementSpecification(obj_id: str, trade_date: date | datetime, notional: float, rate: float, start_date: date | datetime, end_date: date | datetime, udlID: str, rate_start_date: date | datetime, rate_end_date: date | datetime, maturity_date: date | datetime = None, day_count_convention: DayCounterType | str = DayCounterType.ThirtyU360, business_day_convention: RollConvention | str = RollConvention.FOLLOWING, rate_day_count_convention: DayCounterType | str = DayCounterType.ThirtyU360, rate_business_day_convention: RollConvention | str = RollConvention.FOLLOWING, calendar: HolidayBase | str = None, currency: Currency | str = 'EUR', payment_days: int = 0, spot_days: int = 2, start_period: int = None, end_period: int = None, ir_index: str = None, issuer: Issuer | str | None = None, securitization_level: SecuritizationLevel | str = SecuritizationLevel.NONE, rating: Rating | str = Rating.NONE)[source]
Constructor for Forward Rate Agreement specification.
- Parameters:
obj_id (str) – (Preferably) Unique label of the FRA
trade_date (_Union[date, datetime]) – FRA Trade date.
maturity_date (_Union[date, datetime]) – FRA’s maturity/expiry date. Must lie after the trade_date.
notional (float, optional) – Fra’s notional/face value. Must be positive.
rate (float) – Agreed upon forward rate, a.k.a. FRA rate.
start_date (_Union[date, datetime]) – start date of the interest rate (FRA_rate) reference period from which interest is accrued.
end_date (_Union[date, datetime]) – end date of the interest rate (FRA_rate) reference period from which interest is accrued.
udlID (str) – ID of the underlying Index rate used for the floating rate for fixing.
rate_start_date (_Union[date, datetime]) – start date of fixing period for the floating rate
rate_end_date (_Union[date, datetime]) – end date of fixing period for the floating rate
day_count_convention (Union[DayCounter, str], optional) – Day count convention for determining period length. Defaults to DayCounter.ThirtyU360.
business_day_convention (Union[RollConvention, str], optional) – Set of rules defining the adjustment of days to ensure each date being a business day with respect to a given holiday calendar. Defaults to RollConvention.FOLLOWING
rate_day_count_convention (Union[DayCounter, str], optional) – Day count convention for determining period length. Defaults to DayCounter.ThirtyU360.
rate_business_day_convention (Union[RollConvention, str], optional) – Set of rules defining the adjustment of days to ensure each date being a business day with respect to a given holiday calendar. Defaults to RollConvention.FOLLOWING
calendar (Union[HolidayBase, str], optional) – Holiday calendar defining the bank holidays of a country or province (but not all non-business days as for example Saturdays and Sundays). Defaults (through constructor) to holidays.ECB (= Target2 calendar) between start_day and end_day.
currency (str, optional) – Currency as alphabetic, Defaults to ‘EUR’.
payment_days (int) – Number of days for payment after the start date. Defaults to 0.
spot_days (int) – time difference between fixing date and start dategiven in days.
start_period (int) – forward start period given in months e.g. 1 from 1Mx4M
end_period (int) – forward end period given in months e.g. 4 from 1Mx4M
ir_index (str) – ID of the underlying Index rate used for the floating rate for fixing.
issuer (str, optional) – Name/id of issuer. Defaults to None.
securitization_level (_Union[SecuritizationLevel, str], optional) – Securitization level. Defaults to None.
rating (_Union[Rating, str]) – Paper rating.
- static _create_sample(n_samples: int, seed: int = None, ref_date=None, issuers: List[str] = None, sec_levels: List[str] = None, currencies: List[str] = None) List[ForwardRateAgreementSpecification][source]
Create a random sample of multiple instruments of this type with varied specification parameters.
- Parameters:
n_samples (int) – The number of desired sample objects
seed (int, optional) – Seed number to allow repeated result. Defaults to None.
ref_date (_type_, optional) – Reference date . Defaults to None.
issuers (_List[str], optional) – list of issuers. Defaults to None.
sec_levels (_List[str], optional) – list of possible securitization levels. Defaults to None.
currencies (_List[str], optional) – list of possible currencies used. Defaults to None.
- Returns:
where each entry is a dict representing with the information needed to specify an instrument.
- Return type:
- property business_day_convention: str
Getter for FRA’s underlying rate’s business_day_convention.
- Returns:
FRA’s underlying rate’s business_day_convention.
- Return type:
str
- property calendar
Calender used for this instrument
- Returns:
_description_
- Return type:
_type_
- property currency: str
Getter for FRA’s currency.
- Returns:
FRA’s currency code
- Return type:
str
- property day_count_convention: str
Getter for FRA’s day count convention.
- Returns:
FRA’s day count convention.
- Return type:
str
- property end_date: date
Getter for FRA’s end date.
- Returns:
FRA’s end date.
- Return type:
date
- property end_period: int
Getter for the spot lag
- Returns:
_description_
- Return type:
float
- property index: str
Getter for the underlying Index rate used for the floating rate for fixing.
- Returns:
_description_
- Return type:
str
- property issuer: str
Getter for instrument’s issuer.
- Returns:
Instrument’s issuer.
- Return type:
str
- property maturity_date: date
Getter for FRA’s maturity date.
- Returns:
FRA’s maturity date.
- Return type:
date
- property notional: float
Getter for FRA’s face value.
- Returns:
FRA’s face value.
- Return type:
float
- property payment_days: int
Getter for the number of settlement days.
- Returns:
Number of settlement days.
- Return type:
int
- property rate: float
Getter for instrument’s rate.
- Returns:
Instrument’s rate.
- Return type:
float
- property rate_business_day_convention: str
Getter for FRA’s underlying rate’s business_day_convention.
- Returns:
FRA’s underlying rate’s business_day_convention.
- Return type:
str
- property rate_day_count_convention: str
Getter for FRA’s underlying rate’s day count convention.
- Returns:
FRA’s underlying rate’s day count convention.
- Return type:
str
- property rate_end_date: date
Getter for FRA’s end date.
- Returns:
FRA’s end date.
- Return type:
date
- property rate_start_date: date
Getter for FRA’s start date.
- Returns:
FRA’s start date.
- Return type:
date
- property rating: str
Getter for instrument’s rating.
- Returns:
instrument’s rating
- Return type:
str
- property securitization_level: str
Getter for instrument’s securitisation level.
- Returns:
Instrument’s securitisation level.
- Return type:
str
- property spot_days: int
Getter for the spot lag given in days
- Returns:
_description_
- Return type:
float
- property start_date: date
Getter for FRA’s start date.
- Returns:
FRA’s start date.
- Return type:
date
- property start_period: int
Getter for the start period, given in Months
- Returns:
_description_
- Return type:
float
- property trade_date: date
Getter for FRA’s issue date.
- Returns:
FRA’s issue date.
- Return type:
date
- property udlID: str
Getter for ID of the instruments underlying.
- Returns:
Instrument’s udlID.
- Return type:
str
Interest
- class rivapy.instruments.ir_swap_specification.InterestRateSwapSpecification(obj_id: str, notional: float | NotionalStructure, issue_date: date | datetime, maturity_date: date | datetime, pay_leg: IrFixedLegSpecification | IrFloatLegSpecification | IrOISLegSpecification, receive_leg: IrFixedLegSpecification | IrFloatLegSpecification | IrOISLegSpecification, currency: Currency | str = 'EUR', calendar: HolidayBase | str = None, day_count_convention: DayCounterType | str = DayCounterType.ThirtyU360, business_day_convention: RollConvention | str = RollConvention.FOLLOWING, issuer: str = None, securitization_level: SecuritizationLevel | str = SecuritizationLevel.NONE, rating: Rating | str = Rating.NONE)[source]
Specification of the entire swap, encapsulating both the pay leg and the receive leg.
- Parameters:
obj_id (str) – _description_
notional (_Union[float, NotionalStructure]) – _description_
issue_date (_Union[date, datetime]) – _description_
maturity_date (_Union[date, datetime]) – _description_
pay_leg (_Union[IrFixedLegSpecification, IrFloatLegSpecification]) – _description_
receive_leg (_Union[IrFixedLegSpecification, IrFloatLegSpecification]) – _description_
currency (_Union[Currency, str], optional) – _description_. Defaults to “EUR”.
calendar (_Union[_HolidayBase, str], optional) – _description_. Defaults to None.
day_count_convention (_Union[DayCounterType, str], optional) – _description_. Defaults to DayCounterType.ThirtyU360.
business_day_convention (_Union[RollConvention, str], optional) – _description_. Defaults to RollConvention.FOLLOWING.
issuer (str, optional) – _description_. Defaults to None.
securitization_level (_Union[SecuritizationLevel, str], optional) – _description_. Defaults to SecuritizationLevel.NONE.
rating (_Union[Rating, str], optional) – _description_. Defaults to Rating.NONE.
- static _create_sample(n_samples: int, seed: int = None, ref_date=None, issuers: List[str] = None, sec_levels: List[str] = None, currencies: List[str] = None) List[InterestRateSwapSpecification][source]
- property currency: str
Getter for IR swap’s currency.
- Returns:
IR swap’s ISO 4217 currency code
- Return type:
str
- get_fixed_leg()[source]
get the fixed leg (only possible for fixed vs. floating swaps -> throws otherwise)
- get_float_leg()[source]
get the float leg (only possible for fixed vs. floating swaps -> throws otherwise)
- property issue_date: date
Getter for IR swap’s issue date.
- Returns:
IR swap’s issue date.
- Return type:
date
- property issuer: str
Getter for instrument’s issuer.
- Returns:
Instrument’s issuer.
- Return type:
str
- property maturity_date: date
Getter for IR swap’s maturity date.
- Returns:
IR swap’s maturity date.
- Return type:
date
- property notional_structure: NotionalStructure
Return the notionals
- Returns:
class object detailing the notionals, start dates, …
- Return type:
NotionalStructure
- property rating: str
- property securitization_level: str
Getter for instrument’s securitisation level.
- Returns:
Instrument’s securitisation level.
- Return type:
str