I was active on the BBS scene, found the very first Linux release, tried to install it, but it couldn't handle the bad sectors on my hard drive, so I never returned to Linux until about 10 years later.
Many exchanges use an auction mechanism to prevent this from happening. When a trade is made that is more than x% different from the previous trade, the security goes into "auction mode" for a period of time. During this period all the bids and offers are taken, but only at the end of the auction, using an "uncrossing" algorithm, is a fair price determined for the security. The auction can of course also be manipulated, but you'll need a lot more money to influence the price.
I worked as a HFT programmer. You don't understand how orders and trades work. You start going wrong when you say "Eve has just learned that Alice will sell for less"... There is no such mechanism. If your bid is lower than the offer, no trade happens.
Just checked only libraries I've written in my spare time, and that's half a million lines. Those half a million lines have been refactored countless times. Including projects and actual paid-for work, it's easily a couple of million lines. Then again I've been programming for 20 years.