There are two ways you could do to let your strategy get extra information:
- For information updated with depth, for example, moving average of price, depth volume, etc. You could simply extend the class Depth to include those information, and add your own SequentialCache<? extends Depth> to the DepthCaches which is passed to the simulator, like:
SequentialCache myDepthCache = generateMyOwnDepthCache();
DepthCaches depthCaches = new DepthCaches();
Simulator simulator = new SimpleSimulator.Builder(depthCaches).build();
- For non-depth updates, you can pass the cache of the updates to the simulator directly. Let’s take SimulationTimer as an example. SimulationTimer is a SequentialCache and is passed to the simulator like:
Simulator simulator = new SimpleSimulator.Builder(depthCaches).withNonDepthUpdates(timerUpdates).build();
- Then, we add a simple handler instance in the enum ChannelMessageHandlerFactories for the simulator (e.g., ChannelMessageHandlerFactories.TIMER) to call back your strategy upon updates. Please also see DemoTimer in algoquant-demo for a complete example.