Feb. 6th, 2025

mtbc: maze I (white-red)
At work, I had to learn about a particular distributed cryptocurrency exchange. Liquidity is provided by set of reserves that each contain coins of two different kinds, an equal value of each.

For pricing an exchange "from" the coin we hold "to" the coin we want, using one of these reserves of two different kinds of coin, we have:
rf
how much of the "from" coin is in the reserve
rt
how much of the "to" coin is in the reserve
af
how much of the "from" coin we want to exchange
at
how much of the "to" coin we are to receive
cn
a constant determining the transaction cost
cd
another constant determining the transaction cost, a little larger than cn
It turns out that we decide how much currency users receive by,

at = (af × rt × cn) / (af × cn + rf × cd)

I found this quite interesting. In my ignorance, I don't know if it's a standard approach for such currency exchanges. The formula seems to have some reasonable properties, in terms of things like how the price increases as one's swapping to a currency that there is now less of (or would be less of after the swap).

(Dreamwidth doesn't appear to allow <math> markup so I did what I could.)

Profile

mtbc: photograph of me (Default)
Mark T. B. Carroll

May 2025

S M T W T F S
    123
456 78910
11 121314 15 16 17
18 19202122 2324
25262728293031

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated May. 24th, 2025 11:40 pm
Powered by Dreamwidth Studios