Package com.caplin.motif.fx.trading
Class FXTradeAdapter
java.lang.Object
com.caplin.motif.datasource.CachedAdapter
com.caplin.motif.fx.trading.FXTradeAdapter
An FXTradeAdapter services trading capabilities for the Executable Streaming Price (ESP), Request For Stream (RFS) and Block Trade (BLOCK) protocols.
Typically, a FXTradeAdapter will be set up as follows:
FXTradeAdapter adapter = new FXTradeAdapter(dataSource); adapter.registerESPTradeListenerFactory(new MyESPTradeListenerFactory()); adapter.registerRFSTradeListenerFactory(new MyRFSTradeListenerFactory()); adapter.registerBlockTradeListenerFactory(new MyBlockTradeListenerFactory());
-
Field Summary
Fields inherited from class com.caplin.motif.datasource.CachedAdapter
dataSource
-
Constructor Summary
ConstructorDescriptionFXTradeAdapter
(com.caplin.datasource.DataSource dataSource) Constructs an FXTradeAdapter that will utilise the specified DataSource and its configuration for communication with the motif.FXTradeAdapter
(com.caplin.datasource.DataSource dataSource, ThreadMode threadMode) Constructs an FXTradeAdapter that will utilise the specified DataSource and its configuration for communication with the motif.FXTradeAdapter
(com.caplin.datasource.DataSource dataSource, ThreadMode threadMode, Properties properties) Constructs an FXTradeAdapter that will utilise the specified DataSource and its configuration for communication with the motif.FXTradeAdapter
(TradeAdapter tradeAdapter) Constructs an FXTradeAdapter that will utilise the specified TradeAdapter and its configuration for communication with the motif. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addUserSessionListener
(UserSessionListener listener) Adds a listener that will be notified whenever a user session is created and closed.void
Registers a factory that will listen to Allocate Trade workflows initiated from the client.void
Registers a factory that will listen to Amend Trade workflows initiated from the client.void
Deprecated.The 'BLOCK' TradingProtocol will be removed, Block Trading should now be handled via the standard RFSListener.void
Deprecated.The 'BLOCK' TradingProtocol will be removed, Block Trading should now be handled via the standard RFSListener.void
registerBlockTradeListenerFactory
(BlockTradeListenerFactory factory, TradeValidator tradeFieldsValidator) Deprecated.The 'BLOCK' TradingProtocol will be removed, Block Trading should now be handled via the standard RFSListener.void
Registers a factory that will listen to Cancel Trade workflows initiated from the client.void
Registers a factory that will listen to Drawdown Trade workflows initiated from the client.void
Registers a factory that will listen to ESP Trade workflows initiated from the client.<T extends TradeSubjectInfo>
voidRegisters a provider that is capable of responding to post trade history requests.void
Registers a factory that will listen to RFS Trade workflows initiated from the client.void
Registers a factory that will listen to SalesIntervention Trade workflows initiated from the client.<T extends TradeSubjectInfo>
voidregisterSalesPostTradeHistoryProvider
(CachedObjectProvider<PostTradeHistory, TradeSubjectInfo> provider) Registers a provider that is capable of responding to sales post trade history requests.void
Registers a provider that is capable of responding to Sales trade confirmation requests.void
Registers a factory that will listen to Settlement Instruction workflows initiated from the client.void
Registers a factory that will listen to Settlement Trade workflows initiated from the client.<T extends TradeSubjectInfo>
voidregisterTradeConfirmationProvider
(com.caplin.datasource.namespace.Namespace namespace, CachedMessageProvider<T> provider, SubjectParser<T> subjectParser) Registers a provider that is capable of responding to trade confirmation requests.void
Registers a provider that is capable of responding to trade confirmation requests.void
registerTradeConfirmationProvider
(String namespace, CachedMessageProvider<TradeSubjectInfo> provider) Registers a provider that is capable of responding to trade confirmation requests.<T extends TradeSubjectInfo>
voidregisterTradeConfirmationProvider
(String namespace, CachedMessageProvider<T> provider, SubjectParser<T> subjectParser) Registers a provider that is capable of responding to trade confirmation requests.void
Deprecated.void
removeUserSessionListener
(UserSessionListener listener) Removes a listener UserSessionListener to stop receiving session events.Methods inherited from class com.caplin.motif.datasource.CachedAdapter
createCachedPublisher, createCachedPublisher
-
Constructor Details
-
FXTradeAdapter
Constructs an FXTradeAdapter that will utilise the specified DataSource and its configuration for communication with the motif.Uses a default
ThreadMode
ofThreadMode.SharedThreads
- Parameters:
dataSource
- The DataSource that will be used to receive requests for ESP and RFS trades.- Throws:
IOException
- If an error occurred reading configuration files for the adapter.
-
FXTradeAdapter
public FXTradeAdapter(com.caplin.datasource.DataSource dataSource, ThreadMode threadMode) throws IOException Constructs an FXTradeAdapter 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 and RFS trades.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.
-
FXTradeAdapter
public FXTradeAdapter(com.caplin.datasource.DataSource dataSource, ThreadMode threadMode, Properties properties) throws IOException Constructs an FXTradeAdapter 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 and RFS trades.threadMode
- The thread mode to use for trades being made through the Adapter.properties
- The properties file to use when creating theTradingProvider
- Throws:
IOException
- If an error occurred reading configuration files for the adapter.
-
FXTradeAdapter
Constructs an FXTradeAdapter 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
Adds a listener that will be notified whenever a user session is created and closed. Note that you can add multipleUserSessionListener
s- Parameters:
listener
- the listener to be notified of session lifecycle events.
-
removeUserSessionListener
Removes a listener UserSessionListener to stop receiving session events.- Parameters:
listener
- the listener to be removed from receiving session lifecycle events.
-
registerESPTradeListenerFactory
Registers a factory that will listen to ESP Trade workflows initiated from the client.- Parameters:
factory
- the factory that will be asked to create the ESPTradeListener
-
registerRFSTradeListenerFactory
Registers a factory that will listen to RFS Trade workflows initiated from the client.- Parameters:
factory
- the factory that will be asked to create the RFSTradeListener
-
registerSettlementTradeListenerFactory
Registers a factory that will listen to Settlement Trade workflows initiated from the client.- Parameters:
factory
- the factory that will be asked to create the SettlementTradeListener
-
registerSettlementInstructionListenerFactory
public void registerSettlementInstructionListenerFactory(SettlementInstructionTradeListenerFactory factory) Registers a factory that will listen to Settlement Instruction workflows initiated from the client.- Parameters:
factory
- the factory that will be asked to create the SettlementInstructionTradeListener
-
registerValidationTradeListenerFactory
@Deprecated public void registerValidationTradeListenerFactory(ValidateTradeListenerFactory factory) Deprecated.Registers a factory that will listen to Validation Trade workflows initiated from the client.- Parameters:
factory
- the factory that will be asked to create the ValidateTradeListener
-
registerAmendTradeListenerFactory
Registers a factory that will listen to Amend Trade workflows initiated from the client.- Parameters:
factory
- the factory that will be asked to create the AmendTradeListener
-
registerDrawdownTradeListenerFactory
Registers a factory that will listen to Drawdown Trade workflows initiated from the client.- Parameters:
factory
- the factory that will be asked to create the DrawdownTradeListener
-
registerAllocateTradeListenerFactory
Registers a factory that will listen to Allocate Trade workflows initiated from the client.- Parameters:
factory
- the factory that will be asked to create the AllocateTradeListener
-
registerCancelTradeListenerFactory
Registers a factory that will listen to Cancel Trade workflows initiated from the client.- Parameters:
factory
- the factory that will be asked to create the CancelTradeListener
-
registerSalesInterventionTradeListenerFactory
public void registerSalesInterventionTradeListenerFactory(SalesInterventionTradeListenerFactory factory) Registers a factory that will listen to SalesIntervention Trade workflows initiated from the client.- Parameters:
factory
- the factory that will be asked to create the SalesInterventionTradeListener
-
registerBlockTradeListenerFactory
Deprecated.The 'BLOCK' TradingProtocol will be removed, Block Trading should now be handled via the standard RFSListener.Registers a factory that will listen to Block Trade workflows initiated from the client.- Parameters:
factory
- the factory that will be asked to create the BlockTradeListener
-
registerBlockTradeListenerFactory
@Deprecated public void registerBlockTradeListenerFactory(BlockTradeListenerFactory factory, TradeValidator tradeFieldsValidator) Deprecated.The 'BLOCK' TradingProtocol will be removed, Block Trading should now be handled via the standard RFSListener.Registers a factory that will listen to Block Trade workflows initiated from the client.- Parameters:
factory
- the factory that will be asked to create the BlockTradeListenertradeFieldsValidator
- The validator that will be used to validate the incoming client message.
-
registerBlockTradeListenerFactory
Deprecated.The 'BLOCK' TradingProtocol will be removed, Block Trading should now be handled via the standard RFSListener.Registers a factory that will listen to Block Trade workflows initiated from the client.- Parameters:
factory
- the factory that will be asked to create the BlockTradeListener
-
registerSalesTradeConfirmationProvider
public void registerSalesTradeConfirmationProvider(CachedMessageProvider<TradeSubjectInfo> provider) Registers a provider that is capable of responding to Sales trade confirmation requests.- Parameters:
provider
- the CachedMessageProvider that will receive the Sales trade confirmation requests
-
registerTradeConfirmationProvider
Registers a provider that is capable of responding to trade confirmation requests.- Parameters:
provider
- the CachedMessageProvider that will receive the trade confirmation requests
-
registerTradeConfirmationProvider
public void registerTradeConfirmationProvider(String namespace, CachedMessageProvider<TradeSubjectInfo> provider) Registers a provider that is capable of responding to trade confirmation requests.- Parameters:
namespace
- the namespace to register the provider on, defaults are defined inTradeSubjectNamespacing.DefaultNamespaces
provider
- the CachedMessageProvider that will receive the trade confirmation requests
-
registerTradeConfirmationProvider
public <T extends TradeSubjectInfo> void registerTradeConfirmationProvider(String namespace, CachedMessageProvider<T> provider, SubjectParser<T> subjectParser) Registers a provider that is capable of responding to trade confirmation requests.- Parameters:
namespace
- the namespace to register the provider on, defaults are defined inTradeSubjectNamespacing.DefaultNamespaces
provider
- the CachedMessageProvider that will receive the trade confirmation requestssubjectParser
- the parser that will parse trade confirmation requests into an object representation of the request
-
registerTradeConfirmationProvider
public <T extends TradeSubjectInfo> void registerTradeConfirmationProvider(com.caplin.datasource.namespace.Namespace namespace, CachedMessageProvider<T> provider, SubjectParser<T> subjectParser) Registers a provider that is capable of responding to trade confirmation requests.- Parameters:
namespace
- the namespace to register the provider on, defaults are defined inTradeSubjectNamespacing.DefaultNamespaces
provider
- the CachedMessageProvider that will receive the trade confirmation requestssubjectParser
- the parser that will parse trade confirmation requests into an object representation of the request
-
registerPostTradeHistoryProvider
public <T extends TradeSubjectInfo> void registerPostTradeHistoryProvider(CachedObjectProvider<PostTradeHistory, TradeSubjectInfo> provider) Registers a provider that is capable of responding to post trade history requests.- Parameters:
provider
- the CachingDataProvider that will receive the post trade history requests
-
registerSalesPostTradeHistoryProvider
public <T extends TradeSubjectInfo> void registerSalesPostTradeHistoryProvider(CachedObjectProvider<PostTradeHistory, TradeSubjectInfo> provider) Registers a provider that is capable of responding to sales post trade history requests.- Parameters:
provider
- the CachingDataProvider that will receive the post trade history requests
-