Class FxRateId

  • All Implemented Interfaces:
    MarketDataId<FxRate>, java.io.Serializable, Bean, ImmutableBean

    public final class FxRateId
    extends java.lang.Object
    implements MarketDataId<FxRate>, ImmutableBean, java.io.Serializable
    Identifies the market data for an FX rate.

    The currency pair in a rate ID is always the market convention currency pair. If an ID is created using a non-conventional pair, the pair is inverted. This has no effect on the FxRate identified by the ID as it can handle both currency pairs that can be created from the two currencies.

    See Also:
    Serialized Form
    • Method Detail

      • of

        public static FxRateId of​(CurrencyPair currencyPair)
        Obtains an instance representing the FX rate for a currency pair.
        Parameters:
        currencyPair - a currency pair
        Returns:
        an ID for the FX rate for the currency pair
      • of

        public static FxRateId of​(Currency base,
                                  Currency counter)
        Obtains an instance representing the FX rate for a currency pair.
        Parameters:
        base - the base currency of the pair
        counter - the counter currency of the pair
        Returns:
        an ID for the FX rate for the currency pair
      • of

        public static FxRateId of​(CurrencyPair currencyPair,
                                  ObservableSource observableSource)
        Obtains an instance representing the FX rate for a currency pair, specifying the source.
        Parameters:
        currencyPair - a currency pair
        observableSource - the source of the observable market data used to create the rate
        Returns:
        an ID for the FX rate for the currency pair
      • of

        public static FxRateId of​(Currency base,
                                  Currency counter,
                                  ObservableSource observableSource)
        Obtains an instance representing the FX rate for a currency pair, specifying the source.
        Parameters:
        base - the base currency of the pair
        counter - the counter currency of the pair
        observableSource - the source of the observable market data used to create the rate
        Returns:
        an ID for the FX rate for the currency pair
      • getMarketDataType

        public java.lang.Class<FxRate> getMarketDataType()
        Description copied from interface: MarketDataId
        Gets the type of data this identifier refers to.
        Specified by:
        getMarketDataType in interface MarketDataId<FxRate>
        Returns:
        the type of the market data this identifier refers to
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • meta

        public static TypedMetaBean<FxRateId> meta()
        The meta-bean for FxRateId.
        Returns:
        the meta-bean, not null
      • getPair

        public CurrencyPair getPair()
        Gets the currency pair that is required. For example, 'GBP/USD'.
        Returns:
        the value of the property, not null
      • getObservableSource

        public ObservableSource getObservableSource()
        Gets the source of observable market data. This is used when looking up the underlying market quotes for the rate.
        Returns:
        the value of the property, not null
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object