I have 64 strategies to run, so I need iterate over than:
for (Configuration configuration: configurations)
new runMyStrategy(configuration)
On my tests purpose I try with:
new runMyStrategy(configurations.get(0))
Here runMyStrategy is my all ITesterClient process (connect, set strategy/instrument, run strategy and desirable exit).
and I got System.exit(0).
On my strategy I have:
testClient.setSystemListener(new ISystemListener() {
private int lightReconnects = 3;
@Override
public void onStart(long processId) {
LOGGER.info("Strategy started: " + processId);
}
@Override
public void onStop(long processId) {
LOGGER.info("Strategy stopped: " + processId);
File reportFile = new File(filename + ".html");
try {
testClient.createReport(processId, reportFile);
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
}
if (testClient.getStartedStrategies().size() == 0)
System.exit(0); // exit
}
I don't want to exit of all, I need to stop only this strategy.
If I comment this System.exit(0), my strategy enter onStop, process it and don't exit, still "running".
I try put testClient.stopStrategy(strategyId) on OnStop, but it always return null to strategyId (i guess it already done). strategyId is the long strategyId = testClient.startStrategy(...);