Module Daml.Finance.Instrument.Swap.Fpml.Util

Functions

createCalculationPeriodicSchedule

: CalculationPeriodDates -> PeriodicSchedule

Create a schedule for calculation periods.

createPaymentPeriodicSchedule

: SwapStream -> PeriodicSchedule

Create a schedule for payment periods.

getCalendarsAndAdjust

: Date -> BusinessDayAdjustments -> Party -> Party -> Update Date

Retrieve holiday calendars and adjust a date as specified in a BusinessDayAdjustments FpML element

adjustDateAccordingToBusinessDayAdjustments

: Date -> BusinessDayAdjustments -> Party -> Party -> Update Date

Adjust a date as specified in a BusinessDayAdjustments FpML element (or not at all if NoAdjustment)

applyPaymentDaysOffset

: [SchedulePeriod] -> PaymentDates -> [HolidayCalendarData] -> [SchedulePeriod]

Adjust payment schedule according to paymentDaysOffset (if available).

getSingleStubRate

: StubFloatingRate -> Optional O

Define observable part of claim when one specific floating rate is provided for a stub period.

getInterpolatedStubRate

: StubFloatingRate -> StubFloatingRate -> SchedulePeriod -> HolidayCalendarData -> BusinessDayConventionEnum -> Optional O

Linearly interpolates two rates within a period, as specified in https://www.isda.org/a/aWkgE/Linear-interpolation-04022022.pdf

getStubRateFloating

: [StubFloatingRate] -> SchedulePeriod -> HolidayCalendarData -> BusinessDayConventionEnum -> Optional O

Get the floating stub rate to be used for a stub period.

getStubRate

: StubCalculationPeriodAmount -> Bool -> SchedulePeriod -> HolidayCalendarData -> BusinessDayConventionEnum -> Bool -> Optional O

Get the stub rate to be used for a stub period. Currently, three main options from the FpML schema are supported:

  1. A fix stubRate.
  2. One or two floating rates for the stub.
  3. No specific stub rate defined -> use the same rate as is used for regular periods.
alignPaymentSchedule

: [SchedulePeriod] -> [SchedulePeriod] -> Update [SchedulePeriod]

Align the payment schedule with the calculation schedule.

verifyFxScheduleAndGetId
: [SchedulePeriod] -> SwapStream -> Party -> Party -> FxLinkedNotionalSchedule -> Update (Optional Text, Optional Decimal, Optional [Date])
getFxRateId
: [SchedulePeriod] -> SwapStream -> Party -> Party -> Update (Optional Text, Optional Decimal, Optional [Date])
getRateFixingsAndCalendars
: SwapStream -> ResetDates -> [SchedulePeriod] -> Party -> Party -> Update ([Date], HolidayCalendarData)
calculateFixPaymentClaimsFromSwapStream

: FixedRateSchedule -> SwapStream -> PeriodicSchedule -> [SchedulePeriod] -> [SchedulePeriod] -> Bool -> Bool -> Deliverable -> Party -> Party -> Optional Text -> Optional [Date] -> [(Decimal, Bool)] -> Update [TaggedClaim]

Create claims from swapStream that describes a fixed coupon stream.

calculatePrincipalExchangePaymentClaims

: [SchedulePeriod] -> Bool -> Deliverable -> Optional Text -> [(Decimal, Bool)] -> [Date] -> PrincipalExchanges -> TaggedClaim

Create principal exchange claims.

roundRate

: Decimal -> Rounding -> Decimal

Apply rounding convention to the rate used in a calculation period. Takes a Rounding FpML object as an input: https://www.fpml.org/spec/fpml-5-11-3-lcwd-1/html/confirmation/schemaDocumentation/schemas/fpml-shared-5-11_xsd/complexTypes/FloatingRateCalculation/finalRateRounding.html

checkRefRateCompounding

: FloatingRateCalculation -> (Bool, Optional DayCountConventionEnum)

Check whether a FloatingRateCalculation uses a reference rate that needs to be compounded. Seems there is no FpML element that specificies this, but that it is implicit in the rate name, for example "USD-SOFR-COMPOUND" If it is a compounded reference rate, also return the daycount convention that was used for the corresponding reference index, e.g. Act360 in the case of the SOFR Index.

calculateFloatingPaymentClaimsFromSwapStream

: FloatingRateCalculation -> SwapStream -> PeriodicSchedule -> [SchedulePeriod] -> [SchedulePeriod] -> Bool -> Bool -> Deliverable -> Party -> Party -> Optional Text -> Optional [Date] -> [(Decimal, Bool)] -> Update [TaggedClaim]

Create claims from swapStream that describes a floating coupon stream.

calculateClaimsFromSwapStream

: SwapStream -> PeriodicSchedule -> [SchedulePeriod] -> [SchedulePeriod] -> Optional SwapStream -> Bool -> Bool -> Deliverable -> Party -> Party -> Update [TaggedClaim]

Create claims from swapStream that describes a fixed or floating coupon stream.