When new orders are added to the orderbook, they are first matched against the most favorable existing orders. If the newly added order cannot be fully fulfilled, the remainder is put on the order book.
Your order would be limited to buying 600 coins and at a price of 105 satoshis. It would be filled after buying 600 coins. To have an order fulfill at a total amount to spend, you'd give a limit in the amount you want to spend rather than a number of coins you want to purchase. Defining all three, a number of coins to purchase, a maximum price you're willing to pay per unit and a maximum amount you're willing to pay is possible, but will not hit all three of your restrictions unless you get exactly the price you're aiming for.
In your example that would mean that your buy order would first match the sell order at 100 satoshis/coin, then match the 101 satoshis per coin and finally be exhausted by matching the 102 satoshis per coin. You'd have purchased 600 XXX at a total of 60600 satoshis.
If in your example the sell orders were each for 50 XXX, the resulting order book would look like this:
Before:
selling 50 XXX - 100 satoshis per coin
selling 50 XXX - 101 satoshis per coin
selling 50 XXX - 102 satoshis per coin
selling 50 XXX - 103 satoshis per coin
selling 50 XXX - 104 satoshis per coin
selling 50 XXX - 105 satoshis per coin
selling 50 XXX - 106 satoshis per coin
…
matching:
>selling 50 XXX - 100 satoshis per coin
>selling 50 XXX - 101 satoshis per coin
>selling 50 XXX - 102 satoshis per coin
>selling 50 XXX - 103 satoshis per coin
>selling 50 XXX - 104 satoshis per coin
>selling 50 XXX - 105 satoshis per coin
<buying 300 XXX - 105 satoshis per coin
buying 300 XXX - 105 satoshis per coin
selling 90 XXX - 106 satoshis per coin
…
After:
buying 300 XXX - 105 satoshis per coin
selling 90 XXX - 106 satoshis per coin
…
Also see: How do buy and sell orders work?
Thanks! That's explain everything! But what if I want to spend 63000 satoshis paying no more then 105 satoshis per coin? Is it possible and what is the type of that sort of order? – mbackonja – 2018-04-22T15:08:21.437
And what happens to remain 2400 satoshis? Will it be "refunded" to my BTC balance after filling trade? – mbackonja – 2018-04-22T15:12:24.220
If Cryptopia require you to deposit before trading, the 2400 would still be in your BTC balance since you haven't spent them. --- If you just give an amount that you want to buy for and a maximum price, you'd purchase a variable amount of coins. In your 200s example, you'd purchase another 23.3 XXX from the 103 satoshis per coin sell order. – Murch – 2018-04-22T15:41:17.767
Yeah, that's exactly what I want. Do You know if Cryptopia supports that type of order (to spend all amount and buy a variable amount of coin not spending more then specified price per one coin)? Is there any name for that type of trade? – mbackonja – 2018-04-22T16:17:25.077
I'm not familiar with Cryptopia. Some exchanges have "limit orders" with defined price and volume, and "market orders" that only define volume. In a well-stocked order book, the latter would have a similar effect as what you look for. – Murch – 2018-04-22T16:28:53.117