01-08-2024

Harmony Engine

harmony calculation

Numbers. They are everywhere. But numbers don’t mean much without knowing what they stand for. With 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 look at them in a certain context, for example your bank account. But what if these figures are the result of a complex calculation on a diverse data set, say the currency risk of an investment portfolio? How can you be absolutely sure that the figures and calculations are correct?

Most software applications, databases, and programming languages ​​do not understand units of measurement. This includes Excel and other software applications commonly used in the financial industry. They treat quantities as regular numbers without any meaning. This means that tools like Excel will easily add and multiply numbers, even if those operations are silly.

Just try it. Open Excel and enter a random number in two cells. Format the first number as Euro and the other as US Dollar. Then add those two numbers together in a third cell.

excel-

Excel will happily add the numbers together and even ‘intelligently’ display the result as Euro or US Dollar, depending on which field was referenced first in the formula. But that’s not how math works!

Mistakes are inevitable

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

Scary things.

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

Alloq’s Harmony engine understands units and takes them into account in every mathematical operation. The initial data set is loaded, along with units that indicate what each quantity means. Then we pass a series of calculations to Harmony to perform. The correct units are automatically assigned to the results.

The numbers don’t lie

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

At one point I saw a value indicated in USD²/EUR. This made me realize that I was doing 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 outcome. With the insight, I could easily adjust the formula to use division: USD / (USD/EUR) = EUR.

Shortly afterwards I saw a dollar amount on the screen while I was expecting a percentage (a unitless quantity) from another formula. In this case I simply selected the wrong variable to display and corrected it with a few keystrokes.

The detailed output of the Harmony engine allowed me to detect, locate and correct both errors in less than a minute. In other tools, such as Excel, it can take hours or days before you notice something is wrong with the result. In this specific example with values ​​such as the EUR-USD or EUR-GBP exchange rates, the error could go unnoticed even longer. That’s because these rates are relatively close to unity, so division or multiplication gives results that are roughly in the same ballpark.

Summary conclusion

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

1. The results are displayed in the correct units, which helps with initial verification of the results. When working with Euro inputs and expecting a US dollar outcome by applying exchange rates, you know something is wrong if the reported outcome is still in Euros.

2. The above Excel example adding two amounts in different currencies simply doesn’t work. When Harmony is told to add or subtract two numbers with different units, it stops immediately to avoid incorrect results. An error like this means that there is a fundamental error in the calculation rules.

3. In addition, Harmony returns an error message with exactly the specific calculation where it goes wrong. This makes tracing the cause much easier. 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 that you can trace all numbers back to the initially loaded data. Checks and audits become a lot easier because Alloq is not a black box.

We believe that Alloq as a solution for asset management from the inside should be correct. That’s why we developed the Harmony engine; we want to be able to trust that every calculation is mathematically correct and that every outcome is correct.