Class FXRatesAdapter


  • public class FXRatesAdapter
    extends CachedAdapter

    An FXRatesAdapter services rate streaming for ESP, SPOT, FORWARD and SWAP rates. The adapter also supports streaming prices for broken dates.

    Typically, an FXRatesAdapter will be setup as follows:

     FXRatesAdapter adapter = new FXRatesAdapter(dataSource);
     
    • Constructor Detail

      • FXRatesAdapter

        public FXRatesAdapter​(com.caplin.datasource.DataSource dataSource)
        Constructs an FXRatesAdapter that will utilise the specified DataSource and its configuration for communication with the motif.
        Parameters:
        dataSource - The DataSource that will be used to receive requests for ESP, SPOT, FORWARD and SWAP rates. As well as requests for prices on Broken Dates.
    • Method Detail

      • createQuotePublisher

        public FXQuotePublisher createQuotePublisher​(String namespace,
                                                     CachedDataProvider<RateSubjectInfo> provider,
                                                     boolean sendDiscardAfterError)
        Creates an FXQuotePublisher that is able to respond to messages received on the CachedDataProvider that is passed in.
        Parameters:
        namespace - the namespace to provide rates for, defaults are defined in RateSubjectNamespacing.DefaultNamespaces
        provider - the CachedDataProvider that will receive the rate requests
        sendDiscardAfterError - If set to TRUE, your CachedDataProvider will receive an immediate callback on the CachedDataProvider.onDiscard(SubjectInfo) method after you publish a failure message by calling SubjectMessagePublisher.sendNotFound(SubjectInfo). This can be useful if you want to use the same code path to clear a cache (for example) whether a subscription is ended by the client discarding it or the back end you are integrating with no longer providing the data.
        Returns:
        the FXQuotePublisher able to send quotes containing rates
      • createQuotePublisher

        public FXQuotePublisher createQuotePublisher​(String namespace,
                                                     CachedDataProvider<RateSubjectInfo> provider)
        Creates an FXQuotePublisher that is able to respond to messages received on the CachedDataProvider that is passed in.
        Parameters:
        namespace - the namespace to provide rates for, defaults are defined in RateSubjectNamespacing.DefaultNamespaces
        provider - the CachedDataProvider that will receive the rate requests
        Returns:
        the FXQuotePublisher able to send quotes containing rates
      • createQuotePublisherWithSubjectParser

        public <T extends RateSubjectInfoFXQuotePublisher createQuotePublisherWithSubjectParser​(String namespace,
                                                                                                  CachedDataProvider<T> provider,
                                                                                                  SubjectParser<T> subjectParser)
        Creates an FXQuotePublisher that is able to respond to messages received on the CachedDataProvider that is passed in.
        Parameters:
        namespace - the namespace to provide rates for, defaults are defined in RateSubjectNamespacing.DefaultNamespaces
        provider - the CachedDataProvider that will receive the rate requests
        subjectParser - the parser that will parse rate subject requests into an object representation of the request.
        Returns:
        the FXQuotePublisher able to send quotes containing rates
      • createQuotePublisherWithSubjectParser

        public <T extends RateSubjectInfoFXQuotePublisher createQuotePublisherWithSubjectParser​(String namespace,
                                                                                                  CachedDataProvider<T> provider,
                                                                                                  SubjectParser<T> subjectParser,
                                                                                                  boolean sendDiscardAfterError)
        Creates an FXQuotePublisher that is able to respond to messages received on the CachedDataProvider that is passed in.
        Parameters:
        namespace - the namespace to provide rates for, defaults are defined in RateSubjectNamespacing.DefaultNamespaces
        provider - the CachedDataProvider that will receive the rate requests
        subjectParser - the parser that will parse rate subject requests into an object representation of the request.
        sendDiscardAfterError - If set to TRUE, your CachedDataProvider will receive an immediate callback on the CachedDataProvider.onDiscard(SubjectInfo) method after you publish a failure message by calling SubjectMessagePublisher.sendNotFound(SubjectInfo). This can be useful if you want to use the same code path to clear a cache (for example) whether a subscription is ended by the client discarding it or the back end you are integrating with no longer providing the data.
        Returns:
        the FXQuotePublisher able to send quotes containing rates
      • createQuotePublisherWithSubjectParser

        public <T extends RateSubjectInfoFXQuotePublisher createQuotePublisherWithSubjectParser​(com.caplin.datasource.namespace.Namespace namespace,
                                                                                                  CachedDataProvider<T> provider,
                                                                                                  SubjectParser<T> subjectParser)
        Creates an FXQuotePublisher that is able to respond to messages received on the CachedDataProvider that is passed in.
        Parameters:
        namespace - a custom namespace to provide rates for
        provider - the CachedDataProvider that will receive the rate requests
        subjectParser - the parser that will parse rate subject requests into an object representation of the request.
        Returns:
        the FXQuotePublisher able to send quotes containing rates
      • createQuotePublisherWithSubjectParser

        public <T extends RateSubjectInfoFXQuotePublisher createQuotePublisherWithSubjectParser​(com.caplin.datasource.namespace.Namespace namespace,
                                                                                                  CachedDataProvider<T> provider,
                                                                                                  SubjectParser<T> subjectParser,
                                                                                                  boolean sendDiscardAfterError)
        Creates an FXQuotePublisher that is able to respond to messages received on the CachedDataProvider that is passed in.
        Parameters:
        namespace - a custom namespace to provide rates for
        provider - the CachedDataProvider that will receive the rate requests
        subjectParser - the parser that will parse rate subject requests into an object representation of the request.
        sendDiscardAfterError - If set to TRUE, your CachedDataProvider will receive an immediate callback on the CachedDataProvider.onDiscard(SubjectInfo) method after you publish a failure message by calling SubjectMessagePublisher.sendNotFound(SubjectInfo). This can be useful if you want to use the same code path to clear a cache (for example) whether a subscription is ended by the client discarding it or the back end you are integrating with no longer providing the data.
        Returns:
        the FXQuotePublisher able to send quotes containing rates