The main purpose of Empirica Algorithmic Trading Platform is to facilitate development test and execution of custom algorithmic strategies. There are several frames in TradePad that serve this purpose.
Strategy Monitor is a frame used for browsing of active and historical strategies. It comes with a set of filters to facilitate querying. It is very similar to the Orders Monitor frame.
You can invoke Strategy Monitor frame by:
- selecting inside menu Strategies\Strategy Monitor,
- using defined keyboard shortcut (default [Ctrl]+[M]),
- using the button from the Menu & Tool bar.
Strategy Monitor like Order Monitor consists of two tables: Active and Completed. Active tab shows working strategies only (including Initializing, Running, Pausing, etc. statuses). Completed tab shows historical strategies (completed, stopped by user or failed).
You can invoke contextual menu by right mouse click on selected strategy. This menu provides options to Start, Stop, Pause, Resume and check strategy details.
As in Order Monitor frame, Strategy Monitor contains filtering functionality. You can expand filters’ panel and use it to limit displayed strategies. Filtering with most strategy’s properties is possible, for example with Strategy ID, Instrument, Strategy Status etc.
User’s Strategies frame allows users to deploy Strategies JAR archives and manage strategies available in this archives.
You can invoke User’s Strategies frame by:
- selecting inside menu Strategies\User’s Strategies,
- using defined keyboard shortcut (default [Ctrl]+[U]),
- using the button from the Menu & Tool bar.
To better understand Strategies JAR archives deployment refer to the Strategy Development Guide.
In this frame you can see all your deployed archives list. You can sort them (by clicking the column header) and search through the data (context menu or [Ctrl]+[F] shortcut) to quickly find the desired archive/strategy.
In Strategies included in archive list you can see all strategies existing in archive. By right mouse click you can invoke context menu which contains few useful options:
- Open strategy frame - opens frame with selected strategy,
- Add to favorites - adds strategy to favorite strategies set,
- Show/hide full names - show or hides full class name, containing full package name as prefix,
- Find... - it helps you to find a strategy of given name and highlights the result.
User’s Strategies frame contains two buttons:
- Deploy archive... - invokes file chooser, which is used to select JAR file to deploy,
- Open strategy... - opens selected strategy.
Clicking on Show security policy link opens window with JAR import rules. Rules (provided due to safety considerations) define strategies that user can deploy into TradePad. JAR verification is based on classes and statements used in strategies’ source code. Rules specify:
- Allowed classes - classes that can be used in strategies’ source code
- Forbidden classes - classes that can not be used in strategies’ source code
- Forbidden statements - statements that can not be used in strategies’ source code
If certain class is on both forbidden and allowed list, then strategy containing that class can be deployed into TradePad.
JAR import rules are managed by system administrator.
Strategy deployment & undeployment¶
For strategy to be executed (launched), it must be deployed into TradePad. To deploy a strategy click the Deploy archive... button and select a desired JAR archive containing strategies. The Select strategy implementation file frame lists only JAR files that are below 10MB in size. Upon clicking Deploy, the archive will be deployed depending on verification result. Deployed strategies are available for use.
Sometimes it can be desired or necessary to undeploy strategy JAR archive (e.g. when renaming the JAR archive). To undeploy strategy JAR archive right click on selected archive in User’s Strategies window in Deployed jar archives table, choose Undeploy*.jar and confirm undeploying in the next window. Undeploying one JAR archive and deploying a newer one, with updated name, is the recommended way to monitor the changes between subsequent strategies’ versions.
It is unadvised to undeploy a JAR archive containing strategy that is currently running, and JAR archives containing external libraries for, or strategies subservient to, the currently running strategies. Doing so will result in a java.lang.NoClassDefFoundError when attempting to create new instances of strategies dependent on those undeployed classes.
Sample strategy JAR deployment & undeployment work-flow:
- Deploy archive 1.1.jar containing strategy A version 1.1,
- Run strategy A version 1.1,
- Develop new, better version of strategy A version 1.2,
- Save improved strategy A version 1.2 in archive 1.2.jar,
- Stop strategy A version 1.1,
- Undeploy archive 1.1.jar,
- Deploy archive 1.2.jar,
- Run strategy A version 1.2.
User’s Strategies frame keeps track of, and shows relations between custom strategies and JAR archives in which they are included.
There are two ways to add a strategy to favorites.
- Click on a star next to a strategy’s name in the Strategies included in archive list. Strategy’s name will be filled-in as a recommended button title, but user can enter his own. Upon confirming with OK, new favorite strategy button will in the Strategies menu.
- Invoke Favorite Strategies dialog by clicking on Manage favorites... button in the Strategies menu. You can add, remove, rename and reorder the buttons. Note that the changes are not immediately saved and can be safely discarded at any point.
Strategy frame common elements¶
All strategy frames share several common elements, which are used to describe the strategy’s parameters and state. About a bottom half of every frame is taken by a common tabs panel. Tabs display information about the strategy’s orders, logger, chart and statistics.
- Orders - shows two tables; Strategy Orders shows every order executed by the strategy; Strategy PnL table shows the strategy’s portfolio profit and loss,
- Statistics - shows broad range of important statistics related to the strategy execution,
- Logger - shows log entries generated by the strategy,
- Chart - on the top figure you can see a plot of prices of selected instrument over time and actions made by a strategy; on the bottom figure you can find a plot of you budget over time.
After strategy finish, you can save strategy’s results by pressing Save Results... button. Loading saved results is possible by selecting File\Open strategy result inside menu.
On the bottom left of every strategy’s frame, there is a Presets widget. It is used to save the current strategy parameters, and load them later. All you have to do is to fill the strategy’s controls with desired values,click on the little diskette, provide a preset name and confirm.
New presets are added to the drop-down list and can be selected at any time for current and future strategy parameters setup. If you want to delete an existing preset, simply select it and click on the icon with a character sheet with red cross on it. The first, blank preset is the default configuration and cannot be deleted.
Last common elements are the strategy’s control buttons on the bottom right of the frame, used to manage strategy’s state change options (Starting, Pausing, Resuming, Stopping) and strategy’s parameters modification function.
User’s custom strategy frame¶
User’s custom strategy frame is used to display the controls and information about a single instance of a strategy.
Every custom user’s strategy frame contains the same common elements listed below:
- Instruments selection widget - used to select instruments for the strategy to work with; number of instruments used in a strategy depends on the strategy’s implementation,
- Portfolio selection widget - used to select a portfolio into which the strategy’s orders will be saved. In the TradePad Demo the only one choice is “demo”,
- Generated controls panel - panel with user-defined strategy controls, related to current strategy.