Class FXOrderAdapter

java.lang.Object
com.caplin.motif.datasource.CachedAdapter
com.caplin.motif.fx.orders.FXOrderAdapter

public class FXOrderAdapter extends CachedAdapter
  • Constructor Details

    • FXOrderAdapter

      public FXOrderAdapter(com.caplin.datasource.DataSource dataSource) throws IOException
      Constructs an FXOrderAdapter that will utilise the specified DataSource and its configuration for communication with the motif.

      Uses a default ThreadMode of ThreadMode.SharedThreads

      Parameters:
      dataSource - The DataSource that will be used to receive requests for orders.
      Throws:
      IOException - If an error occurred reading configuration files for the adapter.
    • FXOrderAdapter

      public FXOrderAdapter(com.caplin.datasource.DataSource dataSource, ThreadMode threadMode) throws IOException
      Constructs an FXOrderAdapter 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 orders.
      threadMode - The thread mode to use for trades being made through the Adapter.
      Throws:
      IOException - If an error occurred reading configuration files for the adapter.
    • FXOrderAdapter

      public FXOrderAdapter(com.caplin.datasource.DataSource dataSource, ThreadMode threadMode, Properties properties) throws IOException
      Constructs an FXOrderAdapter 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 orders.
      threadMode - The thread mode to use for trades being made through the Adapter.
      properties - The properties file to use when creating the TradingProvider
      Throws:
      IOException - If an error occurred reading configuration files for the adapter.
    • FXOrderAdapter

      public FXOrderAdapter(TradeAdapter tradeAdapter)

      Constructs an FXOrderAdapter that will utilise the specified TradeAdapter and its configuration for communication with the motif.

      Prefer this constructor if you will be implementing multiple trade adapters in a single adapter.

      Parameters:
      tradeAdapter - The trade adapter
  • Method Details

    • addUserSessionListener

      public void addUserSessionListener(UserSessionListener listener)
      Adds a listener that will be notified whenever a user session is created and closed. Note that you can add multiple UserSessionListeners
      Parameters:
      listener - the listener to be notified of session lifecycle events.
    • removeUserSessionListener

      public void removeUserSessionListener(UserSessionListener listener)
      Removes a listener UserSessionListener to stop receiving session events.
      Parameters:
      listener - the listener to be removed from receiving session lifecycle events.
    • registerOrderSubmissionTradeListenerFactory

      public void registerOrderSubmissionTradeListenerFactory(OrderSubmissionTradeListenerFactory factory)
      Registers a factory that will listen to Order Submission Trade workflows initiated from the client.
      Parameters:
      factory - the factory that will be asked to create the OrderSubmissionTradeListener
    • registerBulkOrderSubmissionTradeListenerFactory

      public void registerBulkOrderSubmissionTradeListenerFactory(BulkOrderSubmissionTradeListenerFactory factory)
      Registers a factory that will listen to Bulk Order Submission Trade workflows initiated from the client.
      Parameters:
      factory - the factory that will be asked to create the BulkOrderSubmissionTradeListener
    • registerEditStrategyTradeListenerFactory

      public void registerEditStrategyTradeListenerFactory(EditStrategyTradeListenerFactory factory)
      Registers a factory that will listen to Edit Strategy Trade workflows initiated from the client.
      Parameters:
      factory - the factory that will be asked to create the EditStrategyTradeListener
    • registerBulkOrderActionTradeListenerFactory

      public void registerBulkOrderActionTradeListenerFactory(BulkOrderActionTradeListenerFactory factory)
      Registers a factory that will listen to Bulk Order Action Trade workflows initiated from the client.
      Parameters:
      factory - the factory that will be asked to create the BulkOrderActionTradeListener
    • registerOrderChangeStateTradeListenerFactory

      public void registerOrderChangeStateTradeListenerFactory(OrderChangeStateTradeListenerFactory factory)
      Registers a factory that will listen to Order Change State Trade workflows initiated from the client.
      Parameters:
      factory - the factory that will be asked to create the OrderChangeStateTradeListener
    • registerPostTradeAllocationTradeListenerFactory

      @Deprecated public void registerPostTradeAllocationTradeListenerFactory(PostTradeAllocationTradeListenerFactory factory)
      Deprecated.
      use the newer spec associated with the trade adapter at FXTradeAdapter.registerAllocateTradeListenerFactory(AllocateTradeListenerFactory)
      Registers a factory that will listen the v1 specification of the Post Trade Allocation
      Parameters:
      factory - the factory that will be asked to create the PostTradeAllocationTradeListener
    • registerOrderDetailsProvider

      public void registerOrderDetailsProvider(CachedMessageProvider<OrderSubjectInfo> provider)
      Registers a provider that is capable of responding to order details requests.

      Provide with messages generated from OrderDetailsTypesDef.OrderDetails

    • registerOrderDetailsProvider

      public void registerOrderDetailsProvider(String namespace, CachedMessageProvider<OrderSubjectInfo> provider)
      Registers a provider that is capable of responding to order details requests.

      Provide with messages generated from OrderDetailsTypesDef.OrderDetails

    • registerOrderDetailsProvider

      public void registerOrderDetailsProvider(String namespace, CachedMessageProvider<OrderSubjectInfo> provider, OrderSubjectParser subjectParser)
      Registers a provider that is capable of responding to order details requests.

      Provide with messages generated from OrderDetailsTypesDef.OrderDetails

    • registerSalesOrderDetailsProvider

      public void registerSalesOrderDetailsProvider(CachedMessageProvider<OrderSubjectInfo> provider)
      Registers a provider that is capable of responding to sales order details requests.

      Provide with messages generated from OrderDetailsTypesDef.OrderSalesDetails

    • registerSalesOrderDetailsProvider

      public void registerSalesOrderDetailsProvider(String namespace, CachedMessageProvider<OrderSubjectInfo> provider)
      Registers a provider that is capable of responding to sales order details requests.

      Provide with messages generated from OrderDetailsTypesDef.OrderSalesDetails

    • registerSalesOrderDetailsProvider

      public void registerSalesOrderDetailsProvider(String namespace, CachedMessageProvider<OrderSubjectInfo> provider, OrderSubjectParser subjectParser)
      Registers a provider that is capable of responding to sales order details requests.

      Provide with messages generated from OrderDetailsTypesDef.OrderSalesDetails

    • registerOrderCurrencyPairConfigProvider

      public void registerOrderCurrencyPairConfigProvider(CachedObjectProvider<OrderCurrencyPairConfig,OrderCurrencyPairConfigSubjectInfo> provider)
      Registers a provider that is capable of responding to currency pair order configuration requests made by individual traders.
      Parameters:
      provider - The JsonDataProvider that will receive the currency pair configuration requests
    • registerOrderCurrencyPairConfigProvider

      public <T extends SubjectInfo> void registerOrderCurrencyPairConfigProvider(CachedObjectProvider<OrderCurrencyPairConfig,T> provider, com.caplin.datasource.namespace.Namespace namespace, SubjectParser<T> subjectParser)
      Used to register a provider that is capable of responding to currency pair order configuration requests made by individual traders on non-standard subjects.
      Parameters:
      provider - The JsonDataProvider that will receive the currency pair configuration requests
      namespace - A namespace that matches the format of your custom subjects
      subjectParser - A parser that will turn the requested subject into your own custom subclass of SubjectInfo
    • registerToboOrderCurrencyPairConfigProvider

      public void registerToboOrderCurrencyPairConfigProvider(CachedObjectProvider<OrderCurrencyPairConfig,ToboOrderCurrencyPairConfigSubjectInfo> provider)
      Used to register a provider that is capable of responding to currency pair order configuration requests made by brokers.
      Parameters:
      provider - The JsonDataProvider that will receive the currency pair configuration requests
    • registerToboOrderCurrencyPairConfigProvider

      public <T extends SubjectInfo> void registerToboOrderCurrencyPairConfigProvider(CachedObjectProvider<OrderCurrencyPairConfig,T> provider, com.caplin.datasource.namespace.Namespace namespace, SubjectParser<T> subjectParser)
      Used to register a provider that is capable of responding to currency pair order configuration requests made by brokers on non-standard subjects.
      Parameters:
      provider - The JsonDataProvider that will receive the currency pair configuration requests
      namespace - A namespace that matches the format of your custom subjects
      subjectParser - A parser that will turn the requested subject into your own custom subclass of SubjectInfo