bitshares / bsips

BitShares Improvement Proposals and Protocols. These technical documents describe the process of updating and improving the BitShares blockchain and technical ecosystem.
https://bitshares.github.io
63 stars 86 forks source link

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

Open froooze opened 5 years ago

froooze commented 5 years ago
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

Motivation

Rationale

Solution

Exchange

Passive liquidity

Add/remove asset(s) from MLP2

Add an equivalent amount of both assets

add2-assets

Remove an equivalent amount of both assets

remove2-assets

Add only one asset

add1-assets

Remove only one asset

remove1-asset

MLP2 start values

MLP2-price1

MLP2 after quadruple BTS price or asset sell for half amount_BTS

MLP2-price2

MLP2 Charts

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

Other market pairs

Example fee schedule

0.6% BTS -> asset market fee

0.3% asset -> asset market fee

Price Distribution

MLP2-price-gau

Network Example with different MLP asset features

MLP2-network

Market Dynamics

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

Price feed

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

Manipulation

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

MLP_parameters

MLP_object

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

Risks

Copyright

This document is placed in the public domain.

See Also

Sources

abitmore commented 5 years ago

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

ioBanker commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

@sschiessl-bcp

sschiessl-bcp commented 5 years ago

@sschiessl-bcp

Have you changed anything in here?

froooze commented 5 years ago

Have you changed anything in here?

Not really, what changed?

froooze commented 5 years ago

@ryanRfox Can you comment on assigning this BSIP ?

matle85 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

(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 commented 5 years ago

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 commented 5 years ago

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 commented 4 years ago

MLP version updated!

abitmore commented 4 years ago

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.