The Strategy Engine is a client application in the Marketcetera Automated Trading Platform. The Strategy Engine is responsible for the execution of modules, particularly strategies. Strategy Engines connect to an instance of DARE, the Marketcetera order routing engine and provide a web services API for control of the running modules. Multiple Strategy Engines can run at the same time, connected to the same routing engine. By default, the Strategy Engine connects to the Marketcetera cloud DARE instance. You can use this setup to test your strategies before licensing a DARE appliance for your data center or cloud installation.
The Strategy Engine is a command-line application with no UI. The Strategy Engine is considered to be a client application in the Marketcetera Automated Trading Platform in that it needs to connect to an instance of DARE to run.
Running Strategy Engine
The Strategy Engine installs a Start Menu entry. This starts the Strategy Engine with the commands located in src/commands.txt. You can modify that file to change how the Strategy Engine starts by default. Or, you may open a cmd prompt and start the Strategy Engine directly.
The Strategy Engine can be run, as shown above, with no command-line arguments. In this state, no modules are running yet, the Strategy Engine is an empty container waiting for instruction. The Strategy Engine can be controlled via its web services interface (this is how Photon controls strategies).
Strategy Engine Command Files
You may start the Strategy Engine with a command file as a command-line argument. This tells the Strategy Engine to execute the commands in the file upon start. Sample commands are included with the Strategy Engine in the samples subdirectory.
The unit of work of the Strategy Engine is the module. Modules are discrete units of code that can participate in data flows. Data flows are managed by the Strategy Engine and route data between two modules.
Every module has a unique identifier, called a URN (Uniform Resource Name). The module URN is used to indicate the target of module commands.
A data flow is a stream of objects of arbitrary type between two started modules. A data flow must be initiated, either by a command file or from code. Data flows can also be stopped.
Part of the definition of a module is whether it's a data requester, a data receiver, a data flow requester, or all of the above.
Creates a module instance. Some modules are auto-created, some are not; this is defined when the code for the module is written. Modules that are auto-created do not need to be created as they will be created at system initialization. Whether the module is auto-created or created manually, a module must be created before it can be started.
The syntax for the createModule command is particular to the module being started. Here is the current list of modules and their parameters.
Starts a created module instance. Some modules are auto-started, some are not; this is defined when the code for the module is written. Modules that are auto-started can not be manually started. Modules that are not auto-started must be started before they can participate in a data flow.
The syntax for the startModule command is: startModule;<Module Instance URN>
Creates a data flow between module instances. The source module must be a DataEmitter and the target module must be a DataReceiver.
The syntax for the createDataFlow command is: createDataFlow;<Module Instance URN>;<content>^<Module Instance URN>;<content>^...^<Module Instance URN>. This implies that several different modules can participate in the same data flow. If a module has entries to its left, that module must be a DataReceiver. If a module has entries to its right, that modules must be a DataEmitter. In the example above, then, the module with the URN "metc:strategy:system:orderReceiver" is both a DataReceiver and a DataEmitter. Data in a data flow moves from left to right. Data will continue to flow until the data flow is stopped.
The Strategy Engine configuration is predominantly established in strategyengine/conf/default.properties and user.properties. There are other settings in other files, but these are the files most commonly changed. The two files work together to define a key/value properties set that the Strategy Engine uses for configuration. Values are defined in default.properties and optionally overridden in user.properties. If the same key is defined in both files, user.properties takes precedence. It is recommended to copy the key/value pair you wish to modify from default.properties to user.properties. The Strategy Engine must be restarted for configuration changes to take effect.
This property defines the network interface on which the Strategy Engine listens for web services requests. The default value listens on the loopback address only. This is secure, but may not address your needs if you're running the Strategy Engine and Photon on different machines. This value can be either an IP address or a hostname. A reasonable alternative value is 0.0.0.0, which would make the Strategy Engine listen on all interfaces of the Strategy Engine.
This property defines the network port on which the Strategy Engine listens for web services requests. The default value is reasonable. You may need to change this if you already have something running on port 9001 on your Strategy Engine machine or if you're running more than one Strategy Engine on the same machine. Each Strategy Engine must be assigned a unique port.
This property defines the network port on which the Strategy Engine listens for RPC requests. The functional contents are identical for RPC and web services. It's just another way to get at the same features.
This property defines the URL for the message bus over which data is pushed as opposed to polled via the web services host and port above. The same security considerations apply: you may need to change localhost to something more open. Unlike the two properties above, hostname and port are defined in the same property. If you're running more than one Strategy Engine on the same host, you'll need to change 61617 on the second Strategy Engine to a unique value.
This property defines the minimum level of log events to publish remotely. Events with log level less than this will not be published remotely.
This property defines the location of DARE to connect to. If DARE is running on a different machine, this value will have to be changed.
This property defines the username as which to connect to DARE.
This property defines the password as which to connect to the order routing system DARE.
This property defines the DARE web services host name.
This property defines the DARE web services port.
This property establishes the optional order ID prefix to attach to all orders from this Strategy Engine.