Interface CrossCurrencyPairProvider

    • Method Detail

      • getCrossCurrencyPairChain

        com.google.common.collect.ImmutableList<java.lang.String> getCrossCurrencyPairChain​(java.lang.String instrument,
                                                                                            java.lang.String currencyPair)
        Given the supplied instrument and currency pair, should return a list of currency pairs to traverse in order to provide the conversion rate.

        e.g. given the parameters FX.CROSS and GBPSGD it might return the currency pairs:
        GBPUSD USDEUR EURSGD
        which can then be traversed to get the conversion rate between GBP and SGD.

        If the inverse format does not exist, then it may still return a cross currency pair in its normal format.
        e.g. given the parameters FX.CROSS and BRLSGD, if the inverse currency pair JPYSGD does not exist, it might return the currency pairs:
        BRLJPY SGDJPY

        This may also be used for simple currency pair conversions where the inverse does not exist. e.g. given the parameters FX.CROSS and JPYSGD, if this inverse currency pair does not exist, it may return the currency pair:
        SGDJPY

        There must always be a linking currency between the cross currency pairs. The following would be invalid as there is no common currency between the last two currency pairs - we would expect USD to be the common currency:
        BRLJPY JPYUSD SGDEUR

        A common currency must be seen only twice. The following would be invalid as JPY is a common currency in more than two currency pairs:
        BRLJPY JPYUSD JPYEUR

        Additionally, the first currency pair in the chain must contain the base currency from the requested currency pair, and the last currency pair in the chain must contain the term currency from the requested currency pair.
        e.g. given the parameters FX.CROSS and BRLSGD
        the following chain would be invalid as the first currency pair does not contain the base currency of BRLSGD, BRL:
        JPYEUR EURUSD USDSGD
        the following chain would be invalid as the last currency pair does not contain the term currency of BRLSGD, SGD:
        BRLEUR EURUSD USDDKK