Bancor is really a suboptimal way to do a market maker for reasons explained here
We are opensourcing a market maker which is infinitely better than Bancor, it does not bleed money like Bancor and will save you lots of ETH. And it is completely free !!
The market maker has been created by one of our super smart student interns in Ukraine, here is documentation (in Russian at the moment, we are working on English version))
GexBot_documentation.pdf (124.1 KB)
Here is an English description:
The main purpose of GEXBot is to achieve liquidity of GEX vs. ETH.
Typically, when an asset is traded on an asset exchange, buyers post bids
(buy requests) and sellers post asks (sell offers).
If the asset is thinly traded, bids and asks become scarce, orders take long
time to complete and the price fluctuates strongly. Intuitively it is explained
by visualizing a picture, where buyers and sellers come to the market place
infrequently. When a seller comes to the marketplace there is no buyer, and
when the buyer comes to the marketplace, there is no seller.
To increase liquidity, we introduce GEXBot, an automated market maker that
is always available for transactions.
Let us first describe a very simple algorithm, where GEX sellers and ETH
sellers place their orders with GEXBot.
In particular,
(1) Intra-day, GEX sellers communicate orders to GEXBot, depositing
GEX coins to sell with GEXBot
(2) Intray-day, ETH sellers communicate orders to GEXBot, depositing
ETH coins to sell with GEXBot
(3) All order amounts are public
(4) At the end of the day, at time 0:00, GEXBot calculates GEX vs ETH
exchange rate by dividing the total GEX deposits by the total ETH
deposits
(5) GEXBot then distributes deposits according to the exchange rate,
transferring GEX to ETH sellers and ETH to GEX sellers
The algorithm described above can actually work quite well. The exchange
rate may fluctuate a bit against the exchange rate at external asset exchanges,
but since the order book is public, as time 0:00 approaches, arbitrage traders
will seek profit by issuing pairs of orders against GEXBot and against the
external exchange. As a result of this profit-seeking, the rate at the close time
0:00 will be reasonably in sync with external exchanges.
The main problem with the algorithm described above is that the participants have to wait until 0:00 to get the assets they want. Someone who needs
GEX services and has ETH in her waller will need to wait hours to get GEX.
This is clearly not tolerable.
The idea is to augment the algorithm above, so when the seller places an
order with GEXBot, GEXBot temporarily lends to the seller the asset that
the seller needs, assuming that the loan is repaid at the close time 0:00.
The question is then, how much can GEXBot lend to the seller without
assuming too much risk.
Let us consider an example, where the seller needs to sell 100 ETH for
GEX, and the exchange rate at the previous day close time is 2ET H = 1GEX
(1) The seller deposits 100 ETH with GEXBot.
(2) GEXBot immediately lends to the seller 50 GEX, hoping that the ex-
change rate at close will be the same, as it was yesterday at 0:00.
(3) Imagine the exchange rate drops, so at 0:00, 100 ETH = 47 GEX.
GEXBot will then realise a loss of 3 GEX, that will have to come out
of its GEX reserve.
As we see in the example above, if GEXBot lends to the seller at the
exchange rate of the previous day, GEXBot can incur a loss if the rate drops.
To compensate for these losses, let us require the seller to deposit a 20%
safety margin, since we know that most day-to-day price fluctuations are less
than 20%.
Then the modified algorithm works as follows:
(1) The seller deposits 120 ETH with GEXBot. Out of this, 100 GEX is
the principle, and 20 GEX is the safety margin
(2) GEXBot immediately lends to the seller 50 GEX, applying the previous
day’s exchange rate to the principle
(3) imagine, the rate drops, so at 0:00 one has, 100 ETH = 47 GEX
(4) GEXBot sells ETH for GEX. For 120 ETH it gets 56 ETH
(5) GEXBot then uses 50 GEX to cover the loan. The remaining 6 GEX
is transferred to the seller
As we see from the example above, the seller deposited 120 ETH, got 50
GEX immediately, and then 6 GEX as an adjustment at time 0:00.
The algorithm above is good for the seller, since the seller gets most of
GEX immediately, and ultimately gets the fair value in GEX.
GEXBot can incur a loss in the infrequent case where the rate drops more
than 20% day to day.
Lets consider an example the where the rate drops so much that,
GEXBot only gets 49 GEX at time 0:00. It is not enough to cover the previous
loan of 50 GEX, so the seller owes to GEXBot 1 GEX.
GEXBot will note this 1 GEX as an outstanding loan, and charge this 1
GEX from the seller the next time the seller comes to GEXBot to exchange
assets.
The seller may decide to never come back to GEXBot. In this case,
GEXBot loses 1 GEX, and the seller loses its reputation in the network and
its ability to easily exchange GEX for ETH.
Since the purpose of GEXBot is to provide GEX liquidity to users and
providers for service payments and not for market speculation, GEXBot will
impose exchange limits, that will depend on the reputation of the seller, as
well as on the amount of the service provided or used by the seller in the past.
The exchange limits will limit the losses that GEXBot can incur.
Yet, there will be cases where sellers will never come back and GEXBot will lose
reserves. To compensate for this average loss, GEXBot will charge transaction
fees on each transaction. The fees will be proportional of to the size of the
order multiplied by the fee rate. The fee rate starts with zero and goes up as
GEXBot starts depleting its reserves.