Package com.caplin.motif.fx.trading
Class FXTradeAdapter
- java.lang.Object
-
- com.caplin.motif.datasource.CachedAdapter
-
- com.caplin.motif.fx.trading.FXTradeAdapter
-
public class FXTradeAdapter extends CachedAdapter
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
Constructors Constructor Description FXTradeAdapter(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, java.util.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
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addUserSessionListener(UserSessionListener listener)
Adds a listener that will be notified whenever a user session is created and closed.void
registerAllocateTradeListenerFactory(AllocateTradeListenerFactory factory)
Registers a factory that will listen to Allocate Trade workflows initiated from the client.void
registerAmendTradeListenerFactory(AmendTradeListenerFactory factory)
Registers a factory that will listen to Amend Trade workflows initiated from the client.void
registerBlockTradeListenerFactory(RFSTradeListenerFactory factory)
Deprecated.The 'BLOCK' TradingProtocol will be removed, Block Trading should now be handled via the standard RFSListener.void
registerBlockTradeListenerFactory(BlockTradeListenerFactory factory)
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
registerCancelTradeListenerFactory(CancelTradeListenerFactory factory)
Registers a factory that will listen to Cancel Trade workflows initiated from the client.void
registerCommoditiesTradeConfirmationProvider(CachedMessageProvider<TradeSubjectInfo> provider)
Registers a provider that is capable of responding to Commodities trade confirmation requests.void
registerDrawdownTradeListenerFactory(DrawdownTradeListenerFactory factory)
Registers a factory that will listen to Drawdown Trade workflows initiated from the client.void
registerESPTradeListenerFactory(ESPTradeListenerFactory factory)
Registers a factory that will listen to ESP Trade workflows initiated from the client.<T extends TradeSubjectInfo>
voidregisterPostTradeHistoryProvider(CachedObjectProvider<PostTradeHistory,TradeSubjectInfo> provider)
Registers a provider that is capable of responding to post trade history requests.void
registerRFSTradeListenerFactory(RFSTradeListenerFactory factory)
Registers a factory that will listen to RFS Trade workflows initiated from the client.void
registerSalesInterventionTradeListenerFactory(SalesInterventionTradeListenerFactory factory)
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
registerSalesTradeConfirmationProvider(CachedMessageProvider<TradeSubjectInfo> provider)
Registers a provider that is capable of responding to Sales trade confirmation requests.void
registerSettlementInstructionListenerFactory(SettlementInstructionTradeListenerFactory factory)
Registers a factory that will listen to Settlement Instruction workflows initiated from the client.void
registerSettlementTradeListenerFactory(SettlementTradeListenerFactory factory)
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
registerTradeConfirmationProvider(CachedMessageProvider<TradeSubjectInfo> provider)
Registers a provider that is capable of responding to trade confirmation requests.void
registerTradeConfirmationProvider(java.lang.String namespace, CachedMessageProvider<TradeSubjectInfo> provider)
Registers a provider that is capable of responding to trade confirmation requests.<T extends TradeSubjectInfo>
voidregisterTradeConfirmationProvider(java.lang.String namespace, CachedMessageProvider<T> provider, SubjectParser<T> subjectParser)
Registers a provider that is capable of responding to trade confirmation requests.void
registerValidationTradeListenerFactory(ValidateTradeListenerFactory factory)
Registers a factory that will listen to Validation Trade workflows initiated from the client.void
removeUserSessionListener(UserSessionListener listener)
Removes a listener UserSessionListener to stop receiving session events.-
Methods inherited from class com.caplin.motif.datasource.CachedAdapter
clearCache, createActivePublisher, createActivePublisher, createCachedPublisher, createCachedPublisher, createCachedPublisher, createCachedPublisher
-
-
-
-
Constructor Detail
-
FXTradeAdapter
public FXTradeAdapter(com.caplin.datasource.DataSource dataSource) throws java.io.IOException
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:
java.io.IOException
- If an error occurred reading configuration files for the adapter.
-
FXTradeAdapter
public FXTradeAdapter(com.caplin.datasource.DataSource dataSource, ThreadMode threadMode) throws java.io.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:
java.io.IOException
- If an error occurred reading configuration files for the adapter.
-
FXTradeAdapter
public FXTradeAdapter(com.caplin.datasource.DataSource dataSource, ThreadMode threadMode, java.util.Properties properties) throws java.io.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:
java.io.IOException
- If an error occurred reading configuration files for the adapter.
-
FXTradeAdapter
public FXTradeAdapter(TradeAdapter tradeAdapter)
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 Detail
-
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 multipleUserSessionListener
s- 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.
-
registerESPTradeListenerFactory
public void registerESPTradeListenerFactory(ESPTradeListenerFactory factory)
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
public void registerRFSTradeListenerFactory(RFSTradeListenerFactory factory)
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
public void registerSettlementTradeListenerFactory(SettlementTradeListenerFactory factory)
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
public void registerValidationTradeListenerFactory(ValidateTradeListenerFactory factory)
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
public void registerAmendTradeListenerFactory(AmendTradeListenerFactory factory)
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
public void registerDrawdownTradeListenerFactory(DrawdownTradeListenerFactory factory)
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
@Beta public void registerAllocateTradeListenerFactory(AllocateTradeListenerFactory factory)
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
public void registerCancelTradeListenerFactory(CancelTradeListenerFactory factory)
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 public void registerBlockTradeListenerFactory(BlockTradeListenerFactory factory)
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 public void registerBlockTradeListenerFactory(RFSTradeListenerFactory factory)
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
-
registerCommoditiesTradeConfirmationProvider
public void registerCommoditiesTradeConfirmationProvider(CachedMessageProvider<TradeSubjectInfo> provider)
Registers a provider that is capable of responding to Commodities trade confirmation requests.- Parameters:
provider
- the CachedMessageProvider that will receive the Commodities trade confirmation requests
-
registerTradeConfirmationProvider
public void registerTradeConfirmationProvider(CachedMessageProvider<TradeSubjectInfo> provider)
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(java.lang.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(java.lang.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
-
-