Orders
Order tickets allow users to place FX orders into the market, and consist of a blade where the code is under the directory <YOURAPP>/fxexecution-bladeset/blades/orderticket
. They are implemented as a Presenter component whose main presentation model class is caplinx.fxexecution.orderticket.OrderTicket
and HTML template is <blade-home>/html/resources/OrderTicket.html.
Configuration is held in the Order ticket factory object, which is retreived from the service registry as follows:
var appService = caplin.core.ServiceRegistry.getService("caplin.config-service");
var ticketFactory = oAppService.getProperty("ORDER.TICKET.FACTORY");
The factory object is registered when the app is bootstrapped. If you want to reconfigure the Order ticket, then inside caplinx.AppConfig
replace the factory class provided with one of your own that extends caplinx.fxexecution.orderticket.config.DefaultOrderTicketConfig
.
GUI Structure
The default Order ticket showing an "If Done, OCO" is shown below:
![orders all](../../images/orders-all.png)
The ticket is split into several parts:
-
Main panel: holds the currency pair control, close icon, order strategy selector, account selector and following sub-parts.
-
Ticket body container: contains one setup panel for each leg of the order. The number of sub-panel will vary dependent on the strategy chosen.
-
Order validity panel: contains a row to define the time when the order is valid from (GFA) and another for the time it is valid to (GTC).
-
Footer: contains the notifications checkboxes and submit button.
-
Overlay: prevents user interaction while the order is being submitted.
Code Architecture
The OrderTicket
presentation model class is responsible for the overall control of the ticket. New instances of the ticket and the trade model (using the trade service) are created every time the ticket is displayed.
The caplinx.fxexecution.orderticket.OrderTicketBootstrap
class registers the caplinx.fxexecution.orderticket.trademodel.OrderTradeFactory
class with the trade service. The OrderTradeFactory
creates instances of the trade model class caplinx.fxexecution.orderticket.trademodel.OrderTrade,
and enhances it by adding a set handlers. To customise the behaviour of the trade model, you should remove existing handlers and/or add new ones. The OrderTrade
contains strategy objects that are responsible for adding and removing trade legs dependent on which order strategy is chosen.
The OrderTicket
class contains a list of PresentationNodes that are automatically generated from the legs in the trade model. These setup PresenationNode
classes are found in the directory <YOURAPP>/fxexecution-bladeset/blades/orderticket/presentation/setup
and are paired with HTML templates.
Metals
The Order Ticket can be configured to allow metals to be traded. There is a set of metals classes found under the directory <blade-home>/src/caplinx/fxexecution/orderticket/metal
. The directory includes a DefaultMetalOrderTicketConfig
class that contains the appropriate configuration to use these metal classes.
See more: