public class FXOrdersAdapter extends Object
An FXOrdersAdpater services trading capabilities for Limit Orders. This includes single leg orders, as well as if-done, oco and if-done-oco multi-leg order types.
Typically, an FXOrdersAdapter will be set up as follows:
FXOrdersAdapter adapter = new FXOrdersAdapter(dataSource); adapter.registerSubmissionListenerFactory(StrategyType.SINGLE.getName(), new MySingleOrderListenerFactory()); adapter.registerSubmissionListenerFactory(StrategyType.IF_DONE.getName(), new MyIfDoneOrderListenerFactory()); adapter.registerSubmissionListenerFactory(StrategyType.OCO.getName(), new MyOCOOrderListenerFactory()); adapter.registerSubmissionListenerFactory(StrategyType.IF_DONE_OCO.getName(), new MyIfDoneOCOOrderListenerFactory());
Constructor and Description |
---|
FXOrdersAdapter(com.caplin.datasource.DataSource dataSource)
Constructs an FXOrdersAdapter that will utilise the specified
DataSource and its configuration for communication with the motif.
|
FXOrdersAdapter(TradeAdapter tradeAdapter)
Constructs the FXOrdersAdapter 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 is notified whenever a user session is created and closed.
|
void |
registerBulkOrderActionListenerFactory(BulkOrderActionTradeListenerFactory factory)
Registers a factory that will be asked to create the BulkOrderActionTradeListener
which will listen to bulk order action workflows initiated by the client.
|
void |
registerCancelationListenerFactory(OrderCancelationListenerFactory factory)
Registers a factory that will be asked to create the OrderCancelationFactory
which will listen to order cancelation workflows initiated by the client.
|
void |
registerChangeActiveStateListenerFactory(OrderChangeActiveStateListenerFactory factory)
Registers a factory that will be asked to create the OrderChangeActiveStateListener
which will listen to order activation workflows initiated by the client.
|
void |
registerEditStrategyListenerFactory(EditStrategyListenerFactory factory)
Registers a factory that will be asked to create the
EditStrategyListenerFactory
which will listen to Edit Strategy requests from the client. |
void |
registerOrderSubmissionValidator(String strategyType,
OrderSubmissionValidator validator)
Takes the strategy type as well as the validator; so for a particular strategy (e.g OCO)
the validation can be overridden.
|
void |
registerStrategyDetailsRequestListenerFactory(StrategyDetailsRequestListenerFactory factory)
Registers a factory that will be asked to create the
StrategyDetailsRequestListenerFactory
which will listen to strategy detail requests from the client. |
void |
registerStrategyDetailsRequestListenerFactory(StrategyDetailsRequestListenerFactory factory,
com.caplin.datasource.namespace.Namespace namespace,
SubjectParser<? extends StrategySubjectInfo> subjectParser)
Registers a factory and your own parser implementation that will be asked to create the
StrategyDetailsRequestListenerFactory
which will listen to strategy detail requests from the client. |
void |
registerStrategyDetailsRequestListenerFactory(StrategyDetailsRequestListenerFactory factory,
SubjectParser<? extends StrategySubjectInfo> subjectParser)
Deprecated.
This requires the library to use the deprecated method
SubjectParser.getSubjectRegex() and is therefore
scheduled for removal. Use registerStrategyDetailsRequestListenerFactory(StrategyDetailsRequestListenerFactory, Namespace, SubjectParser)
intead. |
void |
registerSubmissionListenerFactory(OrderSubmissionListenerFactory<MotifOrderStrategy> listenerFactory)
Registers a factory that will listen to Limit Order submission workflows
initiated from the client.
|
void |
registerSubmissionListenerFactory(String strategyType,
OrderSubmissionListenerFactory<? extends MotifOrderStrategy> listenerFactory)
Registers a factory that will listen to Limit Order submission workflows
initiated from the client for the strategy type specified.
|
void |
registerSubmissionListenerFactory(String strategyType,
OrderSubmissionListenerFactory<? extends OrderStrategy> listenerFactory,
OrderStrategyFactory<? extends OrderStrategy> strategyFactory)
Registers a factory that will listen to the Limit Order submission workflows
initiated from the client for the strategy type specified.
|
void |
removeUserSessionListener(UserSessionListener listener)
Removes a listener UserSessionListener to stop receiving session events.
|
public FXOrdersAdapter(com.caplin.datasource.DataSource dataSource) throws IOException
Constructs an FXOrdersAdapter that will utilise the specified DataSource and its configuration for communication with the motif.
dataSource
- The DataSource that will be used to receive requests
for Limit Orders.IOException
- If an error occured when reading the configuration
files for the adapter.public FXOrdersAdapter(TradeAdapter tradeAdapter)
Constructs the FXOrdersAdapter that will utilise the specified TradeAdapter and its configuration for communication with the motif.
Prefer this constructor if you will be implementing post allocations,
pass the FXPostAllocationAdapter
the same instance of
TradeAdapter
tradeAdapter
- The Tradepublic void addUserSessionListener(UserSessionListener listener)
listener
- the listener to be notified of session lifecycle events.public void removeUserSessionListener(UserSessionListener listener)
listener
- the listener to be removed from receiving session lifecycle events.public void registerSubmissionListenerFactory(OrderSubmissionListenerFactory<MotifOrderStrategy> listenerFactory)
listenerFactory
- The factory that will be asked to create the OrderSubmissionListenerpublic void registerSubmissionListenerFactory(String strategyType, OrderSubmissionListenerFactory<? extends MotifOrderStrategy> listenerFactory)
strategyType
- The strategy type that the factory will be associated with, see StrategyType
for default valueslistenerFactory
- The factory that will be asked to create the OrderSubmissionListenerpublic void registerSubmissionListenerFactory(String strategyType, OrderSubmissionListenerFactory<? extends OrderStrategy> listenerFactory, OrderStrategyFactory<? extends OrderStrategy> strategyFactory)
registerOrderSubmissionValidator
strategyType
- the The strategy type that the factories will be associated with, see StrategyType
for default valueslistenerFactory
- The factory that will be asked to create the OrderSubmissionListenerstrategyFactory
- The factory that will be asked to create the OrderStrategypublic void registerOrderSubmissionValidator(String strategyType, OrderSubmissionValidator validator)
strategyType
- The strategy type for which the validator will be asked to validatevalidator
- The validator which will validate an OrderStrategypublic void registerCancelationListenerFactory(OrderCancelationListenerFactory factory)
factory
- The factory that will be asked to create the OrderCancelationListenerpublic void registerChangeActiveStateListenerFactory(OrderChangeActiveStateListenerFactory factory)
factory
- The factory that will be asked to create the OrderChangeActiveStateListenerpublic void registerBulkOrderActionListenerFactory(BulkOrderActionTradeListenerFactory factory)
factory
- The factory that will be asked to create the BulkOrderActionTradeListener@Deprecated public void registerStrategyDetailsRequestListenerFactory(StrategyDetailsRequestListenerFactory factory, SubjectParser<? extends StrategySubjectInfo> subjectParser)
SubjectParser.getSubjectRegex()
and is therefore
scheduled for removal. Use registerStrategyDetailsRequestListenerFactory(StrategyDetailsRequestListenerFactory, Namespace, SubjectParser)
intead.StrategyDetailsRequestListenerFactory
which will listen to strategy detail requests from the client.factory
- The factory that will be asked to create the StrategyDetailsRequestListener
instances.subjectParser
- The parser that will be used SubjectParser
public void registerStrategyDetailsRequestListenerFactory(StrategyDetailsRequestListenerFactory factory, com.caplin.datasource.namespace.Namespace namespace, SubjectParser<? extends StrategySubjectInfo> subjectParser)
StrategyDetailsRequestListenerFactory
which will listen to strategy detail requests from the client.factory
- The factory that will be asked to create the StrategyDetailsRequestListener
instances.namespace
- A namespace representing the subject pattern that this StrategyDetailsRequestListenerFactory
will handle requests for.subjectParser
- The parser that will be used to convert subjects required by the front end into instances of the domain
object StrategySubjectInfo
.public void registerStrategyDetailsRequestListenerFactory(StrategyDetailsRequestListenerFactory factory)
StrategyDetailsRequestListenerFactory
which will listen to strategy detail requests from the client.factory
- The factory that will be asked to create the StrategyDetailsRequestListenerFactory
public void registerEditStrategyListenerFactory(EditStrategyListenerFactory factory)
EditStrategyListenerFactory
which will listen to Edit Strategy requests from the client.factory
- The factory that will be asked to create the EditStrategyListener
Copyright © 2015 Caplin Systems.