bitshares / bitshares/baips

BAIP4: Use 1 hours period EMA(6) to instead of BAIP2

Open
#12 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
6
Forks
8
PR merge metrics
No merged PRs in 30d

Description

```
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 tracks the CEX real-time price too slowly, when the CEX price began to move downward, there will appear a big price discount between DEX and CEX, and it needs two days to repair the bts price discount between DEX and CEX, this will crush the confidence of the bitasset and harm the reputation of bitasset very easily,and when the price become continuously falling,then the pirce discount will be very greater,this is very dangerous for the bitassets market.

# Rational

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 new FEED PRICE mechanism can track the CEX real-time price very quickly, and can avoid the lower shadow of price,repair price between DEX and CEX more faster(but still need one or two hours to repair).This repairing price time will be a cooling time for the traders in the bitassets market,and can prevent many unnecessary margin called by the lower shadow of price.

The debt Shorting attack will need more time to make the price fall.

To avoid the big price discount between DEX and CEX on price quick falling, so add the **Weighting factor * Current price** to make the big price discount become more smaller,and **Weighting factor * Current price** will increase the nondeterminacy of feed price,this is very important for trading.

# Specifications

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

***Adjustment factor: X,X=(1,10).***

***The Weighting factor of EMA(6) = EMA(6)/(X * current price + EMA(6)), We can try X=4.5 first.***

Current price : The real-time BTS price of CEX;

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

## Explanation:

As the EMA(6)pirce 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 latest finished 1 hour bar EMA(6)pirce and a variable current price.

Using proportion of weighting factor, the weighting factor of EMA(6)will become great when the price spread became big between EMA(6)and current price,if the price spread became small between EMA(6)and current price,the weight of EMA(6) will become small followling.

The value of X will determine the upper limit of weighting factor.

## Example:

Adjustment factor X=4.5,data come from huobi 1 hour EMA6,2020/02/15 22:00 to 2020/02/17 03:00

![2020-03-05 16_02_48-Window](https://user-images.githubusercontent.com/34892308/75960531-2a6fe580-5efb-11ea-880e-bcd7d82d7ab3.png)

| EMA\(6\) | CEX PRICE | FEED PRICE | EMA WEIGHT | CEX weight | spread | FALL |
|-----------|---------|----------|----------|----------|----------|----------|
| 0\.0389 | 0\.0366 | 0\.0370 | 0\.1911 | 0\.8089 | 1\.2007% | 6\.28% |
| 0\.0385 | 0\.0332 | 0\.0343 | 0\.2049 | 0\.7951 | 3\.2709% | 15\.96% |
| 0\.0373 | 0\.034 | 0\.0346 | 0\.1960 | 0\.8040 | 1\.9024% | 9\.71% |
| 0\.0364 | 0\.0332 | 0\.0338 | 0\.1959 | 0\.8041 | 1\.8883% | 9\.64% |
| 0\.0359 | 0\.0346 | 0\.0348 | 0\.1874 | 0\.8126 | 0\.7040% | 3\.76% |
| 0\.0357 | 0\.0345 | 0\.0347 | 0\.1870 | 0\.8130 | 0\.6503% | 3\.48% |
| 0\.0354 | 0\.0346 | 0\.0347 | 0\.1852 | 0\.8148 | 0\.4283% | 2\.31% |
| 0\.0353 | 0\.0348 | 0\.0349 | 0\.1839 | 0\.8161 | 0\.2643% | 1\.44% |
| 0\.0352 | 0\.0346 | 0\.0347 | 0\.1844 | 0\.8156 | 0\.3198% | 1\.73% |
| 0\.035 | 0\.034 | 0\.0342 | 0\.1862 | 0\.8138 | 0\.5476% | 2\.94% |
| 0\.035 | 0\.0349 | 0\.0349 | 0\.1822 | 0\.8178 | 0\.0522% | 0\.29% |
| 0\.0351 | 0\.0351 | 0\.0351 | 0\.1818 | 0\.8182 | 0\.0000% | 0\.00% |
| 0\.0355 | 0\.0361 | 0\.0361 | 0\.1793 | 0\.8207 | 0\.0000% | \-1\.66% |
| 0\.0357 | 0\.0361 | 0\.0361 | 0\.1802 | 0\.8198 | 0\.0000% | \-1\.11% |
| 0\.0359 | 0\.0355 | 0\.0356 | 0\.1835 | 0\.8165 | 0\.2068% | 1\.13% |
| 0\.0358 | 0\.0355 | 0\.0356 | 0\.1831 | 0\.8169 | 0\.1547% | 0\.85% |
| 0\.0357 | 0\.0354 | 0\.0355 | 0\.1831 | 0\.8169 | 0\.1551% | 0\.85% |
| 0\.0357 | 0\.0351 | 0\.0352 | 0\.1844 | 0\.8156 | 0\.3151% | 1\.71% |
| 0\.0356 | 0\.035 | 0\.0351 | 0\.1844 | 0\.8156 | 0\.3160% | 1\.71% |
| 0\.0354 | 0\.0336 | 0\.0339 | 0\.1897 | 0\.8103 | 1\.0163% | 5\.36% |
| 0\.035 | 0\.0333 | 0\.0336 | 0\.1893 | 0\.8107 | 0\.9666% | 5\.11% |
| 0\.0345 | 0\.0332 | 0\.0334 | 0\.1876 | 0\.8124 | 0\.7346% | 3\.92% |
| 0\.0342 | 0\.0324 | 0\.0327 | 0\.1900 | 0\.8100 | 1\.0556% | 5\.56% |
| 0\.034 | 0\.0326 | 0\.0329 | 0\.1882 | 0\.8118 | 0\.8080% | 4\.29% |
| 0\.0337 | 0\.032 | 0\.0323 | 0\.1896 | 0\.8104 | 1\.0075% | 5\.31% |
| 0\.0333 | 0\.0301 | 0\.0307 | 0\.1973 | 0\.8027 | 2\.0979% | 10\.63% |
| 0\.0328 | 0\.0303 | 0\.0308 | 0\.1939 | 0\.8061 | 1\.5999% | 8\.25% |
| 0\.0323 | 0\.0317 | 0\.0318 | 0\.1846 | 0\.8154 | 0\.3494% | 1\.89% |
| 0\.0322 | 0\.0305 | 0\.0308 | 0\.1900 | 0\.8100 | 1\.0592% | 5\.57% |
| 0\.0317 | 0\.0305 | 0\.0307 | 0\.1876 | 0\.8124 | 0\.7382% | 3\.93% |

Adjustment factor X=4.5,data come from ZB,2020-02-26 08:00 到 2020-02-26 13:00

![2020-03-05 16_07_48-Window](https://user-images.githubusercontent.com/34892308/75960720-8470ab00-5efb-11ea-890f-780776092c1f.png)

| EMA\(6\) | CEX PRICE | FEED PRICE | EMA WEIGHT | CEX weight | spread | FALL |
|-----------|---------|----------|----------|----------|-----------|---------|
| 0\.2069 | 0\.185 | 0\.1894 | 0\.1991 | 0\.8009 | 2\.3564% | 11\.84% |
| 0\.2036 | 0\.1429 | 0\.1575 | 0\.2405 | 0\.7595 | 10\.2148% | 42\.48% |
| 0\.1961 | 0\.1725 | 0\.1773 | 0\.2017 | 0\.7983 | 2\.7592% | 13\.68% |
| 0\.1905 | 0\.175 | 0\.1780 | 0\.1948 | 0\.8052 | 1\.7252% | 8\.86% |
| 0\.1875 | 0\.1778 | 0\.1796 | 0\.1899 | 0\.8101 | 1\.0358% | 5\.46% |
| 0\.1863 | 0\.1815 | 0\.1824 | 0\.1857 | 0\.8143 | 0\.4912% | 2\.64% |

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Read this BAIP's specification and the referenced bsip-0042.md, then compare the related BAIP and BSIP issues linked under Coordination. Done would require resolving the draft proposal's design and coordination questions and reaching an agreed specification; the payload names no implementation files or tests.

Written by the indexing model from the issue text.

Assessment

Domain
blockchain, fintech-quant
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.