OISSwap#
-
class sigtech.framework.instruments.ois_swap.OISSwap
Baseclasses:
InterestRateSwapBase
OIS swap receiving fixed rate and paying OIS rate.
Keyword arguments:
currency
: Currency of the swap.tenor
: Tenor (e.g.5Y
) or maturity date (e.g.dtm.date(2025,1,3)
) of the swap.fixed_rate
: Fixed rate (of the receiving leg). Will be set to the fair rate if left None. Expected in decimal format, e.g. 0.05 for 5%.trade_date
: Trade date of the swap. Used for starting the history and inferring un-supplied parameters.start_date
: Start date of the swap. If no date is given, T+``settlement_days`` is used.settlement_days
: Number of business days to wait after thetrade_date
to start the swap, Currency default is used if left blank (same as for LIBOR swaps).daycount
: Day count of the legs, same for both (e.g.'30/360'
). Currency default is used if left blank.frequency
: Legs frequency ('Q'
,'SA'
, or'A'
) (same for both legs). Currency default is used if left blank ('A'
for most currencies).pay_delay
: Delay (number of business days) between accrual end and payment dates (same for both legs). Currency default is used if left blank (same assettlement_days
for most currencies).index
: Optional override for default OIS index fixing object.
Example object creation:
swap =sig.OISSwap( currency='USD', tenor=dtm.date(2025, 7, 5), start_date=dtm.date(2021, 7, 5), fixed_rate=0.0132)
This will create a swap, starting on 5-Jul-2021, ending on 5-Jul-2025, paying SOFR and receiving 1.32% fixed USD annually, using
ACT/360
daycount, with payment delay of 2 business daysswap = sig.OISSwap( currency='USD', tenor='1Y', trade_date=dtm.date(2019, 7, 1), )
This will create a 1 year swap, starting on 5-Jul-2021 (\(T+2\)), paying FedFunds and receiving a fixed rate, making the trade date value of the swap 0.
-
day_count: Optional[Literal['ACT/ACT', 'ACT/360', 'ACT/365F', '30/360', '30E/360', 'ACT/365_NL', 'ACT/366']]
-
fixed_rate: Optional[float]
-
frequency: Optional[Literal['Q', 'SA', 'A']]
-
index: Optional[str]
-
property maturity
Maturity date.
-
pay_delay: Optional[int]
-
settlement_days: Optional[int]
-
start_date: Optional[date]
-
tenor: Union[date, str]
-
trade_date: Optional[date]
-
carry_roll_down(d: date, dates: Union[str, date, list[Union[str, datetime.date]]], data_point: DataPoint = None)
Compute carry and roll-down of swap by moving the valuation date forward to the requested dates, keeping discount and forecasting curves constant, i.e. discount_factor(from_original_date, for_x_number_of_days) equals discount_factor(from_the_forward_date, for_x_number_of_days), and assuming that all the forward required IBOR fixings are equal to the valuation date (d) implied fixing.
- Parameters:
d – Valuation date.
dates – String/date or a list of strings/dates for which the carry/roll-down is needed.
data_point – Data point for the original curves.
- Returns:
DataFrame of 4 columns -
carry
- cumulative cashflows fromd
to date,roll_down
- change in swap PV, and the same numbers scaled by swap PV01.
-
fair_rate(d=None, mode: str = 'mid', transaction_type: Optional[str] = None, start_date=None, data_point: DataPoint = None, bid_ask_to_mid_spread_override: Optional[dict] = None) float
Calculate the fair swap rate for a given tenor on a given date.
If no
start_date
is passed as an input, swap start date is used.- Parameters:
d – Reference date to calculate fair swap rate (optional, defaults to instrument’s
trade_date
).mode – Quote to return, defaults to
'mid'
but can be'bid'
or'ask'
(optional).transaction_type – Type of transaction to assume, defaults to outright but can be set to roll (optional).
start_date – Start date of swap to assume (optional).
data_point – Data point of the underlying curves (optional).
bid_ask_to_mid_spread_override – Mid to bid/ask to use for each transaction type (optional).
- Returns:
Fair swap rate given the inputs.
-
fixing_date(start_date)
Index fixing date for the coupon starting at start_date
-
maturity_from_tenor(start_date, tenor, bdc='NONE_RULE')
Compute maturity date from tenor.
- Parameters:
start_date – Start date.
tenor – Tenor.
bdc – Business day convention, e.g.
'FOLLOWING'
,'MOD_FOL'
,'PRECEDE'
.
- Returns:
Maturity date.
-
risk_ladder(d: datetime, shift_bps: float = 1.0, field: str = 'NPV', interpolation_type: str = 'CS', notional: float = 1.0) DataFrame
Return forward and zero rate shift risk ladder for specified field. Output is change in value for this field.
- Parameters:
d – Reference date to return info for.
shift_bps – Fwd and zero rate shift amount in bps (optional), 1bps used as default.
field – Field to calculate risk ladder for (optional).
'NPV'
or'PV01'
,'NPV'
used as default.notional – Notional (optional).
interpolation_type – Interpolation type (optional).
'FF'
,'MCF'
,'FFMCF'
or'CS'
,'CS'
used as default
- Returns:
DataFrame risk ladder for field input.
-
static schedule_stub(currency)
Schedule stub for all OIS swaps.
- Parameters:
currency – Input swap currency.
- Returns:
Schedule stub.
-
static spot_date(asof_date: date, currency: str, settlement_days: int = None)
Standard swap start date if traded on asof_date.
-
swap_details(d: datetime, notional: float = 1.0, as_df: bool = True) Union[dict, DataFrame]
Return swap info.
- Parameters:
d – Reference date to return info for.
notional – Notional (optional).
as_df – Return swap info as DataFrame (optional).
- Returns:
Dictionary or DataFrame of swap info.
-
swap_rate_shift_details(d: datetime, shift_bps: float = 1.0, tenor: str = 'tenors', notional: float = 1.0) DataFrame
Return swap rate shift scenario analysis info.
- Parameters:
d – Reference date to return info for.
shift_bps – Swap rate shift amount in bps (optional), 1bps used as default.
tenor – Swap rate tenor to shift (optional), e.g.
'1Y'
,'5Y'
or'tenors'
to shift all available swap rate tenors,'tenors'
used as default.notional – Notional (optional).
- Returns:
DataFrame of scenario analysis info.