This third blog post is part of the series on Synapse — Alpha Reply's Platform for testing and stress-testing Financial Institutions Financial Crime Control Environment.
In the following you dig deeper into the software architecture of Synapse.
As per our last blog post, Synapse is being developed using Golang (https://golang.org) and relies on the agent based simulation model. In our case, this means instanting a set of agents that transact between themselves.
The simulation is initiated by a configuration file, which defines:
The second step is to instantiate a cache that contains the agents and to initiate various parameters for these agents.
Finally, the simulation starts, looping forward on the number of days specified in the configuration file. Each day, the simulation:
Although simple in theory, the implementation of the main loop is quite involved when one is optimising for speed. Hence, the loop involves carefully structured go-routines and cache mutexes who work together to achieve high parallelism (this will be the topic of a future post).
In the rest of this post, we will go over the design of the four key structures / interfaces (Agent, Aspect, Transactions and BalanceSheet).
The Agent is the key structure of Synapse and can represent an Individual, a Corporate or a Financial Institution (FI). The base structure contains mostly technical attributes and methods. Three different structures corresponding to Individual, Corporate and FI are then composed from the base Agent structure and define further agent type specific attributes (Golang does not have a concept of inheritance and instead relies on composition and interfaces for polymorphism).
Importantly, Agent structures have:
Aspects are the mechanism used to script our agents' Transaction Behaviour. Technically, an Aspect is an interface with a few methods, the main one being the "Tick" method whose aim is to return a slice of Transactions that fill the TransactionBuffer. The implementation of this method is where the implementation of the Agent's behaviour is done, and composing those (i.e adding and removing Aspects from an Agent is how we can achieve rich and dynamic behaviour scripting).
The BalanceSheet structure represents an agent's … balance sheet. The structure defines the various assets and liabilities of an agent and is updated on every loop to reflect the daily transactions that each agent undertook. Examples of Individual Agent Assets include CashAccounts, CurrentAccounts (with a pointer to a Bank FI), various Financial and non-Financial Assets.
Transactions are the key output of Synapse — along with Corporate and Individual Agents attributes (i.e. KYC information) — that is used by Synapse's users to test their Financial Crime Controls (transaction monitoring, customer risk scoring, etc…). Transactions have many types, each composing the base Transaction structure. Examples are cash transactions, ATMWithdrawal, CashDeposit, WireTransfer, LoanContract, POSDebitCardTransaction…
Importantly, each transaction defines how it applies to the Balance Sheet of the two parties of that transaction.
Taken together, those concepts allow Synapse to simulate realistic transactions that emanate from agents that act in an economically realistic way, accounting for their balance sheet positions at all times.
This post only covers the very high level structure of the program, and we will be digging into those various concepts in future ones. Next week, as requested by our readers, we will get into the details of a few key aspects used to script various consumption behaviours of individuals, as well as a first aspect used to emulate a typical money-laundering scheme.
If you would like to join us to improve Synapse coverage and assess how you can leverage it for your organisation, please contact us at