💵 Bloomberg's Code B Algorithmic Trading Hackathon 💵
Yesterday I participated in Bloomberg’s annual Code B Algorithmic Trading Hackathon, which simulates a real-life stock market with the goal to design the best profit-producing algorithm. My team (yungSavage) consisted of myself and Max Bentata.
It was an incredible coincidence that right as I started working on a quant-project, this hackathon came along; I saw it as an opportunity to not only get started but also meet others interested in quantitative analysis and the stock market.
The game worked by using a server with predetermined sets of stock prices and dividend payout with real volume set by players of the game. So basically it was an entirely local stock market that behaved unlike the real thing making a very interesting game. Max and I brainstormed ways to create an algorithm that was best suited for this game. We realized that a simple and easily adaptable solution would be to write a Python script that looks up and parses the Bids/Ask/Size
run("yungSavage", "2121", "SECURITIES") of the entire market every second, finds the ticker with the highest number of BIDs and places an order to BUY that stock with 25% of the portfolio. Then the dividend payout per second of the ticker would be parsed from the previous data to calculate when the DIV payout decays to 30% of the original rate in order to trigger a sell.
This idea was mainly used because it was incredibly simple and logically solid as it would follow the liquidity of the market and maintain steady profits. At first, figuring how to connect to the sever and understand the mechanics of the game was a challenge. We didn’t realize that the stock only responded to the players playing so we spent a good amount of time just playing with manually buying and selling to make money and figure out how the charts respond. After this, I started working on how to parse the incoming string data when calling to the server. This took some time for me because I had to troubleshoot and correctly format all the data so that it would efficiently and quickly loop through. I soon realized however that that the tickers were changing every round and my previous method of keeping all the tickers hard-coded in a list wouldn’t work. So I had to pause and write another loop to parse the tickers to auto update every time.
By the time the final rounds were approaching we were still working on writing the BIDs lookup part of the algorithm and were unable to implement the dividend payout calculator so we just put a
sleep.timer() function on it to hold the stock after buying for profit. By competition time, we had an algorithm that we weren’t sure worked because there was no volume to test it against so we were really surprised when we maintained 5th place strongly for a portion of every round. We were super happy with the results but also slightly angry that we weren’t able to implement the dividend payout because then we would have had a very solid chance to win the entire thing.
However, overall I feel like I learnt a lot from working together with Max and going through the process of brainstorming, writing, testing, and tweaking until we had something that was good but had room for improvement. I am definitely looking forward to doing this again next year, hopefully with significantly more knowledge and experience.