two computers shake hands.
One computer says I will buy stock at the volume weighted average price.
The other computer says I will sell stock at the volume weighted average price.
then at the end of the day they compare notes.
and the trade is concluded.
I think thats how it works.