<p>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.</p>

<p>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. </p>

<p>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.</p>

<p>If in your example the sell orders were each for 50 XXX, the resulting order book would look like this:</p>

<pre><code>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:
&gt;selling 50 XXX - 100 satoshis per coin
&gt;selling 50 XXX - 101 satoshis per coin
&gt;selling 50 XXX - 102 satoshis per coin
&gt;selling 50 XXX - 103 satoshis per coin
&gt;selling 50 XXX - 104 satoshis per coin
&gt;selling 50 XXX - 105 satoshis per coin
&lt;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
…
</code></pre>

<p>Also see: <a href="https://bitcoin.stackexchange.com/a/20759/5406">How do buy and sell orders work?</a></p>

CC BY-SA 3.0
2018-04-22T15:08:21.437Z
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
CC BY-SA 3.0
2018-04-22T15:12:24.220Z
And what happens to remain 2400 satoshis? Will it be "refunded" to my BTC balance after filling trade?
mbackonja
CC BY-SA 3.0
2018-04-22T15:41:17.767Z
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
CC BY-SA 3.0
2018-04-22T16:17:25.077Z
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
CC BY-SA 3.0
2018-04-22T16:28:53.117Z
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
CC BY-SA 3.0
2018-04-22T14:52:25.923Z
2018-04-22T15:36:22.523Z
2018-04-22T15:36:22.523Z
Murch
<p>If there are sell orders like this:</p>

<pre><code>selling 200 XXX - 100 satoshis per coin
selling 200 XXX - 101 satoshis per coin
selling 200 XXX - 102 satoshis per coin
selling 200 XXX - 103 satoshis per coin
selling 200 XXX - 104 satoshis per coin
selling 200 XXX - 105 satoshis per coin
...
</code></pre>

<p>If I put buy order like this: "Buying 600 XXX for price 105 satoshis per coin - total 63000 satoshis" (and let's assume that I have 1 BTC)  - what will happen? Will I spent 63000 satoshis and get more than 600 XXX coins or I will buy exactly 600 XXX for less than 63000 satoshis and what will happen with remaining satoshis for that trade? To rephrase, will my order be filled after spent 63000 satoshis or after buying 600 XXX and what will happen with remaining satoshis for that trade?</p>

<exchanges><trading><exchange-order>
Need explanation - limit buy order (Cryptopia)
mbackonja
# Need explanation - limit buy order (Cryptopia)

(Asked by: username_0 on 2018-04-22)

If there are sell orders like this:
selling 200 XXX - 100 satoshis per coin
selling 200 XXX - 101 satoshis per coin
selling 200 XXX - 102 satoshis per coin
selling 200 XXX - 103 satoshis per coin
selling 200 XXX - 104 satoshis per coin
selling 200 XXX - 105 satoshis per coin
...

If I put buy order like this: "Buying 600 XXX for price 105 satoshis per coin - total 63000 satoshis" (and let's assume that I have 1 BTC)  - what will happen? Will I spent 63000 satoshis and get more than 600 XXX coins or I will buy exactly 600 XXX for less than 63000 satoshis and what will happen with remaining satoshis for that trade? To rephrase, will my order be filled after spent 63000 satoshis or after buying 600 XXX and what will happen with remaining satoshis for that trade?

**Tags:** exchanges, trading, exchange-order


---

## 1 answers

### Answer by username_1 on 2018-04-22. Score: 0 | Accepted answer

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

Also see: How do buy and sell orders work?

> **Comments:**
> **username_0**: 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?  
> **username_0**: And what happens to remain 2400 satoshis? Will it be "refunded" to my BTC balance after filling trade?  
> **username_1**: 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.  
> **username_0**: 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?  
> **username_1**: 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.  

---

