On Fair Compromise in Price Matching Engines

Max Kaye <m@xk.io>

October 2014

Abstract

We show a fair compromise between two prices is the geometric mean of the two, not the arithmetic mean.
Two parties, A and B, wish to trade. A has u1s and B has u2s. They determine that an agreeable price should have one important property: that they are benefited equally by the trade. They further decide the benefit should be measured in capital growth. Because they wish to derive their price without external bias, they accept a fair price must be judged against their own expectations. In order to determine some measure of growth, they agree it can be replaced with their improvement over their worst acceptable situation, provided it was actually an improvement [A]  [A] This isn’t technically required, if a trade needed to occur this method also provides a valid conclusion, however, this is being considered in the context of a matching engine.. This represents the perceived benefit or incentive for each party.
(1) (Aactual, end)/(Aexpected, end) = (Bactual, end)/(Bexpected, end)
They each have a worst-case price in their head, such that pa > pb in units of u1u2 (where A is buying u2s, and B is selling them, so A is willing to pay more than B is asking). This inequality ensures that A always gets more u2s than they expect, and B always gives away less than expected (per u1, that is). Thus, both parties gain.
They agree there exists some fair price p such that pa > p > pb.
They also agree the following relationship between start and end balances holds true:
(2) (Au1, start)/(p) = Au2, end; Bu2, startp = Bu1, end
Since pactual = p, and pexpected = pa (or pb), (1↑) and (2↑) give us
((Au1, start)/(p))/((Au1, start)/(pa)) = (Bu2, startp)/(Bu2, startpb)
(3) (pa)/(p) = (p)/(pb)
(4) p = (papb)
Thus, we see with (4↑) that a fair price is the geometric mean of both prices.

Arithmetic Mean

If we use the arithmetic mean instead of the geometric mean, we set p = (pa + pb)/(2), and thus using (1↑) and (2↑) we see that instead of (3↑) we find:
(5) LHS  =  (pa)/((pa + pb)/(2))  =  (2pa)/(pa + pb)  =  (4papb)/(2pb(pa + pb)) RHS  =  (pa + pb)/(2pb)  =  ((pa + pb)2)/(2pb(pa + pb)) but 2pb(pa + pb)(RHS − LHS)  =  (pa + pb)2 − 4papb  =  (pa − pb)2  >  0 ifpa ≠ pb Therefore,  2pb(pa + pb)(RHS − LHS)  >  0 RHS − LHS  >  0 RHS  >  LHS
This inequality shows that the person with the lower price is disproportionately benefited (gains more) by using the arithmetic mean.
Additionally, the arithmetic average of pa and pb is not equal to the reciprocal of the average of (1)/(pa) and (1)/(pb); their geometric averages, however, have this property. In a matching engine this means there is no bias provided by the base currency pair.