How to calculate estimated account value: Part Two / 如何计算账户估值:第二部分

in #steemdev7 years ago (edited)

In my previous article, we concluded that:
To calculate estimated account value, we need to get items from these four parts:

  1. The assets in wallet( And in SAVINGS)
  2. The assets in internal market
  3. The assets(SBD) in conversion processes
  4. The assets(rewards) to be claimed

I will explain how to get them in this article.

The assets in wallet( And in SAVINGS)

The following assets need to be fetched.

  • STEEM
  • STEEM POWER
  • STEEM DOLLARS
  • STEEM in SAVINGS
  • STEEM DOLLARS in SAVINGS

There is a API named get_accounts will retrieve the account information which contained the above items.
vector< extended_account > get_accounts( vector< string > names ) const;

To retrieve them we need to put the account name into list, and then call API with this list as arguments. We can read the item value from the result using the corresponding key.

ItemKey
STEEMbalance
STEEM POWERvesting_shares
STEEM DOLLARSsbd_balance
STEEM in SAVINGSsavings_balance
STEEM DOLLARS in SAVINGSsavings_sbd_balance




An additional note, STEEM POWER was expressed in the form of VESTS, we need to convert it to equivalent STEEM.

The assets in internal market

To simplify the problem, In order to simplify the problem, we define two type of operations: BUY and SELL.

  • BUY: We pay SBD, and want to receive STEEM
  • SELL: We pay STEEM, and want to receive SBD

So, We get the following correspondence

AssetHow to calculate
STEEM in internal marketRemaining STEEM in all opening SELL order
STEEM DOLLARS in internal marketRemaining SBD in all opening BUY order

There is a API named get_open_orders, will return all open orders in internal market for specified account.
vector<extended_limit_order> get_open_orders( string owner )const;

The example return information for my account.

We can draw the results from above information: we have 0.586 STEEM and 2 SBD in internal market.

The assets(SBD) in conversion processes

As I mentioned in previous article, if we try to convert some amount SBD to STEEM, it will disappear from the wallet. So to accurately calculate the estimated account value, we need to get this part of SBD.

Fortunately, there is a API called get_conversion_requests.
vector<convert_request_api_obj> get_conversion_requests( const string& account_name )const;

The result should like this one, We can work out the total amount of SBD easily.

The assets(rewards) to be claimed

And after HF18, users need to claim their rewards manually, so to accurately calculate the estimated account value, we need to add this part: Rewards to be claim.

The good news is we can retrieval them directly from user info, with same API get_accounts and the same way.

ItemKey
STEEM Reward to be claimedreward_steem_balance
STEEM DOLLARS to be claimedreward_sbd_balance
STEEM POWER to be claimedreward_vesting_balance / reward_vesting_steem


For STEEM POWER to be claimed, we can obtain it from reward_vesting_balance or reward_vesting_steem, but the previous one need to be converted, so the later one is better.

For detailed usage of APIs, Please refer to the steem source code on Github.

中文

上篇文章中我们得出结论,精确计算账户估值,我们需要读取:

  • 钱包资产(包括存款账户)
  • 内部市场资产
  • 转换中的资产
  • 待收取的资产

我们可以使用:
get_accounts读回钱包资产(包括存款账户)
get_open_orders读回并计算出内部市场资产
get_conversion_requests读回并计算出 转换中的资产
get_accounts读回待收取的资产

API的详细用法,请参考Github上的steem源码

Sort:  

Super cool thanks!

simplified but accurated detailed one. good post

If this is the simplified version I would hate to see a detailed version. Valuable info nonetheless

thanks for sharing i will take my time to study this

thanks 4 such a nice post

i hope u explain soon how to get payouts also.. and thanks for this one :) many of us needed to know all this..

There are many people who have strategies to get payouts. I think the biggest thing is participate. Create your own interesting posts, make well written and informed replies and up vote posts which you think deserve it. I believe the first 50 votes you make in the day are the most valuable. Check your wallet every day because I think it takes about a week for the steem to start fogging in (someone please correct me if I am wrong). Of course I only make pennies but I take joy in learning.

thanks... and i wish u all the best

Is there any technique for a post to come in trending section because I am feeling jealous seeing your payout money 🤣🤣

We all would love a bone or two to be thrown our way haha.

Try joining @minnowsupport or giving @randowhale a go!

Thanks for this detailed post!

So clear....i just post and upvote on steemit but never know how to calculate it. But your post really elaborate it clearly.

Thanks for sharing!

Thanks for sharing the Information of steemit account value, Really it helped a lot to understand basic mechanism of steemit. Also I missed the part one, definitely will navigate and read it out..

You are welcome!

Coin Marketplace

STEEM 0.21
TRX 0.26
JST 0.040
BTC 101854.93
ETH 3674.01
USDT 1.00
SBD 3.18