Building a Secure Stock-Trading App with MongoDB Atlas

< View all blog posts
Tom Goldenberg
November 17, 2017
Category: Cloud, Customer Stories
This is a guest post by Tom Goldenberg, CTO @ Commandiv.

Commandiv is a stock-trading platform that provides trade recommendations to busy professionals who have investment opinions but don't have time to actively manage their account. We offer users a rich view of their investments and opportunities along with trading algorithms to help them trade smarter. Our investors can invest with no commissions, build a target portfolio, and save time with trade recommendations. As a pre-seed startup, we’ve been focused on validating our product and growing our customer base to the tune of 60-70% month over month. MongoDB Atlas has helped us stay focused on our end goal: making it quick and easy for busy people to manage stock portfolios.

Commandiv stack

  • MongoDB Atlas
  • Node.js
  • React
  • Redux
  • MongoDB Compass

A Flexible Schema for Stock Trading

We use MongoDB to run complex analytics of stock performance and to backtest our trading algorithms. With MongoDB, we have the ability to create really rich objects, which is crucial for a stock-trading platform. In order to effectively keep our customers informed through the app, we need to show a lot of stock information in our UI, like price and market cap. We’re able to store this information in nested documents that we then easily send to the front-end, without having to do an expensive join.

We store a lot of data related to each stock, such as revenue growth, cash flow, and dividends, and we need to relay that data to our customers quickly without compromising performance. The flexible data model allows us to effectively model our information for speedier access and higher throughput.

MongoDB lets us store rich data in individual documents, making it easier to access and display ticker data in our app. This is an example of our Ticker document.

We are able to retrieve all of our data and send it up to our clients within 100 ms, which is much faster than all of our competitors, causing some customers to remark on how fast the service is. A lot of competitors who are using RDBMS would have to do multiple joins and sacrifice a lot on performance to offer the same type of service.

Operations in the Cloud with MongoDB Atlas

Using MongoDB Atlas, MongoDB’s database as a service, has helped us streamline our operations nicely. We also use Compass, the GUI for MongoDB, which provides a nice interface for us to quickly access data without a lot of MongoDB expertise. My co-founder, who isn’t as technical as myself, can use Compass to get information out of our database for future investors or other stakeholders on-demand.

Reading, Viewing and Updating Documents in MongoDB Compass

Our Atlas and Compass setup makes it easy to onboard new employees and enable them to create value right away. When we hired a college student to work with us for 11 months, I was nervous that he would have to spend time ramping up on MongoDB, time that could be spent building out the product. But Atlas and Compass have abstracted away much of the learning that I had to do when I first started with MongoDB. With Compass, he can easily understand our schemas and access data. With Atlas, he doesn’t have to worry about managing the operations that impact his development choices. In about two weeks, he was contributing to the team and making an impact on our product, which is important when you are trying to move fast.

Reliable, Secure and Resilient

One of the benefits of using a service like Atlas is the enhanced security features that come out of the box. The network isolation and VPC peering with AWS was appealing to us for security reasons, and we’ve also leveraged Atlas’ simple permissioning features. We ran into an issue one day when someone on my team accidentally deleted a whole collection on our sandbox environment, so we decided to set up a permissioning system, further securing our database to help prevent other accidents as we grow. I reached out to the Community Slack and got connected with one of MongoDB’s Developer Advocates, Jay Gordon, who jumped on the phone with me and helped me get more context around security, provisioning and backups. In Atlas, I was quickly able to create permissions via the UI to restrict read and write access for different users.

Our customers are investing their money through us and are expecting the highest levels of reliability and security, so the managed backups in Atlas are a must for us. Again, we don’t have the time to invest in writing scripts for managing database backups. With just a few clicks, you can configure, restore, and query point-in-time backups.

Getting Support and Future Growth

In several other companies that I’ve worked with, we failed to invest in a database service and running the database required many hours of hands-on DevOps. DevOps doesn’t just take up time, it also requires specialized knowledge to do the job right. Right now, when the team is focused on validating the product, we can’t focus on operational heavy lifting and we can’t afford to hire someone to manage the systems for us. We haven’t had to do any of that with Atlas. We’ve been very hands off and we’ve rested comfortably knowing that our system will keep up.

If you are just getting started with Atlas, definitely take the time to read their educational resources like their blog posts and getting-started tutorials, which are very technical and informative. Another great resource is the MongoDB Community, which I got connected to through the Community Slack. There are many MongoDB experts, Masters, and engineers in that channel who were really helpful whenever I had a question, big or small. We’re excited to continue our growth trajectory with MongoDB Atlas.

comments powered by Disqus