You are viewing a single comment's thread from:

RE: Why is median_history_price no longer the median of feed price? My investigation.

in #witness-category5 years ago (edited)

Thank you for this great write-up. It will take me a while to process this fully.

So this price feed is calculated like this right now?


285,502,123 STEEM / 13,077,523 SBD

9 x 13,077,523 = 117,697,707 SBD (STEEM SBD value MAX).

117,697,707 SBD / 285,502,123 STEEM = $0,413 = Price feed.


Sort:  

To get the feed price, the better way is call get_feed_history(), For example:

curl --data '{"jsonrpc": "2.0", "method": "call", "params": ["database_api", "get_feed_history", []], "id": 1}' https://api.steemit.com

The result:

The we just get feed price (median_history_price) by
base / quote in current_median_history

So it should be:
117695452.311 / 285504114.958 = 0.41223732389396

Use the value from get_dynamic_global_properties and the formula in https://github.com/steemit/steem/blob/master/libraries/chain/database.cpp#L3258 will got the same result, but get_feed_history handles all situations.

Another thing to remember is median_history_price updated every hours, So the real-time results calculated by get_dynamic_global_properties may be slightly different

Coin Marketplace

STEEM 0.25
TRX 0.11
JST 0.032
BTC 63576.35
ETH 3066.39
USDT 1.00
SBD 3.80