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

baip-0004.md #21

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions baip-0004.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
```
BAIP: 004
Title: Use 1 hours period EMA(6) to instead of BAIP2
Authors: shulthz
Status: Draft
Type: Consensus
Created: 2020-02-22
```

# Abstract
Use 1 hours period EMA(6) to instead of BAIP2

# Motivation
BAIP2 track the real-time price too slowly, when the price has plummeted, there will have a big discount space for bitasset, it need two days to repair the price, this will crush the confidence of the holder of bitasset, harm the bitasset.

EMA have a key point is more better than BAIP2: The EMA is a moving average that places a greater weight and significance on the most recent data points.

This FEED PRICE can track the real-time price more quickly, can avoid the lower shadow and repair price more faster(but still need one or two hours to repair).

The one hour will be cooling time.

Shorting attack will need more time to make the price down.

There still have a big discount space, so i think to add the Weighting factor * Current price to make the big discount space more smaller.

Weighting factor * Current price will increase the nondeterminacy of feed price.

# Rational

Follow the BSIP76 and BSIP58.

# Specifications

**FEED PRICE =max (Weighting factor * 1 hours period EMA(6) + Weighting factor * Current price,Current price)**

Current price : The real-time BTS price of CEX, and notice: we still have many feed provider give a most lower feed price of CEX.

1 hours period EMA(6): Get the latest bar data from CEX,then calculate out the EMA6.

Weighting factor: EMA(6) is the latest bar.
The Weighting factor of EMA(6)=EMA(6)/(X * current price + EMA(6)), We can try X=5 first,X=(1,10)

## Explanation:
As the EMA(6)come from the latest finished 1 hour bar, and the current price come from the next hour which the 1 hour bar didn't finish, so the feed price was constituted by a fixed EMA(6)in 1 hour and a variable current price.

If use proportion of weighting factor, the weighting factor of EMA(6)will be great when the price spread became great between EMA(6)and current price, the value of X will determine the upper limit, if the price spread became small, the weight of EMA(6) will become small followling.

proportion of weight X=6,data come from huobi 1hour EMA6,2020/02/15 22:00 to 2020/02/17 03:00

| EMA\(6\) | CEX PRICE | FEED PRICE | EMA WEIGHT | CEX weight | spread | FALL |
|-----------|---------|----------|----------|----------|----------|----------|
| 0\.0389 | 0\.0366 | 0\.0369 | 0\.1505 | 0\.8495 | 0\.9457% | 6\.28% |
| 0\.0385 | 0\.0332 | 0\.0341 | 0\.1620 | 0\.8380 | 2\.5856% | 15\.96% |
| 0\.0373 | 0\.034 | 0\.0345 | 0\.1546 | 0\.8454 | 1\.5003% | 9\.71% |
| 0\.0364 | 0\.0332 | 0\.0337 | 0\.1545 | 0\.8455 | 1\.4891% | 9\.64% |
| 0\.0359 | 0\.0346 | 0\.0348 | 0\.1474 | 0\.8526 | 0\.5539% | 3\.76% |
| 0\.0357 | 0\.0345 | 0\.0347 | 0\.1471 | 0\.8529 | 0\.5116% | 3\.48% |
| 0\.0354 | 0\.0346 | 0\.0347 | 0\.1457 | 0\.8543 | 0\.3368% | 2\.31% |
| 0\.0353 | 0\.0348 | 0\.0349 | 0\.1446 | 0\.8554 | 0\.2078% | 1\.44% |
| 0\.0352 | 0\.0346 | 0\.0347 | 0\.1450 | 0\.8550 | 0\.2514% | 1\.73% |
| 0\.035 | 0\.034 | 0\.0341 | 0\.1464 | 0\.8536 | 0\.4307% | 2\.94% |
| 0\.035 | 0\.0349 | 0\.0349 | 0\.1432 | 0\.8568 | 0\.0410% | 0\.29% |
| 0\.0351 | 0\.0351 | 0\.0351 | 0\.1429 | 0\.8571 | 0\.0000% | 0\.00% |
| 0\.0355 | 0\.0361 | 0\.0361 | 0\.1408 | 0\.8592 | 0\.0000% | \-1\.66% |
| 0\.0357 | 0\.0361 | 0\.0361 | 0\.1415 | 0\.8585 | 0\.0000% | \-1\.11% |
| 0\.0359 | 0\.0355 | 0\.0356 | 0\.1442 | 0\.8558 | 0\.1625% | 1\.13% |
| 0\.0358 | 0\.0355 | 0\.0355 | 0\.1439 | 0\.8561 | 0\.1216% | 0\.85% |
| 0\.0357 | 0\.0354 | 0\.0354 | 0\.1439 | 0\.8561 | 0\.1219% | 0\.85% |
| 0\.0357 | 0\.0351 | 0\.0352 | 0\.1449 | 0\.8551 | 0\.2478% | 1\.71% |
| 0\.0356 | 0\.035 | 0\.0351 | 0\.1450 | 0\.8550 | 0\.2485% | 1\.71% |
| 0\.0354 | 0\.0336 | 0\.0339 | 0\.1494 | 0\.8506 | 0\.8002% | 5\.36% |
| 0\.035 | 0\.0333 | 0\.0336 | 0\.1491 | 0\.8509 | 0\.7610% | 5\.11% |
| 0\.0345 | 0\.0332 | 0\.0334 | 0\.1476 | 0\.8524 | 0\.5781% | 3\.92% |
| 0\.0342 | 0\.0324 | 0\.0327 | 0\.1496 | 0\.8504 | 0\.8311% | 5\.56% |
| 0\.034 | 0\.0326 | 0\.0328 | 0\.1481 | 0\.8519 | 0\.6359% | 4\.29% |
| 0\.0337 | 0\.032 | 0\.0323 | 0\.1493 | 0\.8507 | 0\.7932% | 5\.31% |
| 0\.0333 | 0\.0301 | 0\.0306 | 0\.1557 | 0\.8443 | 1\.6551% | 10\.63% |
| 0\.0328 | 0\.0303 | 0\.0307 | 0\.1528 | 0\.8472 | 1\.2611% | 8\.25% |
| 0\.0323 | 0\.0317 | 0\.0318 | 0\.1452 | 0\.8548 | 0\.2748% | 1\.89% |
| 0\.0322 | 0\.0305 | 0\.0308 | 0\.1496 | 0\.8504 | 0\.8340% | 5\.57% |
| 0\.0317 | 0\.0305 | 0\.0307 | 0\.1476 | 0\.8524 | 0\.5809% | 3\.93% |



# Coordination
https://github.com/bitshares/bsips/issues/221
https://github.com/bitshares/baips/issues/4
https://github.com/bitshares/baips/issues/7
https://github.com/bitshares/bsips/blob/master/bsip-0042.md

# Summary for holders

# Discussion
https://bitsharestalk.org/index.php?topic=32153.msg341242#new
https://bitsharestalk.org/index.php?topic=32143.msg341235;topicseen#msg341235

# See also
Exponential Moving Average - EMA Definition: https://www.investopedia.com/terms/e/ema.asp
Inflation Index:https://www.imf.org/external/pubs/ft/spn/2010/spn1003.pdf
Weight:https://cn.bing.com/academic/profile?id=134466208&v=fos_preview

# Copyright

This document is placed in the public domain.