AlgoTrader uses DefaultExecutionModel in simulated trading to decide if placed orders can be executed based on incoming market data events. Default Execution Model is used in backtesting and simulated trading based on live market data.
More details on DefaultExecutionModel in AlgoTrader can be found here:
In some cases, it's needed to adjust DEM to client specific needs, for example, AlgoTrader, when backtesting with bars, uses bar close price as an execution price. In some cases, it might be needed to use a different field for that or implement more sophisticated execution logic.
DefaultExecutionModel can be overridden in any AlgoTrader strategy. In order to do that it's needed to register custom Execution Model as a Spring Bean in the following locations:
/META-INF/applicationContext-client-xxx.xmlin the strategy project under
For live trading (to be used globally):
/META-INF/applicationContext-env.xml. This file needs to be in the classpath, e.g. in the
The following steps allow configuration of custom Execution Model in strategy for simulation purposes:
1. Create folder structure for Execution Model:
Custom Execution Model must implement the interface
applicationContext-client-xxx.xml file where NewExecutionModel will be registered:
3. Register NewExecutionModel in applicationContext file:
<?xml version="1.0" encoding="UTF-8"?>
<bean id="newExecutionModel" class="ch.algotrader.strategy.ema.NewExecutionModel" autowire="byName"/>
After that, the simulation will use the newly created Execution Model. You can contact our support team creating a Zendesk request to get details on DefaultExecutionModel implementation in your AlgoTrader version: