To run multiple instances of the same strategy using different parameters and/or settings, you can modify your applicationContext-client-xx.xml file in src/main/resources/META-INF folder as below:
By default, strategyName is bind with the specific name provided during creation of the strategy project and it needs to be parameterized with a proper placeholder, for example, ${strategyName}. This change allows providing strategy name in VM arguments of run configuration for every running strategy instance. A detailed example can be found in the Random example strategy that we provide.
<bean id="strategyXEngine" class="ch.algotrader.esper.EngineFactoryBean">
<property name="strategyName" value="${strategyName}"/>
<property name="configResource" value="esper-strategyX.cfg.xml"/>
<property name="configParams" ref="strategyXConfigParams"/>
<property name="initModules" value="strategyX-init"/>
<property name="runModules" value="strategyX-run"/>
</bean>
<bean id="strategyXService" class="ch.algotrader.strategy.StrategyXService" autowire="byName">
<property name="strategyName" value="${strategyName}"/>
<property name="engine" ref="strategyXEngine"/>
</bean>
<bean id="strategyQueue" class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg value="${strategyName}.QUEUE" />
</bean>
</beans>
Comments
0 comments
Please sign in to leave a comment.