Another Puzzle: Why is the blockchain's reported median price higher than the actual price of STEEM?

in #steem2 years ago (edited)

Here is a puzzle that has confused me for a while....

According to the blockchain feed history, we see the current median is: 108971932.401 SBD / 432256752.245 STEEM == 0.2521 SBD / STEEM.

$ curl -s --data '{"jsonrpc":"2.0", "method":"condenser_api.get_feed_history", "params":[], "id":1}' https://api.steemit.com | jq -S .result.current_median_history
{
"base": "108971932.401 SBD",
"quote": "432256752.245 STEEM"
}

This is consistent with what we see on SteemWorld:

image.png

But that value confuses me, in comparison to the actual price of STEEM. It doesn't make sense that this could actually be the median price. Also, in recent months, that value hasn't changed much no matter what happened with the price of STEEM.

In contrast, if we look at the actual price feed values, we see something different, the median value is 0.222:

$ curl -s --data '{"jsonrpc":"2.0", "method":"condenser_api.get_feed_history", "params":[], "id":1}' https://api.steemit.com | jq -Src .result.price_history[] | sort -n | cat -n
1 {"base":"0.216 SBD","quote":"1.000 STEEM"}
2 {"base":"0.216 SBD","quote":"1.000 STEEM"}
3 {"base":"0.216 SBD","quote":"1.000 STEEM"}
4 {"base":"0.216 SBD","quote":"1.000 STEEM"}
5 {"base":"0.216 SBD","quote":"1.000 STEEM"}
6 {"base":"0.216 SBD","quote":"1.000 STEEM"}
7 {"base":"0.217 SBD","quote":"1.000 STEEM"}
8 {"base":"0.217 SBD","quote":"1.000 STEEM"}
9 {"base":"0.217 SBD","quote":"1.000 STEEM"}
10 {"base":"0.217 SBD","quote":"1.000 STEEM"}
11 {"base":"0.217 SBD","quote":"1.000 STEEM"}
12 {"base":"0.217 SBD","quote":"1.000 STEEM"}
13 {"base":"0.217 SBD","quote":"1.000 STEEM"}
14 {"base":"0.218 SBD","quote":"1.000 STEEM"}
15 {"base":"0.218 SBD","quote":"1.000 STEEM"}
16 {"base":"0.219 SBD","quote":"1.000 STEEM"}
17 {"base":"0.219 SBD","quote":"1.000 STEEM"}
18 {"base":"0.219 SBD","quote":"1.000 STEEM"}
19 {"base":"0.220 SBD","quote":"1.000 STEEM"}
20 {"base":"0.220 SBD","quote":"1.000 STEEM"}
21 {"base":"0.220 SBD","quote":"1.000 STEEM"}
22 {"base":"0.220 SBD","quote":"1.000 STEEM"}
23 {"base":"0.220 SBD","quote":"1.000 STEEM"}
24 {"base":"0.220 SBD","quote":"1.000 STEEM"}
25 {"base":"0.221 SBD","quote":"1.000 STEEM"}
26 {"base":"0.221 SBD","quote":"1.000 STEEM"}
27 {"base":"0.221 SBD","quote":"1.000 STEEM"}
28 {"base":"0.221 SBD","quote":"1.000 STEEM"}
29 {"base":"0.221 SBD","quote":"1.000 STEEM"}
30 {"base":"0.221 SBD","quote":"1.000 STEEM"}
31 {"base":"0.221 SBD","quote":"1.000 STEEM"}
32 {"base":"0.221 SBD","quote":"1.000 STEEM"}
33 {"base":"0.221 SBD","quote":"1.000 STEEM"}
34 {"base":"0.221 SBD","quote":"1.000 STEEM"}
35 {"base":"0.222 SBD","quote":"1.000 STEEM"}
36 {"base":"0.222 SBD","quote":"1.000 STEEM"}
37 {"base":"0.222 SBD","quote":"1.000 STEEM"}
38 {"base":"0.222 SBD","quote":"1.000 STEEM"}
39 {"base":"0.222 SBD","quote":"1.000 STEEM"}
40 {"base":"0.222 SBD","quote":"1.000 STEEM"}
41 {"base":"0.222 SBD","quote":"1.000 STEEM"}
/**** Median here ****
42 {"base":"0.222 SBD","quote":"1.000 STEEM"}
43 {"base":"0.222 SBD","quote":"1.000 STEEM"}
****/

44 {"base":"0.222 SBD","quote":"1.000 STEEM"}
45 {"base":"0.223 SBD","quote":"1.000 STEEM"}
46 {"base":"0.223 SBD","quote":"1.000 STEEM"}
47 {"base":"0.223 SBD","quote":"1.000 STEEM"}
48 {"base":"0.223 SBD","quote":"1.000 STEEM"}
49 {"base":"0.224 SBD","quote":"1.000 STEEM"}
50 {"base":"0.224 SBD","quote":"1.000 STEEM"}
51 {"base":"0.224 SBD","quote":"1.000 STEEM"}
52 {"base":"0.224 SBD","quote":"1.000 STEEM"}
53 {"base":"0.225 SBD","quote":"1.000 STEEM"}
54 {"base":"0.225 SBD","quote":"1.000 STEEM"}
55 {"base":"0.225 SBD","quote":"1.000 STEEM"}
56 {"base":"0.225 SBD","quote":"1.000 STEEM"}
57 {"base":"0.225 SBD","quote":"1.000 STEEM"}
58 {"base":"0.226 SBD","quote":"1.000 STEEM"}
59 {"base":"0.227 SBD","quote":"1.000 STEEM"}
60 {"base":"0.227 SBD","quote":"1.000 STEEM"}
61 {"base":"0.227 SBD","quote":"1.000 STEEM"}
62 {"base":"0.227 SBD","quote":"1.000 STEEM"}
63 {"base":"0.227 SBD","quote":"1.000 STEEM"}
64 {"base":"0.227 SBD","quote":"1.000 STEEM"}
65 {"base":"0.227 SBD","quote":"1.000 STEEM"}
66 {"base":"0.227 SBD","quote":"1.000 STEEM"}
67 {"base":"0.228 SBD","quote":"1.000 STEEM"}
68 {"base":"0.228 SBD","quote":"1.000 STEEM"}
69 {"base":"0.231 SBD","quote":"1.000 STEEM"}
70 {"base":"0.231 SBD","quote":"1.000 STEEM"}
71 {"base":"0.231 SBD","quote":"1.000 STEEM"}
72 {"base":"0.231 SBD","quote":"1.000 STEEM"}
73 {"base":"0.231 SBD","quote":"1.000 STEEM"}
74 {"base":"0.232 SBD","quote":"1.000 STEEM"}
75 {"base":"0.232 SBD","quote":"1.000 STEEM"}
76 {"base":"0.232 SBD","quote":"1.000 STEEM"}
77 {"base":"0.232 SBD","quote":"1.000 STEEM"}
78 {"base":"0.232 SBD","quote":"1.000 STEEM"}
79 {"base":"0.232 SBD","quote":"1.000 STEEM"}
80 {"base":"0.232 SBD","quote":"1.000 STEEM"}
81 {"base":"0.233 SBD","quote":"1.000 STEEM"}
82 {"base":"0.233 SBD","quote":"1.000 STEEM"}
83 {"base":"0.237 SBD","quote":"1.000 STEEM"}
84 {"base":"0.243 SBD","quote":"1.000 STEEM"}

Which is more or less consistent with the actual price of STEEM.

Based on my observations last time the STEEM price crossed the SBD printing threshold, the $0.222 value is correct, and the price that the blockchain is reporting as the median price is actually the threshold value where SBDs will start printing again. If we, eventually, cross that threshold then I suspect that the two numbers will come back in sync?

It looks like someone asked the same question 4 years ago, but I'm not really satisfied with the answer. I guess the point is that the "current_median_history" value is not really a median, but rather that this was a kluge that was used to depeg the SBD, so that conversion from SBD to STEEM pays less than 1 SBD when the SBD market cap is higher than 10% of the STEEM market cap?

At the blockchain's reported median value, I could receive 3.96 STEEM / SBD for converting SBDs through the blockchain's conversion function. At the actual median value, I would have received 4.5 STEEM. So, the blockchain is reducing the payout by a factor of ( 0.222 / 0.2521 ).

A nice side-effect, if I'm understanding correctly, is that SteemWorld will always tell us the value where SBDs will start printing again (unless/until they actually do start printing again).

What do you think? Is there a clearer explanation anywhere to describe what's going on?

Sort:  

I guess the point is that the "current_median_history" value is not really a median, but rather that this was a kluge that was used to depeg the SBD, so that conversion from SBD to STEEM pays less than 1 SBD when the SBD market cap is higher than 10% of the STEEM market cap?

Yes, this is my understanding, this is how the "haircut rule" was implemented. Basically this "median price" is only used for SBD->STEEM conversion operations, so they put a max value in there. At one point I hunted through the code to try to figure out how the haircut rule worked and I have this comment in one of my scripts explaining how to get the number:

Haircut rule: What would the price be if 9X of all SBDs bought all the STEEM?

I knew about the haircut rule, but didn't realize that this was how they had implemented it. I did the calculation in one of my scripts (which is how I first noticed the discrepancy), and it gives back the same answer by a different method (cross multiplication using numbers of token in circulation):

$ ./sbd_ratio.sh
Price: $ 0.2220
STEEM supply: 480295827
SBD supply (cap): 12108259
STEEM Market Cap (calculated): 106625673
SBD supply (cap) / STEEM CAP: 0.1136
SBD print rate: 0 (calculated), 0 (queried)

Lower threshold: 0.2521
Upper threshold: 0.280111

Calculated like this:

echo ${STEEM_SUPPLY} ${SBD_STOP_PERCENT} ${SBD_SUPPLY} | awk '{print "Lower threshold: " 10000 * $3 / ($1 * $2) }'
echo ${STEEM_SUPPLY} ${SBD_START_PERCENT} ${SBD_SUPPLY} | awk '{print "Upper threshold: " 10000 * $3 / ($1 * $2) }'

this is how the "haircut rule" was implemented

I would say that without the restriction of the median_price, the (current) haircut rule would not make sense. But the two mechanisms work independently of each other. As e.g. the earlier limits (printing reduction between 2 and 5 %) have shown.

That is a very good question that I have always wanted to look into. So now is the chance ;-))

I can only reconstruct this as far as the chain calculates it. The code has already been discussed in your linked post.

The market cap of all SBD should not exceed 10 % of the combined market cap. Once this percentage is exceeded, the minimum price does not fall further. A further drop in the price would increase the total market cap and thus lead to the printing of more SBD.

pricevirtual_supplysbd_percentprint SBD
$0.22487,000,000 STEEM9.86 %yes
$0.15513,000,000 STEEM9.36 %yes

However, printing more SBD would again lead to an increase in the total market cap and so on.

It would be interesting to know why the value was set at 10% for the price limit. I have not found any information on this. At the introduction of HF 14, this 10 % has already been set.

It is only remarkable that with HF20 the threshold for the printing pause were adjusted to this limit. Before that, they were much lower. The increase was surely better for the users, but the debt rate rose faster this way (even if no one could really imagine it at the time). There was an extensive discussion on this.

Oh yes, the limitation of the median_price could also be related to the possibility of manipulation by the witnesses. I once read a thought on this, but I can't find it right now...

Oh, that helps to jog my memory. Here was the post that started it all, Steem Dollar Stability Enhancements, and here are the HF14 release notes. And, yeah, it's there in the release notes, sort-of...

When Steem Dollars reach 10% of the market cap, the price feed will jump off the peg to keep Steem Dollars at 10% of the market cap and will return to the peg when the reported price feed goes below 10%. Witnesses should still report the real dollar value of Steem for their price feed. The median price feed is automatically capped regardless of what witnesses report. (emphasis added)

And now I see where this came from in the comments of the first post, Steem Dollars have Limits.

There are two extreme cases, black swans, that must be considered. In one extreme the price goes to 0, in the other extreme the price goes to infinity. It is in the interest of everyone involved that the value of a Steem Dollar never hits either extreme. This can be implemented in objective terms by setting hard limits on the exchange rate range that is allowed.

We can set a maximum and minimum Steem Dollar price as follows:

maximum price = SteemSupply / (10 * SteemDollarSupply)
minimum price = SteemSupply / (10000 * SteemDollarSupply)

With these rules in place, Steem Dollar holders are protected against US dollar hyperinflation and Steem holders are protected against US dollar “hyperdeflation”. The witnesses are trusted to publish a honest price feed relative to dollars at all times, but the blockchain will enforce these hard limits.

In other words, the market cap of all Steem Dollars will always be between 0.01% and 10% of the Steem market cap.

Not sure, but my guess is that those percentages were just someone's hunch for reasonable values to use. I wonder if they also implemented that 0.01% rule. I don't see that in the release notes, and I don't remember hearing about it, so maybe not.

P.S. That discussion is painful. Herding cats. ; -)

Thank you for the links. I need to read more from him.

I wonder if they also implemented that 0.01% rule.

I don't think this has been implemented. I haven't noticed that in the code either so far. Maybe there is still some information from Dan somewhere. The release notes only describe the minimum price.

But we may conclude that the limits were introduced with very good reasons. And all those who complain that no more SBD are printed should bear in mind that more is not always good!

BTW: At first I thought the idea of forced conversion was not so bad...

Apparently there is some kind of average value. The last time they started typing again SBD price STEEM it was above $ 0.25 for more than a week on the exchanges. Only then did printing resume. there is some margin of error. And so yes, the payout is more when printing SBD.

I guess it needs an update :) I better not make jokes about it