bsips icon indicating copy to clipboard operation
bsips copied to clipboard

BSIP78: Asset Feature - MLP2 (Market Liquidity Pool)

Open froooze opened this issue 5 years ago • 17 comments

BSIP: 078
Title: Asset Feature - MLP2 (Market Liquidity Pool Version 2)
Author: [bench] <https://github.com/froooze>
Status: Draft
Type: Protocol
Created: 2020-06-11

Abstract

  • MLP2 is an asset lending feature, to provide liquidity for asset exchanges, at the current price level
  • Simplified version of the Bancor Protocol without connector weight
  • Stepless liquidity with no order book for any asset pair
  • Blockchain as borrower and liquidity provider
  • BTS as central node and base currency
  • Market fees are shared to asset lender and blockchain

Motivation

  • User has no easy way to provide liquidity to markets
  • Most order books have low liquidity and high market spread
  • Order books are dependent on certain price levels

Rationale

  • Provide an easy, effective and robust liquidity feature for every user, asset and asset pair on the protocol level
  • Generate demand for BTS and income for BitShares Blockchain
  • The market fee provides the buy/sell spread to generates a profit on every asset swap
  • One asset deposit removes the counterpart risk of the other market pair

Solution

  • Every asset pair can have the MLP2 asset feature
  • The MLP2 asset feature is based on the x * y = k modell
  • x = amount_asset_X, y = amount_asset_Y, k = invariant
  • MLP2 is separated in passive and active liquidity, to allow one asset deposit/withdraw

Exchange

  • The ratio of amount_asset_X/ amount_asset_Y or price_asset defines the asset exchange rate
  • The invariant is not changed during the asset exchange
  • amount_asset_X * sqrt(price_X) = amount_asset_Y * sqrt(price_Y)

Passive liquidity

  • Passive liquidity gets created, when there is an unequal amount of assets, because only one asset was removed/added from/to the MLP2.
  • Passive liquidity needs an equal amount of the corresponding asset, to become active liquidity.
  • Passive liquidity, which was created by removing assets from MLP2, are prioritized for active liquidity over newly added assets.
  • The reduction of passive liquidity is defined by the smaller order of both assets.

Add/remove asset(s) from MLP2

Add an equivalent amount of both assets

  • No passive liquidity
  • No waiting time
  • Highest market fee share

add2-assets

Remove an equivalent amount of both assets

  • Passive liquidity is not changed

remove2-assets

Add only one asset

  • Instantly, when it is the inverse asset of the passive liquidity
  • Waiting time, when it is the asset of the passive liquidity
  • Lower market fee share

add1-assets

Remove only one asset

  • No waiting time
  • Active liquidity gets reduced
  • Passive liquidity can get increased or decreased

remove1-asset

MLP2 start values

MLP2-price1

MLP2 after quadruple BTS price or asset sell for half amount_BTS

MLP2-price2

MLP2 Charts

  • amount_BTS * amount_asset = invariant
  • sqrt(price_BTS) * amount_BTS = constant
  • sqrt(price_asset) * amount_asset = constant
  • price_BTS * price_asset = 1

MLP-price-chart

Fee structure

The asset owner, defines the fee structure for the MLP2 The market fee share to network is defined by the network.

BTS market pairs

  • Only paid in BTS
  • Only for BTS -> asset trading
  • Added partial after the exchange to the MLP2
  • Shared to both assets lenders

Other market pairs

  • Paid in both assets
  • Paid in both directions
  • Added both partial after the exchange to the MLP2
  • Shared to both asset lenders
  • Network cut gets settled by the corresponding BTS market pair

Example fee schedule

0.6% BTS -> asset market fee

  • 75% for the MLP2 asset holder (= 0.45%)
  • 5% for referral system (= 0.03%)
  • 5% for the reserve pool (= 0.03%)
  • 15% for the asset owner (= 0.09%)

0.3% asset -> asset market fee

  • 75% for the MLP2 asset holder (= 0.225%)
  • 5% for referral system (= 0.015%)
  • 5% for the reserve pool (= 0.015%)
  • 15% for the asset owner (= 0.045%)

Price Distribution

MLP2-price-gau

Network Example with different MLP asset features

MLP2-network

Market Dynamics

  • Every asset exchange uses the full inventory of the MLP2 asset feature
  • Every asset is backed by same value of the other asset
  • When BTS price decreases, demand for BTS is increased

MLP2 price changes

ROS = (Relative Order Size) = amount_order/active_mlp Premium on the exchange rate compared to the current price_asset

ROS Premium delta_price_asset
0.1% 0.1% 0.2%
1% 1% 2%
5% 5% 11%
10% 11% 23%
20% 25% 56%
50% 100% 400%

Orderbook

  • Supported with extra liquidity
  • Reduced market spread
  • Any trading pair can have liquidity with BTS as central node
  • Asymmetric market fee reduces asset/asset market spread

Price feed

The MLP2 asset feature is not only exchange feature, but also a price feed indicator, which oscillates around the market price.

Manipulation

  • Shorting BTS on MLP2 generates market fee and market spread
  • Shorting BTS generates extra demand for BTS
  • Arbitrage pays no market fee and gets an advantage to increase BTS price on DEX

Comparison

Lending options

Case MPLP MLP2 BSIP-70
Motivation interest rate market fee interest rate
Borrower peer blockchain peer
Input debt asset any asset or asset pair any asset
Purpose increase CR & debt increase liquidity lending/trading
Collateral no no yes
Order book no no yes

Implementation

Case MLP2 Uniswap2
Market fee a-/symmetric symmetric
Assets BTS assets ERC-20
Non-core markets yes yes
One asset support yes no
Fee share yes no

Specifications

Network_parameter

  • fee_share_for_reserve

MLP_parameters

  • asset_id
  • mlp_fee_rate
  • fee_share_asset
  • fee_share_mlp
  • fee_share_referral

MLP_object

  • asset_id
  • delta_asset_balance
  • user_id
  • mlp_function_id

MLP_asset_functions

x = active_amount_asset_X y = active_amount_asset_Y

x_p = passive_amount_asset_X y_p = passive_amount_asset_Y

Add both assets

if (y/x == delta_asset_X / delta_asset_Y) { x += delta_asset_X y += delta_asset_Y }

Add one asset

if (delta_asset == passive_asset) { mlp_passive += delta_asset }

if (delta_asset_1 != passive_asset) { mlp_passive -= delta_asset_2 mlp_active += delta_asset_1 }

Remove both assets

x -= delta_asset_X + market_fee_share_X y -= delta_asset_Y + market_fee_share_Y

market_fee_share = ∫(market_fees * mlp_share)dn

Remove one asset

if (delta_asset_1 == passive_asset) { mlp_active -= (delta_asset_1 + market_fee_share_1) mlp_passive += delta_asset_2 }

if (delta_asset_1 != passive_asset) { mlp_active -= (delta_asset_1 + market_fee_share_1) mlp_passive -= delta_asset_2 }

market_fee_share = ∫(mlp_fee_rate * fee_share_mlp * mlp_active/(mlp_active + mlp_passive))dn

Exchange BTS to asset

mlp_fee = amount_BTS * fee_rate_mlp * fee_share_mlp // calculate fee cut for MLP2 x += mlp_fee // add fee to MLP2 k = x * y // calculate invariant x += amount_BTS * (1 - fee_rate_mlp) // amount to exchange amount_asset = y - k / x // amount to return

Exchange asset to BTS

k = x * y // calculate invariant y += amount_asset // amount to exchange amount_BTS = x - k / y // amount to return

Exchange asset_1 to asset_2

mlp_fee = amount_asset_1 * fee_rate_mlp * fee_share_mlp // calculate fee cut for MLP2 x += mlp_fee // add fee to MLP2 k = x * y // calculate invariant x += amount_asset_1 * (1 - fee_rate_mlp) // amount to exchange amount_asset_2 = y - k / x // amount to return

Flow Chart

MLP2-flow

Discussion and Summary for Shareholders

  • This is a very important feature, to strengthen our infrastructure, use case and core token value
  • This enables every user to take part in value creation and earning market fees at the same time

Risks

  • The MLP2 can be seen as a fully automated exchange, which earns profits by market fees on every trade. When the exchange runs completely on blockchain, the risks are not higher, than the blockchain by itself.
  • The fixed connector weight ensures, there is no option to extract any value from the pool. When the pool price is different from market price, the arbitrage bots earn the difference minus corresponding fees.
  • With one asset deposit function on MLP2, there is no extra risk involved in holding the other trading pair. Through different supply and demand, one asset could be part of passive liquidity, which earn less market fees, than the other one.

Copyright

This document is placed in the public domain.

See Also

Sources

froooze avatar Sep 16 '19 23:09 froooze

@ryanRfox maybe assign 78 to this? Since 77 was assigned to #161

abitmore avatar Sep 26 '19 19:09 abitmore

This will add a huge amount of liquidity in circulation and act the same exact way as the centralized exchanges non-stop liquidity bots, it will help the BTS value and run the market dynamics.

ioBanker avatar Sep 27 '19 00:09 ioBanker

This looks very promising. I think the combination of this with BSIP 70 could simultaneously help attract both a) more traders and b) more liquidity providers, thus potentially kicking off a sustainable, virtuous cycle of liquidity and adoption.

Time is always of the essence (of course), but this actually seems more foundational than BSIP 70, so I am eager to see what some of the devs and others familiar with the platform's market mechanics think about it.

tbone-bts avatar Sep 30 '19 18:09 tbone-bts

Copying Uniswap is an interesting concept, but one I did not get until after I read several articles and then saw an Youtube interview with the founder. https://epicenter.tv/episode/292/

Uniswap is not an easy or fast concept to get. But once you get it is a very fascinating concept.

I have long been fascinated with Bancor. Bancor has some problems, but the market maker incentives spread between the liquidity providers forming a type of dividend for those providing liquidity which seems to work well in markets for small traders. It appears that crypto has brought out a number of interesting market making/order matching ideas that never really took off in other markets such as wall street or futures.

I think this approach needs further study and a better simpler presentation. This would help more widespread review. It might be better to point now comers to a less technical document somewhere. It would be a fundamental change in how the market works. The exchange using the concept is less that one year old and there are some people who now appearing to discovering and utilizing various strategies to optimize earnings and potentially exploiting a few loop holes.

The atmosphere in BitShares may not be right for serious consideration of the strategy now. (BitAsset settlement and the upvoting of refund 400K has stalled progress.)

I look forward to seeing what other traders think of this exciting concept.

CryptickCryptick1 avatar Sep 30 '19 20:09 CryptickCryptick1

@sschiessl-bcp

froooze avatar Oct 04 '19 13:10 froooze

@sschiessl-bcp

Have you changed anything in here?

sschiessl-bcp avatar Oct 07 '19 14:10 sschiessl-bcp

Have you changed anything in here?

Not really, what changed?

froooze avatar Oct 07 '19 15:10 froooze

@ryanRfox Can you comment on assigning this BSIP ?

froooze avatar Oct 16 '19 12:10 froooze

Anything that increases liquidity gets the thumbs up from me - not familiar with uniswap so not 100% clear on how it works at first reading.

Basically funds from multiple assets can be put in a shared liquidity pool and then the blockchain acts in the background as a sort of trustless bot / liquidity provider in the background providing swaps between the various assets that have contributed?

I'm a visual guy, a sketch would help 🙈

matle85 avatar Oct 20 '19 12:10 matle85

not familiar with uniswap so not 100% clear on how it works at first reading.

Uniswap is a simplified version of the Bancor Protocol, because it doesn't need a connector weight, to define the asset ratio. Uniswap uses the natural ratio from BTS/asset pair, which is indirect proportional to the price.

The MLP price dictates the exchange rate of an asset. When pool price is different from market price, the seller or buyer gets an advantage and MLP price gets closer to the market price.

Basically funds from multiple assets can be put in a shared liquidity pool and then the blockchain acts in the background as a sort of trustless bot / liquidity provider in the background providing swaps between the various assets that have contributed?

Yes, any asset can have a MLP and get a market pair with BTS, except BTS itself. The user can decide, which asset is supported with extra liquidity from MLP.

froooze avatar Oct 20 '19 16:10 froooze

I'm still missing explanatory text for people unfamiliar with the referenced concepts (like me). In particular, Abstract and Summary should provide more detail and be in prosa.

sschiessl-bcp avatar Oct 21 '19 07:10 sschiessl-bcp

I agree that the concept is difficult to understand without explanations in prose.

You should add a section that describes the effect on funds invested into the pool. As long as the assets oscillate around a more or less fixed base price everything is fine - investors participate in the fee income. As the trade price moves further away from the original investment price, the participation in the price appreciation (or loss) gets smaller and smaller. This may be seen as a pro or a con, depending on investment goals. :-) (For a pool consisting of assets A and B, and price p=B/A, the total value in terms of B is equal to SQRT(k*p), i. e. the total value doubles if the price quadruples.)

This also means that when BTS is in a downtrend against USD for example, then investors would probably remove their funds and then sell for USD to cut their losses. Similarly, if BTS is in an uptrend, investors would also withdraw their funds but sell USD for BTS to participate in BTS appreciation. It is therefore doubtful if the pool would help liquidity when it's needed the most.

A big bonus of this protocol over Bancor is that it works without costly log and exp computations.

pmconrad avatar Oct 21 '19 15:10 pmconrad

(For a pool consisting of assets A and B, and price p=B/A, the total value in terms of B is equal to SQRT(k*p), i. e. the total value doubles if the price quadruples.)

Yes, pool_value ~ sqrt(price_BTS)

Should we allow asset pairs without BTS as base pair? This would bring some flexibility and extra trading routes.

This also means that when BTS is in a downtrend against USD for example, then investors would probably remove their funds and then sell for USD to cut their losses. Similarly, if BTS is in an uptrend, investors would also withdraw their funds but sell USD for BTS to participate in BTS appreciation. It is therefore doubtful if the pool would help liquidity when it's needed the most.

Yes, this is always possible, but MLP is more for user, who don't want to trade or setup a DEXbot worker, but invest and earn passive income. Most funds on the blockchain are not on the orderbook and do nothing.

A big bonus of this protocol over Bancor is that it works without costly log and exp computations.

This and no need to set/use the connector weight parameter.

froooze avatar Oct 21 '19 23:10 froooze

Thanks - sounds like it would be a good addition and a nice method for people to assist in providing liquidity without running dexbot.

Have the team estimated the time for implementation? Maybe we can get a few people together committing to try it with some funds once its live?

matle85 avatar Oct 22 '19 20:10 matle85

Re: the discussion on base. I think we need to have a big focus on the tokenomics of bitshares moving forward so I think BTS should be at the centre of every new initiative.

On that basis I'd view the ideal solution being BTS as the base / background behind all asset pairs.

matle85 avatar Oct 23 '19 06:10 matle85

MLP version updated!

froooze avatar Aug 07 '20 13:08 froooze

If it's an "OIP" then I would like to close it. If it's a BSIP then please update wording in the interest of BitShares.

Actually, I didn't see why the mechanism would work (it should be in the "Rationale" section, see another comment above: https://github.com/bitshares/bsips/issues/213#issuecomment-544573281). Also, the document lacks of risk analysis for participants, only talked how they would earn, but no talk about how they would lose.

abitmore avatar Aug 08 '20 00:08 abitmore