I've been writing some test code to try and understand in what order Universe selection, security change events, ondata events, and order events are called given different data resolutions.  I am still confused as to how all of these things fit together.  To try and fix this I want to ask four questions about the test code I've attached that I think will help me get a breakthrough.   

1.  Why are my MarketOrders being filled at midnight following the morning that they should have theoretically been filled?  

2.  What is the difference between the log timestamp value and the UtcTime stamps I used to track when the functions are being called? 

3.  On the first day the coarse universe selection function is being called even though it doesn't look like any data has actually been given to the algorithm yet and the actual security change event doesnt get thrown until the midnight following.  Why is this happening?  

4.  Why is Ondata() called at midnight as well?  

Author