Class ResolvedFxSingle

  • All Implemented Interfaces:
    ResolvedProduct, Serializable, org.joda.beans.Bean, org.joda.beans.ImmutableBean

    public final class ResolvedFxSingle
    extends Object
    implements ResolvedProduct, org.joda.beans.ImmutableBean, Serializable
    A single FX transaction, resolved for pricing.

    This is the resolved form of FxSingle and is an input to the pricers. Applications will typically create a ResolvedFxSingle from a FxSingle using FxSingle.resolve(ReferenceData).

    The two payments are identified as the base and counter currencies in a standardized currency pair. For example, a EUR/USD exchange always has EUR as the base payment and USD as the counter payment. See CurrencyPair for details of the configuration that determines the ordering.

    A ResolvedFxSingle is bound to data that changes over time, such as holiday calendars. If the data changes, such as the addition of a new holiday, the resolved form will not be updated. Care must be taken when placing the resolved form in a cache or persistence layer.

    See Also:
    Serialized Form
    • Method Detail

      • of

        public static ResolvedFxSingle of​(Payment payment1,
                                          Payment payment2)
        Creates an ResolvedFxSingle from two equivalent payments in different currencies.

        The payments must be of the correct type, one pay and one receive. The currencies of the payments must differ.

        This factory identifies the currency pair of the exchange and assigns the payments to match the base or counter currency of the standardized currency pair. For example, a EUR/USD exchange always has EUR as the base payment and USD as the counter payment.

        Parameters:
        payment1 - the first payment
        payment2 - the second payment
        Returns:
        the resolved foreign exchange transaction
      • of

        public static ResolvedFxSingle of​(CurrencyAmount amount1,
                                          CurrencyAmount amount2,
                                          LocalDate valueDate)
        Creates an ResolvedFxSingle from two amounts and the value date.

        The amounts must be of the correct type, one pay and one receive. The currencies of the payments must differ.

        This factory identifies the currency pair of the exchange and assigns the payments to match the base or counter currency of the standardized currency pair. For example, a EUR/USD exchange always has EUR as the base payment and USD as the counter payment.

        Parameters:
        amount1 - the amount in the first currency
        amount2 - the amount in the second currency
        valueDate - the value date
        Returns:
        the resolved foreign exchange transaction
      • of

        public static ResolvedFxSingle of​(CurrencyAmount amountCurrency1,
                                          FxRate fxRate,
                                          LocalDate paymentDate)
        Creates an ResolvedFxSingle using a rate.

        This create an FX specifying a value date, notional in one currency, the second currency and the FX rate between the two. The currencies of the payments must differ.

        This factory identifies the currency pair of the exchange and assigns the payments to match the base or counter currency of the standardized currency pair. For example, a EUR/USD exchange always has EUR as the base payment and USD as the counter payment.

        No payment date adjustments apply.

        Parameters:
        amountCurrency1 - the amount of the near leg in the first currency
        fxRate - the near FX rate
        paymentDate - date that the FX settles
        Returns:
        the resolved foreign exchange transaction
      • getCurrencyPair

        public CurrencyPair getCurrencyPair()
        Gets currency pair of the base currency and counter currency.

        This currency pair is conventional, thus indifferent to the direction of FX.

        Returns:
        the currency pair
      • getReceiveCurrencyAmount

        public CurrencyAmount getReceiveCurrencyAmount()
        Gets the currency amount in which the amount is received.

        This returns the currency amount whose amount is non-negative. If both are zero, the currency amount of counterCurrencyPayment is returned.

        Returns:
        the receive currency amount
      • getPaymentDate

        public LocalDate getPaymentDate()
        Returns the date that the transaction settles.

        This returns the settlement date of the base currency.

        Returns:
        the value date
      • inverse

        public ResolvedFxSingle inverse()
        Returns the inverse transaction.

        The result has the base and counter payments negated.

        Returns:
        the inverse transaction
      • meta

        public static ResolvedFxSingle.Meta meta()
        The meta-bean for ResolvedFxSingle.
        Returns:
        the meta-bean, not null
      • metaBean

        public ResolvedFxSingle.Meta metaBean()
        Specified by:
        metaBean in interface org.joda.beans.Bean
      • getBaseCurrencyPayment

        public Payment getBaseCurrencyPayment()
        Gets the payment in the base currency, positive if receiving, negative if paying.

        The payment amount is signed. A positive amount indicates the payment is to be received. A negative amount indicates the payment is to be paid.

        Returns:
        the value of the property, not null
      • getCounterCurrencyPayment

        public Payment getCounterCurrencyPayment()
        Gets the payment in the counter currency, positive if receiving, negative if paying.

        The payment amount is signed. A positive amount indicates the payment is to be received. A negative amount indicates the payment is to be paid.

        Returns:
        the value of the property, not null
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object