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

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

Open
shulthz opened this issue Nov 8, 2019 · 0 comments
Open

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

shulthz opened this issue Nov 8, 2019 · 0 comments

Comments

@shulthz
Copy link

shulthz commented Nov 8, 2019

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

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

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

bitshares/bsips#221
#4
#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.

@shulthz shulthz changed the title New BAIP: Add the price of BitAssets/BTS to the feed price New BAIP: Add the price of BitAssets/BTS into the feed price Nov 11, 2019
@shulthz shulthz changed the title New BAIP: Add the price of BitAssets/BTS into the feed price BAIP4: Add the price of BitAssets/BTS into the feed price Feb 22, 2020
@shulthz shulthz changed the title BAIP4: Add the price of BitAssets/BTS into the feed price BAIP4: Use 1 hours period EMA(6) to instead of BAIP2 Feb 22, 2020
@bitshares bitshares deleted a comment from froooze Mar 5, 2020
@shulthz shulthz closed this as completed Apr 16, 2020
@shulthz shulthz reopened this Jun 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant