This scenario feels pretty weird to me, I don't think it makes sense for the exchange to forbid the sell order from being submitted, but I also don't think it makes sense for it to execute the trade. What is the expected behaviour here?
Of course, it's weird and will most likely never happen in reality. However, as Royse777 said, these are 2 different orders, so I assume that the exchange also places them (and has them fulfilled). I would not know that Exchanges check the orders of a user among themselves for consistency.
You could of course try this yourself by placing sales with fractions of BTC and purchases with very small amounts of USD. However, as I said, I assume that these will also be fulfilled.
Thanks, and I agree, no one would realistically ever do this (unless they wrote a really shitty trading bot and didn't realize it was buggy). I was just curious what the expected behaviour was, as I've been writing an exchange in my spare time as a learning experience. To test the program, I run a simulation which randomly picks accounts and places orders; I noticed during this time that accounts occasionally fill their own orders, and wasn't sure if this was desirable.
inb4 some of you tell me no one will ever use it, I know that, I'm solely doing it to learn a new programming language (it's a technical challenge).
Do you do any technical analysis before investing or just follow the hype?
Sorry but what part of my post implied I'm a sheep? I asked a simple question about the technical workings of exchange order execution and you respond by insinuating I'm some fool?