Inspiration

Many people do not invest in the stock market because they believe it is risky and that they will almost always lost money. However, the stock market can be a great secondary source of income for those who spend time to understand it better. No one would want to risk losing their hard-earned money to see how their investments may pay out when they are new to the stock market. This is where StockBot, your friendly neighborhood stock simulator, enters the scene.

What it does

StockBot is a Discord bot that allows users to simulate buying stocks of companies using an API. Every user can set a starting balance and they can use their balance to 'invest' in companies. When a user buys or sells a stock, the program queries the real-time stock price and uses this value to add and subtract from their balance.

How we built it

We built StockBot using the Discord and commands Python libraries. The API we used to get real time stock prices is from TwelveData. Data needed for the operations are stored using MongoDB.

Challenges we ran into

We had issues setting up the database at MongoDB, but we were able to fix them. We also had some minor issues using the API to collect the data. We also fixed those issues.

Accomplishments that we're proud of

We are proud that we were able to successfully set up a MongoDB database for storing multiple users' data. We were able to solve many issues that came up during the production in a short amount of time, ranging from code bugs, api problems, import of dependencies, unexpected behavior in the database, etc.

What we learned

We learned a lot about Python, since we all had little experience in Python prior to this hackathon. We learned about how discord bots work with the Discord library. We also learned a lot about setting up and working with MongoDB databases, and working with async code and API requests in Python.

What's next for StockBot

We want to implement cryptocurrencies into the bot, in addition to stocks.

Built With

Share this project:

Updates