Upon system startup strategies run through the life cycle phases as defined in the chapter Live Trading Mode in the AlgoTrader documentation. At the same time market data connections are established. Due to the asynchronous nature of these two processes it is not predetermined which one will complete first. Typically within the
START life cycle phase market data is subscribed. This however will fail if the market data adapter has not reached its
SUBSCRIBED state by that time. To circumvent this issue the following Esper patter can be used, which waits for both the first
SessionEventVO to arrive before it fires:
select * from pattern[LifecycleEventVO(phase=LifecyclePhase.`START`) and SessionEventVO(state=ConnectionState.SUBSCRIBED)];
Please sign in to leave a comment.