When there is some price overlap, i.e an ask and a higher priced bid, who will get the difference? In other words, will the seller get an "extra", or the buyer a "discount"? I'm interested in BTC-e mainly, but general knowledge about exchanges is useful too.
I looked around here and found similar questions, such as this one, this one, and this one, but still I don't fully understand how it works.
This answer seems to suggest that the effective price will be that of the order that was in the book, the one placed first. So, assuming volumes match, an ask at $1000 with a bid at $1050 will be filled at $1000 if the ask was placed first, or at $1050 if the bid was placed first.
Here it's stated that "the exchange will match the buy order with the lowest sell orders", but it's not clear to me if that's the case just in the example given in the question, or always. This other one agrees with the other two, but doesn't say what happens in the opposite case (swapping bids and asks).