I am building a service similar to the BullionVault where users can buy and sell bullion. They will be placing their Buy and Sell orders on the service. Matched orders will get executed.

My question is this:
When there is a matching buy and sell order, where, the selling price is significantly lower than the buy orders buying price, how should the price be determined?

These are the Options I could think of :

  • Either the buyers price is taken or the sellers price is taken and one of them gets the benefit.
  • The difference between prices is split in half and both of them benefit.
  • The exchange buys from the seller and sells to the buyer in real time, so the difference is picked up by the exchange.

As this is similar to how the stock markets work, I am trying to understand how this type of a trade is executed in those exchanges.


1 Answer 1


Your question is generic about matching engines, you should googlize about it or/and read a good book on market microstructure like Market Microstructure in Practice.

In short to answer to your question: the seller or the buyer came first in the market inserting a limit order, providing liquidity to other participants. Then came the other side with a marketable order, consuming liquidity. The outcome of a consumer matching a provider generates a trade at the price of the limit order.

It is about who came first in the market. When you provide liquidity, you

  • set the price of a potential future trade,
  • pay (the bid-ask spread) less than if you consume liquidity,
  • disclose your interest,
  • are exposed to adverse selection.
  • 1
    $\begingroup$ would be nice to add a "disclaimer" :-) $\endgroup$
    – Matt Wolf
    Commented May 12, 2014 at 5:50
  • $\begingroup$ @MattWolf my name is not that common: I am almost surely the author of "Market Microstructure in Practice" ;{)} $\endgroup$
    – lehalle
    Commented May 12, 2014 at 16:21
  • $\begingroup$ "almost surely" is trademarked by Steven Shreve (CMU) already ;-) $\endgroup$
    – Matt Wolf
    Commented May 12, 2014 at 16:43
  • $\begingroup$ A corollary of this is that the Matching Engine must store a Timestamp with each order, or at least keep track of the order (using pointers, etc.) in which transactions arrived (at any given price level). $\endgroup$
    – Alex C
    Commented Nov 25, 2019 at 19:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.