E
- JDK Date/Calendar, JDK8 LocalDate or Joda LocalDatepublic class CurrencyDateCalculatorBuilder<E extends Serializable> extends Object
CurrencyDateCalculatorBuilder<LocalDate> builder = new CurrencyDateCalculatorBuilder<LocalDate>() // .currencyPair("EUR", "GBP", SpotLag.T_2) // .ccy1Calendar(new DefaultHolidayCalendar<LocalDate>()) // empty .ccy1Week(WorkingWeek.DEFAULT) // Mon-Fri .ccy2Calendar(gbpCalendar) // .ccy2Week(WorkingWeek.DEFAULT) // Mon-Fri .crossCcy("USD") // the usual suspect .crossCcyCalendar(usdCalendar) // .crossCcyWeek(WorkingWeek.DEFAULT) // Mon-Fri; .adjustStartDateWithCurrencyPair(true) // default is true, Move the startDate to a working date for ccy1 and ccy2 .tenorHolidayHandler(new LocalDateForwardHandler()) // Forward (or equivalent for your implementation) .brokenDateAllowed(false) // use the CrossCcy holidays on Spot and Tenor Date .currencyCalculatorConfig(new DefaultCurrencyCalculatorConfig()) // Will be used for finding Working Weeks IF NOT PROVIDED and Latin // American ccy USD handling.
Constructor and Description |
---|
CurrencyDateCalculatorBuilder()
Default values are:
crossCcy = USD
ccy1Calendar = Empty Calendar
ccy2Calendar = Empty Calendar
crossCcyCalendar = Empty Calendar
brokenDateAllowed = false
adjustStartDateWithCurrencyPair = true
spotLag = SpotLag.T_2
|
Modifier and Type | Method and Description |
---|---|
CurrencyDateCalculatorBuilder<E> |
adjustStartDateWithCurrencyPair(boolean adjustStartDateWithCurrencyPair)
If true, the startDate given to the calculator will be move to the NEXT working day for both currencies (e.g.
|
CurrencyDateCalculatorBuilder<E> |
brokenDateAllowed(boolean brokenDateAllowed)
If true, then the calculator can return a SpotDate/TenorDate where the cross currency is NOT a trading date (e.g.
|
CurrencyDateCalculatorBuilder<E> |
ccy1Calendar(HolidayCalendar<E> ccy1Calendar)
The holiday calendar for ccy1, if null or not set, then a default calendar will be used with NO holidays.
|
CurrencyDateCalculatorBuilder<E> |
ccy1Week(WorkingWeek ccy1Week)
Provides the definition of a working week for the currency; if not provided and the currencyCalculatorConfig is given, it
will do a look up for this currency.
|
CurrencyDateCalculatorBuilder<E> |
ccy2Calendar(HolidayCalendar<E> ccy2Calendar)
The holiday calendar for ccy2, if null or not set, then a default calendar will be used with NO holidays.
|
CurrencyDateCalculatorBuilder<E> |
ccy2Week(WorkingWeek ccy2Week)
Provides the definition of a working week for the currency; if not provided and the currencyCalculatorConfig is given, it
will do a look up for this currency.
|
void |
checkValidity()
Checks the builder and throws an IllegalArgumentException if there are issues e.g.
|
CurrencyDateCalculatorBuilder<E> |
crossCcy(String crossCcy)
If brokenDate is not allowed, we do require to check the WorkingWeek and Holiday for the crossCcy when
validating the SpotDate or a Tenor date; if null or not set, then a default calendar will be used with NO holidays.
|
CurrencyDateCalculatorBuilder<E> |
crossCcyCalendar(HolidayCalendar<E> crossCcyCalendar)
If brokenDate is not allowed, we do require to check the WorkingWeek and Holiday for the crossCcy when
validating the SpotDate or a Tenor date.
|
CurrencyDateCalculatorBuilder<E> |
crossCcyWeek(WorkingWeek crossCcyWeek)
If brokenDate is not allowed, we do require to check the WorkingWeek and Holiday for the crossCcy when
validating the SpotDate or a Tenor date.
|
CurrencyDateCalculatorBuilder<E> |
currencyCalculatorConfig(CurrencyCalculatorConfig currencyCalculatorConfig)
Provides information about currencies subject to USD on T+1 and WorkingWeeks if not specified individually.
|
CurrencyDateCalculatorBuilder<E> |
currencyPair(String ccy1,
String ccy2,
SpotLag spotLag)
This specialises the calculator to the given currency pair and the SpotLag (0, 1, 2).
|
String |
getCcy1() |
HolidayCalendar<E> |
getCcy1Calendar() |
WorkingWeek |
getCcy1Week() |
String |
getCcy2() |
HolidayCalendar<E> |
getCcy2Calendar() |
WorkingWeek |
getCcy2Week() |
String |
getCrossCcy() |
HolidayCalendar<E> |
getCrossCcyCalendar() |
WorkingWeek |
getCrossCcyWeek() |
CurrencyCalculatorConfig |
getCurrencyCalculatorConfig() |
SpotLag |
getSpotLag() |
HolidayHandler<E> |
getTenorHolidayHandler() |
boolean |
isAdjustStartDateWithCurrencyPair() |
boolean |
isBrokenDateAllowed() |
CurrencyDateCalculatorBuilder<E> |
tenorHolidayHandler(HolidayHandler<E> holidayHandler)
Provides the holiday handler for the Tenor Date, note that Spot is ALWAYS using Forward.
|
public CurrencyDateCalculatorBuilder()
public void checkValidity()
public String getCcy1()
public String getCcy2()
public String getCrossCcy()
public HolidayCalendar<E> getCcy1Calendar()
public HolidayCalendar<E> getCcy2Calendar()
public HolidayCalendar<E> getCrossCcyCalendar()
public HolidayHandler<E> getTenorHolidayHandler()
public WorkingWeek getCcy1Week()
public WorkingWeek getCcy2Week()
public WorkingWeek getCrossCcyWeek()
public CurrencyCalculatorConfig getCurrencyCalculatorConfig()
public boolean isBrokenDateAllowed()
public CurrencyDateCalculatorBuilder<E> currencyPair(String ccy1, String ccy2, SpotLag spotLag)
ccy1
- ccy2
- spotLag
- public SpotLag getSpotLag()
public boolean isAdjustStartDateWithCurrencyPair()
public CurrencyDateCalculatorBuilder<E> adjustStartDateWithCurrencyPair(boolean adjustStartDateWithCurrencyPair)
adjustStartDateWithCurrencyPair
- default truepublic CurrencyDateCalculatorBuilder<E> brokenDateAllowed(boolean brokenDateAllowed)
brokenDateAllowed
- default falsepublic CurrencyDateCalculatorBuilder<E> currencyCalculatorConfig(CurrencyCalculatorConfig currencyCalculatorConfig)
currencyCalculatorConfig
- the configpublic CurrencyDateCalculatorBuilder<E> ccy1Calendar(HolidayCalendar<E> ccy1Calendar)
ccy1Calendar
- the Calendar for ccy1public CurrencyDateCalculatorBuilder<E> ccy2Calendar(HolidayCalendar<E> ccy2Calendar)
ccy2Calendar
- the Calendar for ccy2public CurrencyDateCalculatorBuilder<E> crossCcy(String crossCcy)
crossCcy
- the crossCcy (default USD).public CurrencyDateCalculatorBuilder<E> crossCcyCalendar(HolidayCalendar<E> crossCcyCalendar)
crossCcyCalendar
- the set of holidays for the crossCcypublic CurrencyDateCalculatorBuilder<E> tenorHolidayHandler(HolidayHandler<E> holidayHandler)
holidayHandler
- the Handler to work out what to do if a Tenor Date falls on a non WorkingDay.public CurrencyDateCalculatorBuilder<E> ccy1Week(WorkingWeek ccy1Week)
ccy1Week
- WorkingWeek definitionpublic CurrencyDateCalculatorBuilder<E> ccy2Week(WorkingWeek ccy2Week)
ccy2Week
- WorkingWeek definitionpublic CurrencyDateCalculatorBuilder<E> crossCcyWeek(WorkingWeek crossCcyWeek)
crossCcyWeek
- the crossCcy WorkingWeek.Copyright © 2006–2022 Appendium - Portfolio Financing Platform. All rights reserved.