10

How does buying and selling bitcoins work once the order is placed?

I just know that the order-matching engine is used for this purpose, but more information regarding this will be helpful.

13

New offers and orders are matched respectively with the best order and offer available until they are fulfilled. If there is more than one entry at the same price, the oldest entry will be matched first. If a new entry cannot be matched completely, it will remain in the order book until the remainder is matched or it expires.

See an example below:

The initial order book

Offers:

[Bob] sell 1 BTC at $1000
[Charlie] sell 2 BTC at $1001, [Dolph] sell 1 BTC at $1001
[Emilio] sell 1 BTC at $1002

Orders:

[Fabienne] buy 1 BTC at $999
[George] buy 1 BTC at $998
[Harry] buy 1 BTC at $996, [Ivan] buy 5 BTC at $996

Alice wants to buy some Bitcoins.

Alice wants to buy 2 BTC and is willing to pay up to $2020. She adds an order for 2 BTC at $1010.

The system will now try to match her order to offers already in the system, of course matching the best offer first.

As seen above, Bob is offering to sell at $1000 and Charlie offers to sell at $1001, her order matches with Bob's offer using it up completely. Her order has a second BTC though, which will be matched against Charlie's offer next, because Charlie entered his offer before Dolph, who is offering the same price.

After Alice's order was matched there are the following offers:

[Charlie] sell 1 BTC at $1001, [Dolph] sell 1 BTC at $1001
[Emilio] sell 1 BTC at $1002

and the following orders:

[Fabienne] buy 1 BTC at $999
[George] buy 1 BTC at $998
[Harry] buy 1 BTC at $996, [Ivan] buy 5 BTC at $996

Note that Alice's order and Bob's offer are gone, and Charlie's offer is reduced by 1 BTC.

Afterwards, Jeremy wants to sell some Bitcoins

Now Jeremy wants $9,970 and has 10 BTC for sale. He creates an offer for 10 BTC at $997. Currently there are only two orders that will buy at or over that price: His offer matches the orders of Fabienne and George. He gains $999 and $998 for two of his BTC, the remaining 8 BTC will stay as an offer.

After Jeremy's offer was partially matched there are the following offers:

[Jeremy] sell 8 BTC at $997
[Charlie] sell 1 BTC at $1001, [Dolph] sell 1 BTC at $1001
[Emilio] sell 1 BTC at $1002

and the following orders:

[Harry] buy 1 BTC at $996, [Ivan] buy 5 BTC at $996
  • Excellent! Just one quick question: Cryptsy applies a fee of 0.2% when buying, and 0.3% when selling. Who pays that fee? In your sample, Alice ended up paying $2001 for the coins. Is her account charged $2005.002 , or does Bob receive only $998 for his sale? – Joe Pineda Jan 19 '14 at 3:00
  • 1
    I think it is the easiest when the fee is applied after the order and offer have been matched. I.e. Alice's $1000 are matched to Bob's 1 BTC, but Alice ends up receiving 1 BTC * 99.8% = 0.998 BTC, meanwhile Bob receives $1000 * 99.7% = $997. – Murch Jan 19 '14 at 16:02

protected by Community Mar 11 '18 at 15:53

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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