In Grade 10 at one point I played a game with my classmates where we all started with $10 000 in virtual currency and traded stocks with that virtual currency, trying to see who could make the most money. Even though most of us lost almost all our money, the game was a lot of fun.
This is where the idea for Botman Sachs came in. I wanted to recreate the game I played in grade 10, but with bots instead of humans.
What it does
Botman Sachs is a platform for algorithmic trading bots to trade virtual currency and for the people who write them to have fun doing so in a competitive gamified environment.
Users write algorithmic trading bots in Python using the straightforward Botman Sachs API which provides an interface for buying and selling stocks as well as providing an interface to BlackRock's comprehensive Aladdin API for retrieving stock information.
Every server tick (~10 seconds or so, configurable), all bots are run and given the opportunity to perform market research (Through either the BlackRock or Yahoo! Financial APIs and make trades. Bots are given a set amount of time to do this.
How we built it
The bulk of the backend is done in Node, with our bot trading APIs being created using Express. Bots are written in Python and use our Python API, which is a small wrapper that forwards API calls to Node. The web frontend is built using Preact, Chart.js, Code Mirror and Redux.
Bots themselves are run by a separate Node project called the runner. Every server tick, the main Node backend sends out a message to a RabbitMQ server for each bot. There can be multiple runners, all of which grab messages from RabbitMQ and then run the corresponding bot. This pattern lets us add more runners across multiple machines and allows for massive horizontal scalability as more bots are uploaded and need to be run at set intervals.
Challenges we ran into
As developers with little background in finance, we had to consult with a few people about what data was necessary to expose to the bots in order for them to make informed trading decisions.
Accomplishments that we're proud of
We managed to accomplish quite a bit of work and were very productive over the course of Pennapps. This was a large project and we're quite proud of the fact that we managed to pull it off in a team of two.
What we learned
We learned a lot about financial markets, using RabbitMQ and different flavours of Soylent.
What's next for Botman Sachs
We're considering polishing Botman Sachs more and putting it up online permanently.