A MarketEventGenerator has a MarketClock data model and a list of listeners to process any time changes from the clock model.
The Generators and MarketClock should be instantiated dynamically rather than as a @Component, because there’re multiple markets running under the application context. For convenience, we will maintain a Map of generators, each for a market.
MarketClock MarketClock has a set of properties, including: heartbeat, localdate, localtime and etc. It will fire property change events when any of the property is changing. A typical scenario is where a user decides to update MarketClock for HKSE with heartbeat timestamps, he builds a HeartBeatListener, obtains a reference to HKSE’s MarketClock and update the heartbeat of that instance. As soon as the heartbeat timestamp is changed, the MarketClock will calculate localtime and localdate based on HKSE timezone, and generate PropertyChangeEvents accordingly.
MarketEventGenerator A MarketEventGenerator listens to PropertyChangeEvents from MarketClock, and generate correspondingly market events such as MarketOpenEvent, MarketCloseEvent and etc. Such MarketEvents will be published to EBS so that simulation engine and strategy will handle such events properly.
One thought on “Market Event Generators”