mtbc: maze I (white-red)
[personal profile] mtbc
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

December 2025

S M T W T F S
 12 3456
78910111213
14 15161718 19 20
21222324252627
28293031   

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Dec. 29th, 2025 05:43 pm
Powered by Dreamwidth Studios