Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BSIP78: Asset Feature - MLP2 (Market Liquidity Pool) #213

Open
froooze opened this issue Sep 16, 2019 · 17 comments
Open

BSIP78: Asset Feature - MLP2 (Market Liquidity Pool) #213

froooze opened this issue Sep 16, 2019 · 17 comments
Labels
chain utility Make use of the blockchain profitability / fees

Comments

@froooze
Copy link

froooze commented Sep 16, 2019

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 froooze changed the title New BSIP: Market liquidity pool New BSIP: MLP (Market Liquidity Pool) Sep 26, 2019
@froooze froooze changed the title New BSIP: MLP (Market Liquidity Pool) BSIP77: MLP (Market Liquidity Pool) Sep 26, 2019
@abitmore
Copy link
Member

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

@froooze froooze changed the title BSIP77: MLP (Market Liquidity Pool) BSIP78: MLP (Market Liquidity Pool) Sep 26, 2019
@ioBanker
Copy link
Member

ioBanker commented Sep 27, 2019

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.

@tbone-bts
Copy link

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.

@CryptickCryptick1
Copy link

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.

@froooze
Copy link
Author

froooze commented Oct 4, 2019

@sschiessl-bcp

@sschiessl-bcp
Copy link
Collaborator

@sschiessl-bcp

Have you changed anything in here?

@froooze
Copy link
Author

froooze commented Oct 7, 2019

Have you changed anything in here?

Not really, what changed?

@froooze
Copy link
Author

froooze commented Oct 16, 2019

@ryanRfox
Can you comment on assigning this BSIP ?

@matle85
Copy link

matle85 commented Oct 20, 2019

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 🙈

@froooze
Copy link
Author

froooze commented Oct 20, 2019

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.

@sschiessl-bcp
Copy link
Collaborator

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.

@pmconrad
Copy link
Contributor

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.

@froooze
Copy link
Author

froooze commented Oct 21, 2019

(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.

@matle85
Copy link

matle85 commented Oct 22, 2019

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
Copy link

matle85 commented Oct 23, 2019

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.

@froooze froooze changed the title BSIP78: MLP (Market Liquidity Pool) BSIP78: Asset Feature MLP (Market Liquidity Pool) Oct 28, 2019
@froooze froooze changed the title BSIP78: Asset Feature MLP (Market Liquidity Pool) BSIP78: Asset Feature - MLP (Market Liquidity Pool) Nov 4, 2019
@abitmore abitmore added profitability / fees chain utility Make use of the blockchain labels Feb 29, 2020
@froooze froooze changed the title BSIP78: Asset Feature - MLP (Market Liquidity Pool) BSIP78: Asset Feature - MLP2 (Market Liquidity Pool) Aug 7, 2020
@froooze
Copy link
Author

froooze commented Aug 7, 2020

MLP version updated!

@abitmore
Copy link
Member

abitmore commented Aug 8, 2020

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: #213 (comment)). Also, the document lacks of risk analysis for participants, only talked how they would earn, but no talk about how they would lose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chain utility Make use of the blockchain profitability / fees
Projects
None yet
Development

No branches or pull requests

8 participants