Class FXRates

  • All Implemented Interfaces:
    IFXRates

    public class FXRates
    extends Object
    implements IFXRates
    Implementation of IFXRates
    • Field Detail

      • LOGGER

        public static final Logger LOGGER
      • commonCcy

        public final String commonCcy
        Common currency used for indirect FX rate lookups
    • Constructor Detail

      • FXRates

        public FXRates​(String commonCcy,
                       String tenorAndMaturityDefaultValue,
                       String moneynessDefaultValue)
    • Method Detail

      • getSpotFXRate

        public Double getSpotFXRate​(com.qfs.store.IDatastoreVersion datastore,
                                    LocalDate asOfDate,
                                    String baseCcy,
                                    String counterCcy,
                                    com.quartetfs.biz.pivot.IActivePivot activePivot,
                                    List<Object> leafCoordinates,
                                    String marketDataSet)
        Retrieve the spot FX rate between two currencies.
        Specified by:
        getSpotFXRate in interface IFXRates
        Parameters:
        datastore - The datastore version to get the FX Rates from
        asOfDate - AsOf Date
        baseCcy - base currency (USD for the USD/EUR rate)
        counterCcy - quote currency (EUR for the USD/EUR rate)
        activePivot - ActivePivot instance
        leafCoordinates - Coordinates extracted from additional FX Rates Level Info
        marketDataSet - Set of fx rates to use
        Returns:
        FX rate between those two currencies, or null if no rate found.
      • getSpotFXRateWithErrorHandling

        public Double getSpotFXRateWithErrorHandling​(com.qfs.store.IDatastoreVersion datastore,
                                                     LocalDate asOfDate,
                                                     String baseCcy,
                                                     String counterCcy,
                                                     com.quartetfs.biz.pivot.IActivePivot activePivot,
                                                     List<Object> leafCoordinates,
                                                     String marketDataSet)
        Retrieve the spot FX rate between two currencies.
        Specified by:
        getSpotFXRateWithErrorHandling in interface IFXRates
        Parameters:
        datastore - The datastore version to get the FX Rates from
        asOfDate - AsOf Date
        baseCcy - base currency (USD for the USD/EUR rate)
        counterCcy - quote currency (EUR for the USD/EUR rate)
        activePivot - ActivePivot instance
        leafCoordinates - Coordinates extracted from additional FX Rates Level Info
        marketDataSet - Set of fx rates to use
        Returns:
        FX rate between those two currencies, or null if no rate found.
      • getSpotFXRate

        public static Double getSpotFXRate​(com.qfs.store.IDatastoreVersion datastore,
                                           LocalDate asOfDate,
                                           String baseCcy,
                                           String counterCcy,
                                           String commonCcy,
                                           com.quartetfs.biz.pivot.IActivePivot activePivot,
                                           List<Object> leafCoordinates,
                                           String marketDataSet)
        Lookup the spot FX rate between two currencies. Try direct lookup first, if not found try using common currency.
        Parameters:
        datastore - The datastore version to get the FX Rates from
        asOfDate - AsOf Date
        baseCcy - base currency (USD for the USD/EUR rate)
        counterCcy - quote currency (EUR for the USD/EUR rate)
        commonCcy - common currency used for indirect lookup.
        activePivot - ActivePivot instance
        leafCoordinates - Coordinates extracted from additional FX Rates Level Info
        marketDataSet - Set of fx rates to use
        Returns:
        FX rate between the base and counter currencies, or null if no rate found.
      • getSpotFXRateDirectOrReverse

        public static Double getSpotFXRateDirectOrReverse​(com.qfs.store.IDatastoreVersion datastore,
                                                          LocalDate asOfDate,
                                                          String baseCcy,
                                                          String counterCcy,
                                                          String marketDataSet)
        Queries the datastore for the direct spot rate, if not found queries the reverse spot rate and returns the reciprocal.
        Parameters:
        datastore - The datastore version to get the FX Rates from
        asOfDate - AsOf Date
        baseCcy - base currency (USD for the USD/EUR rate)
        counterCcy - quote currency (EUR for the USD/EUR rate)
        marketDataSet - Set of fx rates to use
        Returns:
        The direct or reverse rate between two currencies, depending on which is available.
      • getSpotFXRateDirect

        public static Double getSpotFXRateDirect​(com.qfs.store.IDatastoreVersion datastore,
                                                 LocalDate asOfDate,
                                                 String baseCcy,
                                                 String counterCcy,
                                                 String marketDataSet)
        Queries the datastore directly for the spot FX rate.
        Parameters:
        datastore - The datastore version to get the FX Rates from
        asOfDate - AsOf Date
        baseCcy - base currency (USD for the USD/EUR rate)
        counterCcy - quote currency (EUR for the USD/EUR rate)
        marketDataSet - Set of fx rates to use
        Returns:
        The direct rate between two currencies, from the datastore.
      • getMarketShift

        public com.qfs.vector.IVector getMarketShift​(com.qfs.store.IDatastoreVersion datastore,
                                                     LocalDate asOfDate,
                                                     String baseCcy,
                                                     String counterCcy,
                                                     com.quartetfs.biz.pivot.IActivePivot activePivot,
                                                     List<Object> leafCoordinates,
                                                     String marketDataSet,
                                                     String scenarioSet)
        Description copied from interface: IFXRates
        Retrieve the FX market shifts between two currencies. The shifted FX rate = (marketShift + 1) * fxRate
        Specified by:
        getMarketShift in interface IFXRates
        Parameters:
        datastore - The datastore version to get the FX Rates from
        asOfDate - AsOf Date
        baseCcy - base currency (USD for the USD/EUR rate)
        counterCcy - quote currency (EUR for the USD/EUR rate)
        activePivot - ActivePivot instance
        leafCoordinates - Coordinates extracted from additional FX Rates Level Info
        marketDataSet - Set of fx rates to use
        scenarioSet - The VaR scenarios that the vector must match
        Returns:
        FX market shifts between those two currencies, or null if no rate found.
      • getDetailedMarketShift

        public Map<String,​com.qfs.vector.IVector> getDetailedMarketShift​(com.qfs.store.IDatastoreVersion datastore,
                                                                               LocalDate asOfDate,
                                                                               String baseCcy,
                                                                               String counterCcy,
                                                                               com.quartetfs.biz.pivot.IActivePivot activePivot,
                                                                               List<Object> leafCoordinates,
                                                                               String marketDataSet,
                                                                               String scenarioSet)
        Description copied from interface: IFXRates
        Retrieve the FX market shifts between two currencies. The shifted FX rate = (marketShift + 1) * fxRate
        Specified by:
        getDetailedMarketShift in interface IFXRates
        Parameters:
        datastore - The datastore version to get the FX Rates from
        asOfDate - AsOf Date
        baseCcy - base currency (USD for the USD/EUR rate)
        counterCcy - quote currency (EUR for the USD/EUR rate)
        activePivot - ActivePivot instance
        leafCoordinates - Coordinates extracted from additional FX Rates Level Info
        marketDataSet - Set of fx rates to use
        scenarioSet - The VaR scenarios that the vector must match
        Returns:
        FX market shifts between those two currencies, or null if no rate found.
      • getMarketShiftDirect

        public com.quartetfs.fwk.impl.Pair<String,​com.qfs.vector.IVector> getMarketShiftDirect​(com.qfs.store.IDatastoreVersion datastore,
                                                                                                     LocalDate asOfDate,
                                                                                                     String baseCcy,
                                                                                                     String counterCcy,
                                                                                                     String marketDataSet,
                                                                                                     String scenarioSet)