bitshares / baips

BitAssets Improvement Proposals
6 stars 8 forks source link

BAIP 2:Reform of loopholes in feed price mechanism #4

Open wenhuadream opened 5 years ago

wenhuadream commented 5 years ago
BAIP: 0002
Title: Reform of loopholes in feed price mechanism
Authors: cn-vote  bitshareschina@163.com
Status: Draft
Type: Consensus 
Created: 2019-10-22

Abstract

This BAIP defines reforms to the current feed price mechanism vulnerability. The specific program is: Thefeed price is the highest between the current price and the two-day moving average price .

Motivation

After the failure of BSIP42, the current feed price mechanism has major loopholes and serious negatives, many cex exchanges use our vulnerability to maliciously short,which seriously damaged the ecological balance, which caused us to suffer many unnecessary losses and hindered the development of the entire ecology. When the vulnerability has been expanded to be intolerable, in an emergency, the passage and execution of BSIP76 has temporarily blocked the expansion of the vulnerability. However, the current feed price mechanism is still in urgent need of reform.

Rational

"The feed price is the highest between the current price and the two-day moving average price ". This BAIP does not conflict with the previous consensus on the feed price of all the communities. The feed provider continue to collect the feed price according to the original community consensus, and the community consensus on the protection of the black swan(BSIP58) and the minimum feed price is continued(BSIP76). This BAIP only requires the introduction of the abstract described in the feed price script, which is "The feed price is the highest between the current price and the two-day moving average price ".

Specifications

Implementing measures

If (current price >  two-day moving average price) {
  feed price = current price;
}
Else{
  feed price = two-day moving average price;
}

Noun explanation

If the voting confirm the change, committee will announce the change at least 3 days before the change is implemented by feed provider.

Summary for Shareholders

This program is simple and effective, and can prevent malicious short-selling or increase malicious short-selling costs to a certain extent.

Discussion

https://github.com/bitshares/bsips/issues/244

See Also

https://bitsharestalk.org/index.php?topic=29698.0 https://bitsharestalk.org/index.php?topic=29699.0 https://bitsharestalk.org/index.php?topic=29635.0 https://bitsharestalk.org/index.php?topic=28418.0 https://bitsharestalk.org/index.php?topic=29684.0 https://bitsharestalk.org/index.php?topic=29687.0

Copyright

This document is placed in the public domain.

froooze commented 5 years ago

I always wondered if we could adopt Steem's moving average concept, but always though it wouldn't work well in combination with margin calls.

@xeroc Yes, we are in a dilemma. The ideal market would maximize margin calls in a downtrend and minimize margin calls in an uptrend. The MA (Moving Average) does the opposite, it minimize margin calls in a downtrend and maximize margin call in an uptrend.

We need a compromise between feed_price and market_price and smartcoin-Market Metrics should play a role here.

bitAsset-Market Metrics

@wenhuadream Why the use of MA and not another one?

Which Is The Best Moving Average?

wenhuadream commented 5 years ago

Why the use of MA and not another one?

  • Exponential moving average (EMA)
  • Double exponential moving average (DEMA)
  • Triple exponential moving average (DEMA)
  • Wilders moving average (WILDERS)
  • Weighted moving average (WMA)
  • Least squares moving average (linear regression)
  • Hull moving average (HMA)
  • Guppy multiple moving average (GMMA)

Which Is The Best Moving Average?

We have considered the final solution from many of the programs. As I said, it is not perfect, but it is very simple, effective, and effective. Even in the choice of MA, we also considered a variety of options, and ultimately only chose the simplest solution.

I said "we" because we are a team, a professional team.

I personally recommend that everyone pay attention: it is not perfect, simple, effective, and implement these words.

The feed price mechanism is a huge project and a particularly important mechanism that does not allow us to make mistakes.

I hope that everyone will think more about the failure of BSIP42. Then you will understand why we insist on this simple solution.

froooze commented 5 years ago

@wenhuadream

grctest commented 5 years ago

Discussion

bitshares/bsips#244

What discussions were had? This could instead be a "see also" link.

Could you create a pull request so that the individual lines can have their own threads? Responding to the issue with nested quotes is tiresome.

froooze commented 5 years ago

I did some benchmarks on different MA for price feed algorithm:

Longer EMA are faster than MA, but more robust against shorting attacks. The advantage gets lost in DEMA.

ioBanker commented 5 years ago

@froooze , can you please show me an example of how EMA would work?

froooze commented 5 years ago

@ioBanker take a look at: https://school.stockcharts.com/doku.php?id=technical_indicators:moving_averages

wenhuadream commented 5 years ago
  • How can we improve the margin call performance in an downtrend ? MA does not support margin calls here.

I have to say that this program is only to seek to solve the short-time malicious short

wenhuadream commented 5 years ago

What discussions were had? This could instead be a "see also" link.

Could you create a pull request so that the individual lines can have their own threads? Responding to the issue with nested quotes is tiresome.

Thanks for reminding

wenhuadream commented 5 years ago

I did some benchmarks on different MA for price feed algorithm:

  • MA -> too slow
  • EMA -> fine
  • DEMA -> too fast
  • TEMA -> way too fast

Longer EMA are faster than MA, but more robust against shorting attacks. The advantage gets lost in DEMA.

We have discussed thousands of discussions from the forum, and we have chosen ma in the summary of several months of debates, and we are striving for simplicity and effectiveness.

In fact, the feed price is a huge project, and there is no mistake. The cost of the error is huge (refer to BISP42), so we believe that it should be observed and summarized on a simple basis.

wenhuadream commented 5 years ago

IMHO, I have to complain about the progress of BAIP, I have been waiting for the establishment and implementation of BAIP standards, and now I finally saw the dawn.

froooze commented 5 years ago

We have discussed thousands of discussions from the forum, and we have chosen ma in the summary of several months of debates, and we are striving for simplicity and effectiveness.

Discussion does not solve the problem, but the right development and direction does. Your solution is simple, but not effective.

In fact, the feed price is a huge project, and there is no mistake.

History showed providing good price feeds is not an easy task and mistakes are very expansive.

Criteria for good price feeds are:

The cost of the error is huge (refer to BISP42), so we believe that it should be observed and summarized on a simple basis.

BSIP42 made clear, there is no simple solution for the price feed problem. Using MA based feed price causes the same problem of not selling collateral in a downtrend, which increases bad debt.

The good news is, we need only one working solution for our problem, which was recently found. Therefore a new BAIP Dynamic price feeds based on EMAs and smartcoin metrics is in the work.

wenhuadream commented 5 years ago

We have discussed thousands of discussions from the forum, and we have chosen ma in the summary of several months of debates, and we are striving for simplicity and effectiveness.

Discussion does not solve the problem, but the right development and direction does. Your solution is simple, but not effective.

In fact, the feed price is a huge project, and there is no mistake.

History showed providing good price feeds is not an easy task and mistakes are very expansive.

Criteria for good price feeds are:

  • minimize bad debt
  • minimize low selling of collateral
  • minimize margin calls

The cost of the error is huge (refer to BISP42), so we believe that it should be observed and summarized on a simple basis.

BSIP42 made clear, there is no simple solution for the price feed problem. Using MA based feed price causes the same problem of not selling collateral in a downtrend, which increases bad debt.

The good news is, we need only one working solution for our problem, which was recently found. Therefore a new BAIP Dynamic price feeds based on EMAs and smartcoin metrics is in the work.

Thank you very much for your participation in the discussion. You are also thinking hard. And give a very meaningful and level of advice.

EMA is also a solution we have considered. But we think MA is better than EMA. I have to say that our plan is more to prevent short-term malicious short-selling. At this level, what is needed is that in the process of falling current prices, if it is malicious short, it needs to slow down the price. The EMA weight is more biased towards the current price, that is, when the malicious decline, it will focus on the malicious falling weight, which we have always wanted to avoid. Another point, I want to say is that we also fully considered the anchoring situation of smartcoin, so the program chose for two days. I think our ideas have something in common, but I insist that MA works better than EMA. What I have to remind is, what problems do we need to solve? Why is there a BAIP? I think everyone knows why. This is the point we deserve to think about and pay attention to.

grctest commented 5 years ago

I think our ideas have something in common, but I insist that MA works better than EMA.

Can you provide evidence to back up your hypothesis that MA works better than EMA?

Why is there a BAIP? I think everyone knows why.

Disagree, the motivation, rationale and discussion do not yet fully justify the proposed changes.

froooze commented 5 years ago

I have to say that our plan is more to prevent short-term malicious short-selling. At this level, what is needed is that in the process of falling current prices, if it is malicious short, it needs to slow down the price.

Yes, we need a solution for short term price manipulation.

The EMA weight is more biased towards the current price, that is, when the malicious decline, it will focus on the malicious falling weight, which we have always wanted to avoid.

Yes, but EMA does the same thing here. EMA price is in a downtrend higher than market price, but improves margin call performance.

I think our ideas have something in common, but I insist that MA works better than EMA.

Yes, the idea to use different price feeds for different situations, is a good approach. The combination of different EMAs showed the best results.

What I have to remind is, what problems do we need to solve?

ma-vs-ema

The time frame of the EMA has a higher impact on the course of the curve, than the exponential part in the calculation.

red -> fast EMA yellow -> 2day MA green -> slow EMA

On the one side the fast EMA allows better collateral selling than the MA, on the other side the fast EMA is at the end not lower than the MA.

The slow EMA (also part of the price feed) reduces shorting attack compared to the 2 day MA.

Therefore: Dynamic price feeds based on EMAs and smartcoin metrics

zhouxiaobao-2010 commented 5 years ago

I hope this BAIP can enter the voting phase as soon as possible. This is the simplest and easiest program to implement.

zhouxiaobao-2010 commented 5 years ago

Assigned BAIP2 please creat a PR

froooze commented 5 years ago

This is the simplest and easiest program to implement.

Simple is not a criteria, criteria are robustness against manipulation and margin call performance. None is solved by one MA! If there is an easy solution, why do we wait 5 years for implementation? You want to wreck the collateral like BSIP42 did?

Complexity and integration is not a problem, because price feeds are not part of the core code.

wenhuadream commented 5 years ago

This is the simplest and easiest program to implement.

Simple is not a criteria, criteria are robustness against manipulation and margin call performance. None is solved by one MA! If there is an easy solution, why do we wait 5 years for implementation? You want to wreck the collateral like BSIP42 did?

Complexity and integration is not a problem, because price feeds are not part of the core code.

MA certainly can't solve all the problems, but please pay attention to the key points that BAIP wants to solve: short-term malicious shorting. How much did we pay for this loophole? ! How many ecological developments have been hindered? How many communities' old btser are disappointed to leave?

To prevent short-term malicious shorts, there is no doubt that it is effective. Sometimes we should pay more attention to the main focus of the program.

Benefits outweigh!

wenhuadream commented 5 years ago

Assigned BAIP2 please creat a PR

I have already done this, thank the committee

shulthz commented 5 years ago

A slow feed price feedback is right for the quick downtrend, people still can chose to sell the debt freely as the price which they wish. MA is more suitable. This BSIP is not perfect, but it can realize its function simply and solve the problem now we face, it didn't have big problem like BSIP42.

I have checked the #7, it still has many undefined parameters need to define, i think some of them hard to define or need much time to discuss. #7 may be another good solution.

6 different market states for price feed calculation 2 different market state parameters ( state_value & transition_value) 4 different market conditions for market state transition smartcoin metrics (collateral sell/buy)

The most lack is time for us, we can make #4 as the first edition to solve the problem now we face, then we will have much time and energy to make a better edition, or we will make a Bounty for the feed price script in the future, we should have different script to increase fault tolerance.

What we need is a perfect and robust mechanism, feed price is only one problem of these. Treat critically ill patient, flash heal to make he survive is the first thing, then we could have the time and chance to make a intensive therapy.

froooze commented 5 years ago

A slow feed price feedback is right for the quick downtrend, people still can chose to sell the debt freely as the price which they wish.

Most collateral positions are only sold, until they are getting margin called at market price.

MA is more suitable.

Why? The time frame has a higher impact than the used MA.

This BSIP is not perfect, but it can realize its function simply and solve the problem now we face, it didn't have big problem like BSIP42.

It has the same flaw as BSIP42, because margin calls do not work in a downtrend.

I have checked the #7, it still has many undefined parameters need to define, i think some of them hard to define or need much time to discuss. #7 may be another good solution.

All parameters, equations, conditions and transition routs are defined, but I don't see any benefits to open source the code now. The basic concept and vision should be clear and understandable.

The most lack is time for us, we can make #4 as the first edition to solve the problem now we face, then we will have much time and energy to make a better edition, or we will make a Bounty for the feed price script in the future, we should have different script to increase fault tolerance.

My solution is also quick, because development is completed.

What we need is a perfect and robust mechanism, feed price is only one problem of these.

Yes, the other key points are p2p borrowing for margin positions (MPLP) and extra liquidity (MPL)

shulthz commented 5 years ago

This is the choice of people.

Two-day moving average price just use the of price of the MA, not is MA 2. It is different with BSIP42, BSIP42 is a negative feedback, this is the main problem of BSIP 42, this BSIP just make the feed price down slowly, didn't have any feedback. Maybe your solution is good, but it's not clear enough than this BSIP, maybe we will make a bounty of feed price script in the further.

froooze commented 5 years ago

Maybe your solution is good, but it's not clear enough than this BSIP, maybe we will make a bounty of feed price script in the further.

You are free to ask any questions about my BAIP and make things more clear.

grctest commented 5 years ago

This is the choice of people.

No network consensus has been achieved, there hasn't been full review of the pull request nor this issues discussion complete, so this isn't the choice of all people yet.

shulthz commented 5 years ago

This is the choice of people.

No network consensus has been achieved, there hasn't been full review of the pull request nor this issues discussion complete, so this isn't the choice of all people yet.

You should understand what is the "choice", and you did not get what i say.

froooze commented 5 years ago

I would also support a simple solution for the first improvement, before my advanced solution can be integrated.

But without accepting critics and changing important things, this gets unnecessary harder, than it should be.

ljk424 commented 5 years ago

support the choice of people.