It is perverse, no doubt about that, but there is a logic to it, everything is about knowledge, complex interlinked systems like the global economy are constantly changing and as a result so is the information we have about it. Any trader with the ability to take this raw data and convert it into knowledge about the future value of a stock can make money. It's not simply taking money from someone, it's exploiting the fact that they haven't recognised the true value of the stock. That's the theory anyway.
The real insanity starts when you try to nail down the true value of a stock based on responses to millisecond changes in the markets. No human could ever function like this, so algorithms are encoded with our flawed theories of how to recognise the "true value" of a stock. Assuming the markets behave (or, in more recent terms, consistently increase in value), it's all good, but as soon as the markets start to behave irrationally, these algorithms go apeshit, exacerbated by the fact that there's thousands of these systems all following their own crazy formula, in real time, with real money, now that is perverse.
I've noticed several design suggestions in your code.