public final class ImmutableFxIndex extends Object implements FxIndex, org.joda.beans.ImmutableBean, Serializable
A standard immutable implementation of FxIndex that defines the currency pair
and the rule for converting from fixing to maturity.
In most cases, applications should refer to indices by name, using FxIndex.of(String).
The named index will typically be resolved to an instance of this class.
As such, it is recommended to use the FxIndex interface in application
code rather than directly referring to this class.
| Modifier and Type | Class and Description |
|---|---|
static class |
ImmutableFxIndex.Builder
The bean-builder for
ImmutableFxIndex. |
static class |
ImmutableFxIndex.Meta
The meta-bean for
ImmutableFxIndex. |
| Modifier and Type | Method and Description |
|---|---|
static ImmutableFxIndex.Builder |
builder()
Returns a builder used to create an instance of the bean.
|
LocalDate |
calculateFixingFromMaturity(LocalDate maturityDate,
ReferenceData refData)
Calculates the fixing date from the maturity date.
|
LocalDate |
calculateMaturityFromFixing(LocalDate fixingDate,
ReferenceData refData)
Calculates the maturity date from the fixing date.
|
boolean |
equals(Object obj) |
CurrencyPair |
getCurrencyPair()
Gets the currency pair.
|
HolidayCalendarId |
getFixingCalendar()
Gets the calendar that determines which dates are fixing dates.
|
DaysAdjustment |
getFixingDateOffset()
Gets the adjustment applied to the maturity date to obtain the fixing date.
|
DaysAdjustment |
getMaturityDateOffset()
Gets the adjustment applied to the fixing date to obtain the maturity date.
|
String |
getName()
Gets the index name, such as 'EUR/GBP-ECB'.
|
int |
hashCode() |
static ImmutableFxIndex.Meta |
meta()
The meta-bean for
ImmutableFxIndex. |
ImmutableFxIndex.Meta |
metaBean() |
Function<LocalDate,FxIndexObservation> |
resolve(ReferenceData refData)
Resolves this index using the specified reference data, returning a function.
|
ImmutableFxIndex.Builder |
toBuilder()
Returns a builder that allows this bean to be mutated.
|
String |
toString()
Returns the name of the index.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitcreateFxIndex, extendedEnum, of, ofpublic LocalDate calculateMaturityFromFixing(LocalDate fixingDate, ReferenceData refData)
FxIndexThe fixing date is the date on which the index is to be observed. The maturity date is the date on which the implied amount is delivered/exchanged. The maturity date is typically two days after the fixing date.
No error is thrown if the input date is not a valid fixing date. Instead, the fixing date is moved to the next valid fixing date and then processed.
The maturity date is also known as the value date.
calculateMaturityFromFixing in interface FxIndexfixingDate - the fixing daterefData - the reference data, used to resolve the holiday calendarpublic LocalDate calculateFixingFromMaturity(LocalDate maturityDate, ReferenceData refData)
FxIndexThe fixing date is the date on which the index is to be observed. The maturity date is the date on which the implied amount is delivered/exchanged. The maturity date is typically two days after the fixing date.
No error is thrown if the input date is not a valid effective date. Instead, the effective date is moved to the next valid effective date and then processed.
The maturity date is also known as the value date.
calculateFixingFromMaturity in interface FxIndexmaturityDate - the maturity daterefData - the reference data, used to resolve the holiday calendarpublic Function<LocalDate,FxIndexObservation> resolve(ReferenceData refData)
FxIndex
This returns a Function that converts fixing dates to observations.
It binds the holiday calendar, looked up from the reference data, into the result.
As such, there is no need to pass the reference data in again.
This method is intended for use when looping to create multiple instances
of FxIndexObservation. Implementations of the method are intended
to optimize, avoiding repeated calls to resolve the holiday calendar
public String toString()
public static ImmutableFxIndex.Meta meta()
ImmutableFxIndex.public static ImmutableFxIndex.Builder builder()
public ImmutableFxIndex.Meta metaBean()
metaBean in interface org.joda.beans.Beanpublic String getName()
public CurrencyPair getCurrencyPair()
An index defines an FX rate in a single direction, such as from EUR to USD. This currency pair defines that direction.
In most cases, the same index can be used to convert in both directions by taking the rate or the reciprocal as necessary.
getCurrencyPair in interface FxIndexpublic HolidayCalendarId getFixingCalendar()
The fixing date is when the rate is determined.
getFixingCalendar in interface FxIndexpublic DaysAdjustment getFixingDateOffset()
The maturity date is the start date of the indexed deposit. In most cases, the fixing date is 2 days before the maturity date.
getFixingDateOffset in interface FxIndexpublic DaysAdjustment getMaturityDateOffset()
The maturity date is the start date of the indexed deposit. In most cases, the maturity date is 2 days after the fixing date.
getMaturityDateOffset in interface FxIndexpublic ImmutableFxIndex.Builder toBuilder()
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.