You are viewing a single comment's thread from:

RE: RC stats in 1.27.2

in HiveDevs2 years ago (edited)

Do you know...

No. I'm engaged in core code only, not actual use :o)

Is there an easy way...

First of all you have to remember that RC costs returned by rc_api are average from last day. In many cases actual cost of particular operation will heavily depend on its content. You can make some estimation based on differences in resource usage of your operation in comparison to resource usage of average operation, but it will still be only an estimate. That aside, there is a way to recalculate RC cost into HP. RC mana has the same "scale" as VESTS, therefore you can use price of VESTS to calculate HP equivalent. Maybe there is a simplier way, but right now I can only think of use of database_api.get_dynamic_global_properties. It returns plenty of data, including total_vesting_shares and total_vesting_fund_hive. Those two values form a price of VESTS. The calculation would be something like the following: HP_equivalent = RC_cost * total_vesting_fund_hive / total_vesting_shares. HP equivalent is then expressed in HIVE, so you can use price of HIVE to calculate USD (there are many potential sources of that price to use: hived has feed price from witnesses and market price from internal market, but you can use price from any exchange). The prices I've mentioned are accessible with database_api.get_feed_history under current_median_history and market_median_history respectively.

Sort:  

thank you!

Recently I had to look into the code related to internal prices and I've noticed that part of the information I gave you was incorrect. The price from internal market is available, but it is not the market_median_history. Internal market can be observed with market_history_api, in particular latest price is in market_history_api.get_ticker in latest field. Funnily enough it was me who named market_median_history in such a deceitful way. market_median_history is always the same as current_median_history with exception of one special situation. When HBD debt hard limit is reached (when HBD in circulation, excluding DHF balance, is more than 30% of virtual HIVE supply), current_median_history price is artificially changed to the upside (for the purpose of internal calculations HIVE is artificially worth more than what witnesses report from external markets) while market_median_history is the uncorrected version of that price.

Thank you for getting back to me!