This question already has an answer here:
I am trying to get a grasp on how the bid-ask match maker works, in particular for options as there is less volume and fewer market orders. Lets say I own an option, and place a limit sell order for $10.00 overnight. Now, overnight something happens which causes the stock to pop, and for whatever reason other traders don't see my sell order for $10.00 and place bids at $20.00 pre-market open. Now at market open for an instant there is a bid-ask spread of $20 - $10. My question is, which takes priority? Is it based on the time the order was placed, even when the market is closed?