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-category6 years ago

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