Inspiration

We were inspired by recent events in the stock market; this was partly an experiment to demonstrate/visualize how market forces actually work. We wanted to gamify this concept to help understand these ideas better (without the financial risks), and we chose to implement it at a smaller-scale so these concepts would be more apparent. An application like this could also be useful as an educational tool to interactively teach economic concepts.

What it does

This web application simulates how trades work in the stock market on a smaller scale. Each player is allowed to place orders (which are bids or asks) in the market, where they indicate the quantity of shares they want to buy and the maximum/minimum price at which they are willing to buy/sell. Then, the orders are consolidated by matching up buyers and sellers when possible. A bot was also programmed to trade frequently in this market, which provided liquidity in the market (which allows players to buy and sell more). The bot trades at prices close to the current market price (the last executed trade) and tends towards the real market price (following a normal distribution).

How we built it

We built the frontend using React and terminal-css to create a retro-style, dynamic application. We also chose to use Google Cloud Firebase’s Cloud Firestore, since it provided us the ability to synchronize data in real-time and create cloud functions rather than building a designated server. For the bots, we chose to write code in Go, since Go’s lightweight threading model corresponded to our use case well.

Challenges we ran into

Designing the data structure and flow for this application was more complex than we had anticipated, particularly with the several edge cases in accurately recording transactions and maintaining balances. We used Firebase due to its real-time capabilities, but at times we felt a SQL database may have been more effective for processing this kind of financial data.

Accomplishments that we're proud of

We were proud of successfully Integrating our React application with Firebase for real-time interaction. Specifically, we were able to watch how the programmed bot could affect commodity prices through purely market forces, and we could see this happen in real time within our application. We are also proud of effectively creating a retro-themed, minimalist design throughout our application.

What we learned

In terms of technical concepts, we learned more about creating web applications in React (and TypeScript), and creating a user interface to match our goal. We also learned more about how to integrate React with Firebase, and how to develop cloud functions to effectively manage complex data without a designated server. All in all, working on this project also taught us a lot about managing financial data in applications, and helped us to understand the forces that drive today’s markets.

What's next for Wall Street Mafia

Our original goal was to gamify this idea, and that is something that we want to work on next. One idea we had was to develop this further and create a Mafia-style game similar to Among Us. Another interesting extension to this project would be to allow players to lend each other money, further demonstrating how an economy works and the trends that develop over time.

Team Leader Slack

Bradon Zhang https://swamphacks-vii.slack.com/team/U01KYAA0MAB

Share this project:

Updates