Stock exchanges really cannot be expected to track numbers of outstanding shares. One puts in a bid or an ask, indicating that one is willing to purchase or sell the given number at the given price, and an order type, indicating the manner to fulfil (fill-or-kill, limit to a certain price, take whatever outstanding offers are necessary...). This is more than enough nuance for a professional product like a stock exchange that needs to operate at microsecond cadence.
If you want to validate whether an order makes sense or is a "good idea", the place to do it on the client.
Coming from a perspective of competitive multiplayer game networking, that seems insane. You can't trust the client. An ideal stock exchange, I'd think, would include the same sort of logic as a payment processor: blocking any orders that seem to be "not the sort of order this client would make", to prevent e.g. orders being executed by people who have illegitimately gained access to the account.
Of course, these type of algorithms typically take far more than microseconds to run—but that's fine, as long as they take the same time for everyone.
Multiplayer games are a completely different genre than a professional-level API like a stock exchange. You absolutely must trust that a client's business logic is sound; as long as their credentials validate it's simply out of scope for you to do anything other than explicitly execute their instructions, because that's how the traders make money. "Trust the client" doesn't mean state, it means actions - the equivalent reasoning in a game would be disallowing the player from "playing badly", which is nonsensical.
> the equivalent reasoning in a game would be disallowing the player from "playing badly", which is nonsensical //
Self and team damage is often turned off (on games I've played, I'm not really a big gamer). That would seem to correspond to blocking a sell order that represents more shares than you could possibly have?
A stock exchange isn't responsible for tracking how much outstanding stock there is. The purpose of an exchange is just to match orders, not to determine if they are insane.
Expecting otherwise would be like expecting eBay to determine that your buy it now price is too low or that you don't have enough inventory on hand to fulfill your listings.
Not at all. If your exchange takes five milliseconds, you're gonna lose the volume of high frequency trading algorithms because they cannot front run as effectively. For an exchange volume (hence fees) is key, so you really have to work for HFTers.
You can validate this stuff before doing matchmaking. Sure, it might add less than 1 ten millionth of a second latency. But, nobody is going to drop an exchange because one of there network cables is a few inches longer than necessary and that's the cost of sanity checks.
If you want to validate whether an order makes sense or is a "good idea", the place to do it on the client.