Building Freetrade
Data Infrastructure at Freetrade
Principal Data Engineer Benen Cahill shares our process for data here at Freetrade.
13/1/2021
|
Benen Cahill
Building Freetrade
Principal Data Engineer Benen Cahill shares our process for data here at Freetrade.
13/1/2021
|
Benen Cahill
Building Freetrade
Principal Product Designer Caitlin Rich shares her top reads to help inspire good design and keep user experience front of mind.
14/1/2021
|
Caitlin Rich
Building Freetrade
Including some big name S&P 500 companies
21/12/2020
|
Sam Poullain
Building Freetrade
Software Engineer Theo Gregory shares how we use serverless to speed up deployment.
17/12/2020
|
Theodore Gregory
Building Freetrade
Senior Product Manager, Jani Kiilunen, shares how we work with the Freetrade community to build the product
17/12/2020
|
Jani Kiilunen
Building Freetrade
Including SAP, Credit Suisse, Ryanair, Trivago
10/12/2020
|
Sam Poullain
Building Freetrade
Brand new for Plus members
6/1/2021
|
Sam Poullain
Building Freetrade
Freetrade Head of Engineering, Invest, Tim Drew, shares how we scale our platform using Cloud Firestore
21/12/2020
|
Timothy Drew
Building Freetrade
Freetrade Software Engineering Manager Rokey Ge shares his virtual onboarding experience.
10/12/2020
|
Sam Poullain
Building Freetrade
A big improvement to Free Share is here.
10/12/2020
|
Sam Poullain
Building Freetrade
See how Freetrade compares to other brokers.
10/12/2020
|
Sam Poullain
Building Freetrade
Senior Software Engineer Jimmy Thompson takes you through the three layers of the Freetrade app
10/12/2020
|
Building Freetrade
Gold miners, Twinkies, McDonald's and more.
10/12/2020
|
David Kimberley
Building Freetrade
A new limit of £25,000 for US stocks.
10/12/2020
|
Sam Poullain
Building Freetrade
Including fixed income, investment-grade and government bonds.
10/12/2020
|
Sam Poullain
Building Freetrade
Freetrade VP Product Duncan Leslie on vision, strategy and measuring success.
10/12/2020
|
Duncan Leslie
Building Freetrade
Market cap, dividend yield, and P/E ratio are here.
10/12/2020
|
David Kimberley
Building Freetrade
Compare your performance against a global benchmark
10/12/2020
|
David Kimberley
Building Freetrade
10/12/2020
|
Viktor Nebehaj
Building Freetrade
Everything we plan to add to your app before the holidays.
10/12/2020
|
Sam Poullain
Building Freetrade
Freetrade engineer Simon Poole talks about overcoming some serverless infrastructure challenges.
10/12/2020
|
David Kimberley
Building Freetrade
From Papa John's to Zambian cattle farmers, we've added a wide array of new stocks to the Freetrade universe
10/12/2020
|
David Kimberley
Building Freetrade
Freetrade Talent Sourcer, Isabelle Atunrase, shares why we should all celebrate Black History Month, and some of the ways we’re getting involved here at Freetrade.
10/12/2020
|
Sam Poullain
Building Freetrade
Our biggest addition of ETFs yet.
10/12/2020
|
Alex Campbell
Building Freetrade
Freetrade Senior Product Managers Anant Sangar and Glenn Drawbridge have been busy working on limit orders and SIPPs. Here, they chat through how use User Story Mapping.
10/12/2020
|
David Kimberley
Building Freetrade
More of what you want.
10/12/2020
|
Alex Campbell
Building Freetrade
Introducing your expanded stock universe.
10/12/2020
|
Alex Campbell
Building Freetrade
More ways to measure your portfolio performance
10/12/2020
|
Sam Poullain
Building Freetrade
It’s now even easier to add money to your Freetrade account
10/12/2020
|
Sam Poullain
Building Freetrade
Freetrade Senior Product Manager Glenn Drawbridge shares his story.
10/12/2020
|
Sam Poullain
Building Freetrade
Find out what's inside, and request your invite.
10/12/2020
|
Duncan Leslie
Building Freetrade
Over 100 new stocks, including Kodak, La-Z-Boy, Tiffany & Co, and Crocs.
10/12/2020
|
David Kimberley
Building Freetrade
Amy joins Freetrade as our first Head of People.
10/12/2020
|
Sam Poullain
Building Freetrade
100 stocks inc. Avis, Tripadvisor, Goodyear, AMC Entertainment, Denny’s
10/12/2020
|
David Kimberley
Building Freetrade
The first of many additions to order types.
10/12/2020
|
Sam Poullain
Building Freetrade
75 new stocks including Ericsson, Yelp, Gfinity, Youdao
10/12/2020
|
Sam Poullain
Building Freetrade
Country-specific ETFs, and stocks from Wendy’s to Columbia
10/12/2020
|
Sam Poullain
Building Freetrade
100 brand new stocks and ETFs are here
10/12/2020
|
Sam Poullain
Building Freetrade
This week's 100 new stocks and ETFs might be the best batch yet.
10/12/2020
|
Sam Poullain
Building Freetrade
Ferrari, Honda, Canadian Railway, United Airlines, Canadian banks, ETFs, and more
10/12/2020
|
Sam Poullain
Building Freetrade
You can now own a piece of Ed Sheeran
10/12/2020
|
Sam Poullain
Building Freetrade
Cannabis companies have arrived
10/12/2020
|
Sam Poullain
Building Freetrade
The former entrepreneur will be Freetrade’s non-executive director
10/12/2020
|
David Kimberley
Building Freetrade
Find out more about how Free Share works
10/12/2020
|
David Kimberley
Building Freetrade
250 new US stocks have landed
10/12/2020
|
Viktor Nebehaj
Building Freetrade
You can now invest in a slice of US companies
10/12/2020
|
Viktor Nebehaj
Building Freetrade
Meet the person responsible for making Freetrade look cool
10/12/2020
|
David Kimberley
Freetrade does not provide investment advice and individual investors should make their own decisions or seek independent advice. The value of investments can go up as well as down and you may receive back less than your original investment. Freetrade is a trading name of Freetrade Limited, which is a member firm of the London Stock Exchange and is authorised and regulated by the Financial Conduct Authority. Registered in England and Wales (no. 09797821).
Copyright © 2020 Freetrade, All rights reserved. The Apple logo is a trademark of Apple Inc. App Store is a service mark of Apple Inc. Google Play and the Google Play logo are trademarks of Google LLC.
Made with 🍩 in London.
Freetrade Senior Software Engineer Luke Smith talks about the nuts and bolts of our brokerage platform
Invest by Freetrade is our proprietary investment platform, which we built from the ground up. Many requirements needed to be met to ensure we have accurate data and that the platform could scale to meet the growth of the company.
The platform also looks after your assets. This means it's the most important system we run and we have to make sure that every movement of cash and stock is accounted for.
We understood early on that having access to a stream of information about each account and order would provide us with the flexibility and insights needed to build a brokerage platform for the modern age.
Traditionally a relational database might be used, typically an SQL database, storing data normalised across multiple tables. The individual records are created, updated, or deleted, as necessary (known as CRUD operations). These records store only the current state of your data, as changes occur the history of it is lost. Looking at a record in this structure it is impossible to understand how, or more importantly why, the data reached this current state.
Using a basic table structure we can see that someone's account has a balance of 10, and this was updated on 1st January 2020. We can’t deduce any other information from this.
Event sourcing is different. Each change to your model is captured as an explicit event within what’s known as an aggregate. These events contain the data that is a side-effect of the operation, but importantly the name of each event gives an indication of why or what caused that change. Historical events are never mutated, with new events appended to the underlying store.
By storing explicit events we can see that the same account above had deposits, withdrawals, and trades made against it.
We end up with a balance of £10 as the current state. The current state does not need to be stored (we’ll discuss this more later), giving us a single source of truth about what happened to the account.
A benefit of this is we can also source the events to any historical point in time, meaning we can see what an account looked like at 4:22pm on Thursday 6th June 2019. This gives us more power and flexibility in investigating issues, but also helps us generate the compliance reports and statements a financial company must produce.
The number of events within a specific aggregate can grow over time. For orders, the lifetime is relatively short lived with a handful of events. But an account is a long life aggregate, which can grow to contain many thousands of events relatively quickly.
In order to scale and handle this we snapshot what an aggregate looks like on a periodic basis. This snapshot contains only the information necessary to make business decisions within the aggregate. When we need to load an aggregate we first load the snapshot, and then source any unseen events from the event store.
What's in an event
The anatomy of an event contains a lot of information about the outcome of an action. These are the business facts as a result of making a change.
Anything that was known, or calculated by the operation, at that point must be recorded on the event. If it’s not, you can assume it’s lost. This allows the event, and the information it provides, to be the truth for downstream processes to trust. For example, the stamp duty owed as a result of the order is recorded as a fact on an event.
Because Invest by Freetrade is an accounting platform at heart, it’s important that any transaction involving an asset is recorded following double-entry accounting principles. The events act as the method to record the transactions.
An event crediting an account with £100 would also contain information about the other party in the transaction (where the money is being debited from). Likewise the event recording the debit will contain details about the account being credited. Both tied together with a shared transaction reference.
When transactions occur between aggregates we don’t write the events to both at the same time. This would introduce contention in the platform. A customer account has relatively little throughput, but many of the system accounts are often involved in operations where in doing so would introduce a bottleneck that would leak its way back into the UX. As a result we delay when the transaction is recorded via a queue. This introduces the concept of eventual consistency.
We can verify the system is correct by replaying the events across the various accounts, and verifying that the system has eventually recorded both sides of the transaction. The sum of the credit + debit equals zero.
Hopefully this has given you an understanding of Invest by Freetrade, and some of the design decisions we made. Future posts will go into more detail around the challenges and solutions we’ve implemented around using event sourcing in a serverless architecture.