# Why was a buy position not closed at the seller's price?

I'm trying to understand how the trading of crypto-currencies work. I imagine it's not that different from standard currency (or asset) trading, so I ask in this site.

Consider the crypto market shown in Kraken.com. The market can be nicely visualised as a list of sellers and buyers by price level, e.g. here. A capture of a crypto against the Euro:

There you see the current market price (exchange rate), given by the value of the last buy-sell match, and then the open bids for sell (red) and buy (green), with order's volumes and the accumulated volume.

So, say that, while the market price is at $$p$$, I open a buy (crypto) position at $$p-\epsilon$$, with $$\epsilon > 0$$, and volume $$X$$.

Then, at some point, someone decides to sell (crypto) a very large volume $$Y$$ ($$Y>>X$$) at $$p - \eta$$, with $$\eta>\epsilon$$ (i.e. at a lower price than mine). From the example below, I imagine the person puts out a sell position "at market price", which I guess is equivalent to instructing the system to "sell at whatever price is needed", i.e. lower the sell price until all my volume is satisfied". So, my order is executed, together with that of several buyers above and below my price, at exactly the same time. For instance, executed orders (visible in the market platform in the link above) looks like this:

There you see, for instance, that at 9:46:46, a person sold around 5,000 units of crypto for euros at a price 0.3515. Yet, those who had a buy position at a price above 0.3515 and which was triggered by the sell order above paid more than 0.3515. For instance, the person buying 248.2370 units of crypto paid 0.3545. Shouldn't that person have paid 0.3515?

More crucially, does the nature of the trade depends on the type of order? For instance, Kraken offers several types of order like market, stop loss, take profit, etc. I'm trying to understand how the trades work.

## 1 Answer

Kraken implements an order book mechanism to match buyers and sellers.

You would need to dig into more details to know exactly what order was placed by the aggressor in this case (market order ? Limit order ?) as well as the people who got filled but to make it simple let’s assume the seller placed a market order and all the buyers at 0.3545 and below placed limit orders.

The role of the matching engine is to fill everyone at a price they are happy trading at and offer them best execution to be fair to all. The seller is happy selling at the necessary price to fill his liquidity demand if he placed market order but when he sees the best buy order at 0.3545 he can reasonably expect that a chunk of his order will be executed at that level even if the last chunk is executed at 0.3515. In other words executing the entire order at the final (and worst) price would be beyond the reasonable expectation of people willing to buy at 0.3545, and unfair to the seller (would not be « best execution to him »).

All in all this would drive away liquidity takers from the platform which is the opposite of what a good market microstructure is supposed to achieve.