AlgoTraderAlgoTrader Documentation

Chapter 13. Client

13.1. HTML5
13.1.1. Header
13.1.2. Order Table
13.1.3. Transaction Table
13.1.4. Positions Table
13.1.5. Market Data Table
13.1.6. Column Selection and Grouping
13.1.7. Chart Widget
13.1.8. Technologies
13.2. JMX Client
13.2.1. Starting the AlgoTraderClient
13.2.2. AlgoTrader Managed Beans
13.2.3. Charts
13.2.4. JMX Access
13.2.5. Monitoring Functionality
13.2.6. Additional MBeans
13.2.7. JConsole Modification
13.3. Eclipse Client
13.3.1. AlgoTrader Perspective
13.3.2. Strategy Wizard
13.3.3. AlgoTrader Configuration Editor
13.3.4. Esper Colorer
13.4. EsperHQ Client (optional)
13.4.1. Installation
13.4.2. Dialogs
13.5. Reference Data Manager

AlgoTrader provides different types of clients all of which are targeting a different audience and use case:

As of version 3.0, AlgoTrader provides the new HTML 5 based frontend including an array of new features.

When AlgoTrader server starts, it automatically opens the client.

To manually open the client, point your browser to one of the following URL.


Alternatively the client can be configured to use a secure connection by setting the following property within

security.ssl = true

This will make the client available over a secure connection via:


The JMX Client uses Java Management Extension (JMX) and the generic Java Client JConsole.

When starting up the AlgoTraderClient there will be one window per JVM. The JConsole also provides management functionality for many technical aspects of the JVM (e.g. Threads, Classes & Memory) see the Java Documentation for details.

The business related features of AlgoTrader are available on the Tab Services through the ServerManagementService and the ManagementService under ch.algotrader.service. To open any of the detail sections (e.g. Orders, Positions or Transactions) double click on the bold section of the display.

Services tagged with @ManagedResource are automatically exposed through JMX by means of the org.springframework.jmx.export.annotation.AnnotationMBeanExporter.

The following AlgoTrader Services are exposed as Managed Beans

The Management Service is available for every strategy and for the AlgoTrader Server itself. It provides the Attributes and Operations that are strategy specific.

In addition the Management Service provides the following Operations

All methods that have a security parameter accept the following choices to define a security:

  • securityId (e.g. 123)

  • symbol (e.g. GOOG)

  • isin, prefix with "isin:", (e.g. "isin:EU0009654078")

  • bbgid, prefix with "bbgid:", (e.g. "bbgid:BBG005NHP5P9")

  • ric, prefix with "ric:", (e.g. "ric:.SPX")

  • conid, prefix with "conid:", (e.g. "conid:12087817")

Every strategy will display a custom JConsole Tab with a Portfolio Chart. Strategies can configure additional Tabs with Custom Charts.

Charts are based on JFreeChart and Orson.

Each chart provides several Operations which are available through the context menu (i.e. right mouse click):

  • Copy / Save as / Print

  • Zoom In / Zoom Out / Autorange

  • Reset Chart: will reload the entire Chart Data and reset all settings

  • Update Chart Data: will contact the corresponding ChartService for any new ChartData that is not already displayed

  • Enable / Disable individual time series

The following images show some examples of Custom Charts:

Custom Charts need to be configured inside the file applicationContext-client-<strategyName>.xml. A typical configuration looks like this:

<bean id="xyzChartService"
  class="" autowire="byName">
  <property name="chartDefinition">
    <bean class="ch.algotrader.vo.ChartDefinitionVO" p:timePeriod="SEC" >
      <property name="axisDefinitions">
          <bean class="ch.algotrader.vo.AxisDefinitionVO" p:autoRange="true"
            p:autoRangeIncludesZero="false" p:numberFormat="##0.00000">
            <property name="datasetDefinitions">
                <bean class="ch.algotrader.vo.DatasetDefinitionVO" p:type="TIME">
                  <property name="seriesDefinitions">
                      <bean class="ch.algotrader.vo.IndicatorDefinitionVO"
                        p:name="currentValue" p:label="Current Value" p:selected="true" />
                      <bean class="ch.algotrader.vo.MarkerDefinitionVO"
                        p:name="upperTarget" p:label="Upper Target" p:selected="true"/>
                      <bean class="ch.algotrader.vo.MarkerDefinitionVO"
                        p:name="upperBuffer" p:label="Upper Buffer" p:selected="true"/>
                      <bean class="ch.algotrader.vo.MarkerDefinitionVO"
                        p:name="box" p:label="Box" p:selected="true"p:interval="true"/>
                      <bean class="ch.algotrader.vo.MarkerDefinitionVO"
                        p:name="lowerBuffer" p:label="Lower Buffer" p:selected="true"/>
                      <bean class="ch.algotrader.vo.MarkerDefinitionVO"
                        p:name="lowerTarget" p:label="Lower Target" p:selected="true"/>

The following class diagram and table show all possible definition options for Custom Chart configuration:

A Custom Chart is wired to a corresponding ChartService (a subclass of ChartProvidingServiceImpl) which will provide the Chart with the actual ChartData to display. The following class diagram show a summary of all ChartData Value Objects.

A ChartProvidingService can optionally overwrite any of the following methods to provide ChartData. Most of these methods contain a dateTime parameter. The Chart will pass the latest Date, that is currently displayed on the Chart. Through this, a ChartService can choose to return only ChartData that is not yet displayed on a Chart. Clicking ResetChart will sent a dateTime of zero and therefore request a full update of all ChartData.

A ChartService has to be exposed via JMX so that the client can retrieve current chart data. This is done by annotating the ChartService like this:

@ManagedResource(objectName = ",type=chart")

Because of the type=chart this Service will not be visible as a ManagedBean in the client.

A typical ChartService might look like this:


@ManagedResource(objectName = ",type=chart")
public class MovChartService extends ChartProvidingServiceImpl {
  private Engine engine;
  public Collection<IndicatorVO> getIndicators(long startDateTime) {
    List<MarketDataEventVO> marketDataEvents = engine.executeQuery(
      "select * from CurrentValueWindow where dateTime.toMillisec() > " + startDateTime);
    Set<IndicatorVO> set = new HashSet<IndicatorVO>();
    for (MarketDataEventVO marketDataEvent : marketDataEvents) {
      set.add(new IndicatorVO("currentValue", marketDataEvent.getDateTime(),
    return set;
  public Collection<MarkerVO> getMarkers() {
    Double target = (Double) engine.getVariableValue("target");
    return Collections.singleton(new ValueMarkerVO("target", target))
  public String getDescription() {
    Double stop = (Double) engine.getVariableValue("stop");
    return String.valueOf(stop);

To enable JMX over SSL for secure remote access the following VM arguments have to be used.


When accessing the system through a firewall, the two ports 1099 and 1098 have to be opened.

When starting JConsole connect to <externalServerURL>:1099 with the following VM-Arguments pointing to the same keystore and truststore (as well as passwords) used on the server:

The AlgoTrader Eclipse Client provides a perspective (AlgoTrader perspective) which is ideal for quantitative / none technical users of AlgoTrader as it hides all code related artifacts.In addition the AlgoTrader Eclipse Client contains the Strategy Wizard and the AlgoTrader Configurtion Editor.

See section Section 2.1, “Development Environment Installation” for instructions on how to install the AlgoTrader Eclipse Client.

Quantitative users can use this perspective to modify configurations of the system and trading strategies and to start the system with different configurations. Code artifacts (java classes, config files etc.) are not visible in this perspective. However all log-files and reports are shown.

The perspective only shows AlgoTrader projects, i.e. projects that have the AlgoTrader nature (ch.algotrader.quant.ui.algotradernature) defined inside the .project file:

<?xml version="1.0" encoding="UTF-8"?>

It offers the following main capabilities:

The AlgoTrader Configuration Editor provides an editor for AlgoTrader configuration files. For more information on the AlgoTrader configuration functionality please see: Chapter 28, Configuration and Preferences API and Section 5.4, “Strategy Groups”.

To open the AlgoTrader Configuration Editor, right click on an AlgoTrader project, then click the menu item AlgoTrader/Configuration. The AlgoTrader/Configuration menu will only be available if a file with the name applicationContext-client-xxx.xml exists in the project classpath. If that file does not exits, the menu item will be disabled and the editor cannot be opened.

Furthermore, the AlgoTrader Configuration Editor behaves differently depending on the content of the applicationContext-client-xxx.xml file. If the configuration file contains strategy group definitions according to Section 5.4, “Strategy Groups” the editor will show three tabs.

The tab Strategy Group allows modification of strategy group definitions.

The image above shows a strategy group configuration file opened in the AlgoTrader Configuration Editor.

On the left hand side of the Strategy Group Tab all availabe configurations are list and grouped by their ConfigClass (e.g. Box for

The buttons "New" and "Edit" (1) can be used to add and modify individual configuration items.

The "New" and "Edit" dialog contains the following elements (for details visit: Section 5.4, “Strategy Groups”):

  • Name: the name of the .properties file

  • ConfigClass: the name of the ConfigBean (see: Section 28.4, “Config Beans”) linked to the .properties file

  • ServiceTemplate: The Spring ServiceTemplate to use

  • EngineTemplate: The Spring EsperTemplate to use

  • Engine Name: The name of the Esper Engine (not editable)

In addition it is possible to rename, duplicate and delete individual items (2). When selecting a configuration the corresponding .properties file will open in the lower part of the Strategy Group Tab (4)

On the right hand side of the Strategy Group Tab individual configurations can be added (5) to different strategy groups where they can be back tested in parallel. Items from the left hand side can be added to multiple groups on the right hand side. When adding an item to a strategy group an allocation weight has to be assigned. When adding multiple items to a strategy group the total weight of the strategy group must be 100%.

The right hand side of the Stratetgy Group Tab contains buttons to "Create", "Edit", "Rename" and "Delete" strategy groups (3). The button "Run" will start a backtest of the selected strategy group (see Section, “Starting Back Tests”)

Both lists in the Strategy Group Tab have allow moving (6), collapsing/expanding (7), sorting (8) and full text filtering (9) of items. Also there is a function to filter by selected strategy item (10). In addition it is possible to change the orientation betwen horizontal and vertical (11).

The tab Properties shows a list of all .properties file in the classpath which can be edited here

When a property file is selected, the content of that file is shown in a table viewer. The table viewer has two columns: key and value.

The AlgoTrader Configuration Editor supports inplace editing of cells under value column.

In addition to the standard key=value pairs, the AlgoTrader Configuration Editor interprets special comments. These comments provide the AlgoTrader Configuration Editor with the information needed to display the key=value data (i.e. the type of data, the widget class it should use for an inplace editor etc.).


#{"type":"String","label":"Last name:"}
lastName = Mustermann

#{"type":"String","label":"First name:"}
surName = Joe

#{"type":"Date","required":"false","label":"Date of birth:"}
dateOfBirth = 1980-01-01    

The AlgoTrader Configuration Editor remembers association of each key=value pair with it's special comment. When the editor saves properties back to the .properties, all key=value pairs are written with their special comments.

Each special comment is essentially a JSON object with three attributes: type, required and label. All three attributes are optional.

The AlgoTrader Configuration Editor also supports separators/subtitles. To add a separator, a special comment needs to be defined in the Source tab as follows:

#{"type":"String","label":"Strategy Name"}


#{"type":"Integer","label":"Maximum Units"}

#{"type":"Integer","label":"Box Length (in Minutes)"}

#{"type":"Separator", "label":"Time Settings"}

#{"type":"Integer","label":"Last Day of Trading (6=Friday)"}

#{"type":"Integer","label":"Latest Hour on last Day to enter a new position"}

#{"type":"Integer","label":"Hour on last Day to terminate the series"}

The content of this properties file will be rendered in the Properties tab as follows:

As described in the Section 13.3.1, “AlgoTrader Perspective” section, it is possible to start a back test of a strategy by right clicking on the strategy and selecting AlgoTrader/Run Strategy (this option is only available for strategies that are not using strategy groups).

Back Tests can also be started from within the AlgoTrader Configuration Editor:

  • For strategies without strategy group definitions there is only one possible configuration that can be back tested. To start a back test please click the "Run" button at the top of the Properties tab.

  • For strategies with strategy group definitions multiple configurations exist which can be back tested separately. To start a back test please select the desired strategy group on the right hand side of the Strategy Group Tab and click the "Run" button.

AlgoTrader provides a custom Esper EPL Syntax Highlighter based on the Colorer Library.

Together with the Eclipse Colorer Plugin it provides the following features:

  • Automatic Code Outlining

  • Pairs/Brace Matching

  • Automatic Code Folding

  • Present different colors for:

    • Reserved Keywords

    • Symbols

    • Comments

    • Literals

    • Numbers


The Syntax Highlighter does not provide Code Completion or Syntax Checking!

The EsperHQ Client is comprised of a rich multi-window GUI, the Esper data distribution service and real-time data displays (Eventlets).

The EsperHQ multi-window user interface allows to manage Esper CEP engines, design and deploy Esper Statements as well as create and launch eventlets. In addition it has built-in displays include chart, grid, gauge and timeline.

EsperHQ connects to Esper CEP engine instances via an integrated web application server (Jetty) and Esper Data Distribution Service endpoints.

Esper Eventlets are configurable, interactive and easy to compose into a dashboard and present historical and event stream data from multiple distributable sources.

EsperHQ is built on Adobe (R) Flex technology. The applications comprise of Flex modules and libraries that are cached or dynamically obtained by client web browsers from the web application server as needed.

The following Dialogs are presented by the EsperHQ Client

Create Statement Dialog

This quick-entry screen for creating a new, started statement allows entering a statement name, an optional description and an EPL expression.

The checkbox for pattern can be used to create an EPL pattern statement (a statement utilizing only the EPL pattern language).

Design Statement Dialog

This dialog allows creating new statements and editing existing statements.

On the left side of the screen the dialog presents the forms to add, modify or remove parts of the statement. The right side of the screen shows the EPL statement text up-to-date with the changes made in forms. The synchronization between forms and EPL statement occurs when pressing enter on a form item.

The Templates button brings up a dialog to choose a statement template.

The Existing button can be used to select an existing statement for editing.

Use Compile to validate the statement considering syntax but not considering whether required event types, variables or named windows exist.

Use Create to create a started EPL statement.

Map Statements Dialog

The screen presents a graphical overview of the statements including event types and their dependency as depicted by arrows.

Select the statements to be included by means of the Get All button to include all statements or the Criteria button to select a subset of statements.

Event Types Dialog

The event type dialog shows all registered event types and, for each type, the associated type detail.

The filter textbox and button is for quick finding of an event type.

For each event type the grid also shows where the event type originates from (named window, application-configured or inserted-into stream), the properties available, the statements referring to that type and the event type's super-types, if any.

By selecting an event type in the grid, the client populates the type properties list, the type detail and the referring statements table.

Named Windows Dialog

The named window dialog lists all named windows including the statement name and EPL for creation of the named window.

The filter textbox and button is for quick finding of a named window.

On-Demand Query Dialog

You may enter a fire-and-forget, one-time executed query against a named window into the query dialog box and execute the query. The client displays query results in a table.

Statements Dialog

Use Get All to retrieve a list of all statement. Use Search to search for statements according to current statement criteria filter expression. Use the Criteria dialog to compose an expression that selects only those statements matching the selected criteria.

The Quick Filter serves to reduce the list of returned statement to those matching the entered text in statement name or EPL.

Statement Dialog

The statement dialog shows statement detail including statement name, description, EPL expression and properties of the statement output.

Via Start (displayed if a statement is not already started), Stop (displayed if a statement is not already stopped) and Destroy a statement can be started, stopped or destroyed.

Use Iterate to return current iteration results for a statement.

Use Instant Live Capture to display an appended grid with real-time results for the statement.

Use Save Live Capture to save an eventlet configured to show an appended grid with real-time results for the statement.

Statement Iteration Result Dialog

After you selected a statement for iteration, the Refresh button refreshes iteration results, which are displayed as a table.

Variables Dialog

The variable list displays all variables and their current values. Select a variable, enter a new value and use Apply to set a new variable value.

The filter textbox and button is for quick finding of a variable.

There are a few other dialogs presented by the EsperHQ clients. However these are not used by AlgoTrader:

Additional Documentation on the EsperHQ client is available open request.

The Reference Data Manager allows manipulations (create, modify any delete) of Reference Data inside the AlgoTrader Database.

The Grails Client is located in the Project algotrader/crud.

The running application will look like this

Currently Refrence Data Management operations are available for the following entities:

  • Security

    • Bond

    • Combination

    • Component

    • Commodity

    • Forex

    • Future

    • Fund

    • GenericFuture

    • ImpliedVolatility

    • IntrestRate

    • Index

    • Stock

    • Option

  • SecurityFamily

    • BondFamily

    • FutureFamily

    • GenericFutureFamily

    • OptionFamily

  • Strategy

    • Allocation

    • OrderPreference

    • DefaultOrderPreference

  • Exchange

    • TradingHours

    • Holiday

  • Account

  • Property

The AlgoTrader Reference Data Manager is based on the grails project, which has a feature called scaffolding, that automatically creates a CRUD (Create, Read, Update & Delete) application based on hibernate mapping files and Java Domain classes.

To start the Reference Data Manager execute the following maven command:

mvn grails:run-app

After starting up, the Reference Data Manager can be accessed at the following URL: http://localhost:8080/crud/