public class FXTradeAdapter extends Object implements UserSessionObservable
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());
Constructor and 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(TradeAdapter tradeAdapter)
Constructs an FXTradeAdapter that will utilise the specified
TradeAdapter and its configuration for communication with the motif.
|
Modifier and Type | Method and Description |
---|---|
void |
addUserSessionListener(UserSessionListener listener)
Adds a listener that will be notified whenever a user session is
created and closed.
|
void |
registerBlockTradeListenerFactory(BlockTradeListenerFactory factory)
Registers a factory that will listen to Block Trade workflows initiated
from the client.
|
void |
registerBlockTradeListenerFactory(BlockTradeListenerFactory factory,
TradeValidator tradeFieldsValidator)
Registers a factory that will listen to Block Trade workflows initiated
from the client.
|
void |
registerESPTradeListenerFactory(ESPTradeListenerFactory factory)
Registers a factory that will listen to ESP Trade workflows initiated
from the client.
|
void |
registerESPTradeListenerFactory(ESPTradeListenerFactory factory,
TradeValidator tradeFieldsValidator)
Registers a factory that will listen to ESP Trade workflows initiated
from the client.
|
void |
registerLegacySalesRFSTradeListenerFactory(RFSTradeListenerFactory factory,
TradingSubProtocol subProtocol)
Deprecated.
registers an RFS TradeListenerFactory to the old SalesRFS Trading Protocol. To be used until Sales Motif refactors usages of SalesRFS
|
void |
registerRFSTradeListenerFactory(RFSTradeListenerFactory factory)
Registers a factory that will listen to RFS Trade workflows initiated
from the client.
|
void |
registerRFSTradeListenerFactory(RFSTradeListenerFactory factory,
TradeValidator tradeFieldsValidator)
Registers a factory that will listen to RFS Trade workflows initiated
from the client.
|
void |
removeUserSessionListener(UserSessionListener listener)
Removes a listener UserSessionListener to stop receiving session events.
|
public FXTradeAdapter(com.caplin.datasource.DataSource dataSource) throws IOException
dataSource
- The DataSource that will be used to receive requests
for ESP and RFS trades.IOException
- If an error occured reading configuration files for
the adapter.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.
tradeAdapter
- The trade adapterpublic void addUserSessionListener(UserSessionListener listener)
addUserSessionListener
in interface UserSessionObservable
listener
- the listener to be notified of session lifecycle events.public void removeUserSessionListener(UserSessionListener listener)
removeUserSessionListener
in interface UserSessionObservable
listener
- the listener to be removed from receiving session lifecycle events.public void registerESPTradeListenerFactory(ESPTradeListenerFactory factory)
factory
- the factory that will be asked to create the ESPTradeListenerpublic void registerESPTradeListenerFactory(ESPTradeListenerFactory factory, TradeValidator tradeFieldsValidator)
factory
- the factory that will be asked to create the ESPTradeListenertradeFieldsValidator
- The validator that will be used to validate the
incoming client message.public void registerRFSTradeListenerFactory(RFSTradeListenerFactory factory)
factory
- the factory that will be asked to create the RFSTradeListenerpublic void registerRFSTradeListenerFactory(RFSTradeListenerFactory factory, TradeValidator tradeFieldsValidator)
SalesRFSTradeValidator
to ensure that the client sends the sales related fields.factory
- the factory that will be asked to create the RFSTradeListenertradeFieldsValidator
- The validator that will be used to validate the incoming client message.@Deprecated public void registerLegacySalesRFSTradeListenerFactory(RFSTradeListenerFactory factory, TradingSubProtocol subProtocol)
subProtocol
- the sub protocolfactory
- the factory that will be asked to create the RFSTradeListenerpublic void registerBlockTradeListenerFactory(BlockTradeListenerFactory factory)
factory
- the factory that will be asked to create the BlockTradeListenerpublic void registerBlockTradeListenerFactory(BlockTradeListenerFactory factory, TradeValidator tradeFieldsValidator)
factory
- the factory that will be asked to create the BlockTradeListenertradeFieldsValidator
- The validator that will be used to validate the
incoming client message.Copyright © 2015 Caplin Systems.