### Persoonlijke demo

• This field is for validation purposes and should be left unchanged.
25-05-2023

# Harmony engine

Numbers. They are everywhere. But numbers don’t mean much without knowing what they represent. Having 20,000 in your bank account… are those Euros or Japanese Yen? The first can buy you a small car, the second a dinner for two. The unit of a quantity, in this case the currency, is an important detail.

You often know what the numbers mean when you’re looking at them in a certain context, say, your bank account. But what if these numbers are the outcome of a complex calculation on a diverse data set, let’s say the currency exposure of an investment portfolio? How can you be absolutely sure that the numbers and calculations are correct?

Most software applications, databases, and programming languages don’t have any understanding of units of measurement. This includes Excel and other software applications commonly used in the financial industry. They treat quantities as plain numbers without any significance. This means that tools like Excel will simply add and multiply numbers even if those operations don’t make any sense.

Just give it a try. Open up Excel and enter any number in two cells. Format the first number as Euros and the other as US Dollars. Then, in a third cell, add those two numbers together.

Excel will happily add the numbers together and even ‘intelligently’ display the result as either Euros or US Dollars, depending on which field was referenced in the formula first. But that’s not how maths work!

## Mistakes are unavoidable

Large corporations that manage billions worth of assets are running on such systems that don’t even understand the very basic rules of mathematics. Of course, they have all sorts of processes, checks, and audits in place to mitigate errors, but these are often expensive and time-consuming. These are human checks and people tend to make mistakes from time to time. And those people use the same kind of fundamentally flawed software to run their checks.

Scary stuff.

When we started building Alloq, we aimed to make allocation management processes more robust and faster. Part of that is facilitating the human side of the process. At the same time, we also wanted to tackle the fundamental problem illustrated above; we wanted to create software that can do the math properly. That’s why we iteratively built the Harmony engine that lies at the heart of the calculations performed in Alloq.

The Harmony engine of Alloq understands units of measurement and takes those into account with every mathematical operation. The initial data set is loaded, along with units that indicate what every quantity means. After that, we tell Harmony to perform a set of calculations on that data. The outcomes will automatically have the proper units assigned.

## The numbers don’t lie

When I was working with the Harmony engine to calculate the currency exposure of a pension fund, these features saved me quite some time. I’m only human, so I made a few mistakes when setting up the calculations.

At one point I saw a value that was denoted in USD²/EUR. This made me realize I did something wrong with the EUR-USD exchange rate. I wanted to convert US Dollars to Euros and instead of dividing by the EUR-USD rate (which has a unit of USD/EUR, or ‘USD per EUR’) I multiplied by the exchange rate: USD × USD/EUR = USD²/EUR. I immediately realized my mistake when I saw this unexpected unit and changed the formula to use division instead: USD / (USD/EUR) = EUR.

Shortly after that, I saw an amount in Euros on screen whereas I was expecting to see a percentage (a unitless quantity) from a different formula. In this case, I simply selected the wrong variable to be displayed on my screen and corrected it in a few keystrokes.

I was able to spot, locate, and correct both of these mistakes in less than a minute, thanks to the detailed output of the Harmony engine. In other tools such as Excel, it could take hours or days to even notice something is wrong with the outcome. In this particular example with values like the EUR-USD or EUR-GBP exchange rates, the mistake could go unnoticed even longer. That’s because these rates are relatively close to one, so either division or multiplication will give results that are roughly in the same ballpark.

## To sum it up

The Harmony engine understands the meaning of the numbers in your data and abides by the rules of mathematics, something that most software doesn’t do. This has several powerful benefits:

1.  The outcomes are displayed in the correct units of measurement, which help to do a first verification of the results. If you’re working with inputs in Euros and expect an outcome in US Dollars by applying exchange rates, you know something is wrong if the reported outcome is still denoted in Euros.

2. The Excel example above where two amounts in different currencies are added will simply not work. If Harmony is instructed to add or subtract two quantities with different units, it will immediately halt to prevent incorrect outcomes. An error like this implies that there is a fundamental flaw in the logic of the calculations that needs to be revised, or the input data is incorrect.

3. On top of that, Harmony outputs an error message detailing which specific calculation was incorrect and why making it easy to locate and fix the cause of the error.
Even without input data, Harmony can perform dimensional analysis on the calculations to detect errors and infer the type of outcome.

4. All intermediate calculation steps are available in Alloq, so you can trace back all the numbers that led to an outcome. Checks and audits are a lot easier this way because Alloq is no black box.

We believe Alloq as an asset management tool needs to be correct from the inside out. That’s why we developed the Harmony engine; we want to be able to trust that every calculation is mathematically sound and that every outcome is correct.