Digital Wealth, Automated: How StashAway Doubled Growth In 2 Months With Lightbend
- StashAway processes over $4m and 100,000 trades for thousands of customers every day
- Financial transactions must be guaranteed and auditable, or face severe regulatory penalties
- Event sourcing and message delivery guarantees enabled by Akka and Lagom enabled StashAway to scale 2X growth in transactions in two months with Reactive system design
- Core development team confident and happy with system responsiveness, scalability, and ease of updates
Why StashAway chose Event Sourcing with Akka for Auditable Financial Transactions
StashAway is a B2C digital wealth management platform operating in South East Asia, providing automated, algorithm-driven investment and financial planning services in both Singapore and Malaysia, with further expansion in the region planned.
As the first company to obtain a capital markets license for retail fund management in Singapore and Malaysia, StashAway processes nearly 100,000 orders–totaling approximately $4.2m USD in trades–each day (as of January 2020), which is more than double their business volume of two months earlier.
With the market size of assets managed by robo-advisors estimated to hit $460 billion by 2022, StashAway chose Akka and Lagom Framework to design a Reactive system that would not only guarantee transactionality and correctness (under pain of legal action), but would remain responsive in the face of errors and, importantly, scale seamlessly in order to handle future growth.
The Challenge - Guarantee Transactions, or Shut Down
If something were to go wrong, we would face severe regulatory consequences (including personal liability of directors and employees), could lose our license to operate, and would therefore need to cease operations.
For StashAway’s proprietary trading system, it really comes down to one thing: ensuring transactional guarantees across domain boundaries. StashAway’s capital markets license requires that they follow a comprehensive set of guidelines set out by the Monetary Authority of Singapore (MAS) as contained in the “Technology Risk Management Framework” (TRM). The penalty for non-adherence to these guidelines means ceasing all business operations, and eventually shutting down the business if the findings cannot be remediated.
So the risk is real, and the volume large: several times per day, StashAway aggregates thousands of trades (by security) for all customers into a single large trade. When this trade gets subsequently executed and settled with a particular amount (including number of units and total money paid), they must distribute back this result to all customers that had been aggregated into this trade. This can involve thousands of customers at a time–what cannot be allowed to happen is for a trade to be transacted without a corresponding change to the account holder’s balance.
Event sourcing is the only way to guarantee transactionality such that (a) all customers get assigned their respective share successfully, and (b) for each customer it is ensured that both their holding balance (the ledger) of the security as well as their cash balance (as a result of the payment for the trade) get updated at the same time.
Thus, the native event sourcing features of Akka and Lagom is of essential importance for retaining an accurate audit log and helps to manage the complexity of the event processing involved in guaranteeing transactional correctness.
The Solution - Event Sourcing with Akka and Lagom
We are firstly a technology company, so a lot of the value creation for our customers is powered by our strong team of over 20 engineers based in Singapore.
StashAway selected Lagom Framework, built on top of Akka, to power their core trading system dealing with all financial transactions, which include bank statements, rebalancing of portfolios, re-optimizing target allocations across economic regimes, as well as order execution, fee charging, and more.
Rather than creating sub-accounts with a broker, for example, StashAway uses Lagom and Akka to guarantee message delivery at scale, using event sourcing to operate their own omnibus accounts that hold the ledger for customers.
“Accuracy and correctness of transaction data is of paramount (and audited) importance, and this meant we couldn’t use a traditional data approach,” says Nino Ulsamer. “Blocking transactions and tightly-coupled, monolithic design would throw bottlenecks into our complex system of workflows that span multiple microservices running in Docker containers on Kubernetes.”
StashAway has delivered 275,000 dividend transactions to customer portfolios in the last 30 days. If they were using a typical relational DB structure, where information is stored in different tables, it would be an incredibly difficult and error prone process to manually code transactionality guarantees while working with a large number of transactions and clients.
The Results - Transactional Guarantees at Scale
In the last two months, we’ve doubled the amount of transactions processed. With Lagom and Akka under the hood, I feel confident in maintaining such high levels of growth and scaling our business while still being able to double down on additional country rollouts and new feature launches.
The benefits of Lightbend technologies for StashAway’s business have been clear. From a company perspective, Akka and Lagom have contributed to a stable growth path based on the following factors.
Ideal Design for Financial Systems
In the month of January 2020, StashAway processed over 2.5 million buy/sell transactions, 80,000 deposit verifications, 30,000 bank records, and created 25,000 savings goals for their clients.
By using Lightbend technologies that are designed to be Reactive, providing event sourcing and message delivery guarantees out of the box, StashAway has designed an industry-leading financial system that is fully auditable and secure.
Deployments and Fixes Made Simple
Powered by an event log, StashAway can simply try improvements and fixes using the actual events recorded from their production systems, making the results more clear in various test cases. Since they launched in 2017, StashAway has never had an issue that they couldn’t get to the root of in less than an hour of investigative time.
For StashAway’s development team, they now feel highly confident about the consistency of the system when deploying services, due to the at-least-once delivery guarantees both within a service as well as between services. That means they can release code at any point of the day and don‘t have to schedule maintenance windows for regular releases and improvements.
Understanding of Reactive Systems
At first, using event sourcing and the Actor model with Akka and Lagom was a change for StashAway’s development team. The learning curve for thinking of systems in a Reactive way is steep; however, the time spent upfront by the engineering team has paid dividends.
Adopting strong design patterns from Day 1 was well worth the time when compared to the alternative of blocked threads, data inconsistencies, and poor delivery guarantees.
Attracting and Retaining Happy Developers
By working with an exciting and innovative tech stack, StashAways has been able to easily attract top talent in a competitive market like Singapore. Their engineering team is happier working with the benefits that Lightbend technologies provide, and feels confident releasing code into production because of the consistency guarantees.
StashAway is a digital wealth management platform for both retail and accredited investors. Its technology delivers automated, personalised portfolio management for each client's individual portfolios. Its risk-management investment strategy, ERAA® (Economic Regime-based Asset Allocation), is designed to maximise clients' long-term returns while keeping each individual customer's specific risk exposure constant through changing economic cycles.
StashAway currently offers 3 main types of portfolios - its Core and Higher Risk Portfolios, a Singapore-focused Income portfolio and a SGD cash management portfolio, StashAway Simple™. StashAway offers its service with no lock-up period, flexible deposits and withdrawals, and annual management fees between 0.2% and 0.8%. StashAway SimpleTM is not subject to any management fees.
StashAway was founded in 2016 in Singapore, and operates in Singapore and Malaysia. StashAway has a Capital Market Services License for Retail Fund Management from the Monetary Authority of Singapore, and a Capital Market Services License for Retail Fund Management from Securities Commission Malaysia. The company has raised $20.4 million USD in four funding rounds.