The problem is that the want amount field of the orderbook table is used for doing matches when I don't think it should be. Suppose you have an order on the books and someone comes along and fills most of it by offering a much better rate than you asked for.Since want_amount is used in the matching code, you can end up with the leftover portion of your order being matched at a very unfavourable rate for you.