MarketEvent And Practical Considerations

I’ve built backtest framework months ago; then recently I start design the simulation on live trading. It seems that the simulation needs re-design, after which it could be used for backtest purpose as well. This entry describes what kind of events that a simulation requires, and also other events that could help with running simulation in practice.

  1. Common Market Events The design tries to mimic the real work market. Typically, the critical timing includes: OPEN, CLOSE, and SETTLE; while normally I would include SOD and EOD as well.
  • SodEvent Upon receiving the event, the strategy starts generating sell/buy signals and send orders to SimulationEngine.
  1. Additional Events Simulation has delayed market data. At delayed time, simulation engine would request EDAS to download latest market quotes; for example, stock market opens at 09:30am, so at 10:00am, EDAS will try to download the latest market quotes, because the delayed market data should now have opening price already. With opening prices, the simulated orders will be filled. After filling all orders, there will be OpeningReport. The above scenario requires two types of events: OpenQuoteEdasEvent, and OpeningOrderEvent.
  • OpenQuoteEdasEvent It’s triggered by timestamp, and its listener utilises EDAS to download market quotes.
  • OpeningOrderEvent It’s triggered by listener. After all open orders have been processed, this event will get published; which should have order status and latest position status. Market closes at 15:00, so the market data would be available at 15:30. The settlement is usually done at 20:00, which will cancel all unfilled orders, update latest market prices for latest position values and cash balance. After settlement is completed, SimulationEngine will publish SettlementCompletedEvent, so that any listener who’s interested to publish reports can do further processing.
  • SettlementCompletedEvent

Published by

wofong

三千娑婆世界,三千难忘遗憾;回头乃是岸,此岸在何方;堪忍不能忍,万般看不穿;何时放得下,始得自在心。 I'm a programmer, a quantitative analyst, a photography hobbyist, a traveler, a runner, and a nature lover.

One thought on “MarketEvent And Practical Considerations”

Leave a comment