- The assets in wallet( And in SAVINGS)
- The assets in internal market
- The assets(SBD) in conversion processes
- 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.
Item
Key
STEEM
balance
STEEM POWER
vesting_shares
STEEM DOLLARS
sbd_balance
STEEM in SAVINGS
savings_balance
STEEM DOLLARS in SAVINGS
savings_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
Asset
How to calculate
STEEM in internal market
Remaining STEEM in all opening SELL order
STEEM DOLLARS in internal market
Remaining 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.
Terima kasih atas postingannya kawan, ini sangat berguna sekali bagi saya.
Hi! I am a robot. I just upvoted you! I found similar content that readers might be interested in:
https://steemit.com/steemdev/@oflyhigh/how-to-calculate-estimated-account-value-part-two