create account

Tutorial: Get the value of your steemit earnings, Part #2 - Calculate Steem Power by schererf

View this thread on: hive.blogpeakd.comecency.com
· @schererf ·
$22.32
Tutorial: Get the value of your steemit earnings, Part #2 - Calculate Steem Power
In the second post of this series I added the conversation of the VESTS rewards to Steem Power. 

# The Mission
The requirements for the first part of this series:
1. Get the steemit earnings (STEEM, SBD, VESTS) for an account
2. Create a HTML and CSV report
You can find the first part here: 
https://steemit.com/steemdev/@schererf/tutorial-get-the-value-of-your-steemit-earnings-part-1

https://i.imgur.com/Cq1hhlw.jpg

The requirements for this second part:
1. Calculate the Steem Power (SP) for the VESTS reward

# System Requirements

### nodeJS
As the runtime system for the program I used "nodeJS" (LTS version).
You can download nodeJS here: https://nodejs.org

http://i.imgur.com/J0VuhLa.jpg

# Implementation

### git repository

You can download the complete sources of this tutorial from my GitHub repository:
https://github.com/SchererF/steemit-earnings

### calculation of Steem Power

The Steem Power is calculated using the following formula:
````
total_vesting_fund_steem * (user's vesting_shares / total_vesting_shares)
````
<br>
Thanks to @lantto: 
https://steemit.com/steem/@lantto/how-to-calculate-steem-power-using-the-api

### using steemd data

To calculate the Steem Power of VESTS reward, we need historical data for *total_vesting_fund_steem* and *total_vesting_shares*. The only way I found to get this historical data is provided by @jesta. He creates snapshots of steemd data on a regular base. 

Thanks to @jesta: 
https://steemit.com/witness-category/@jesta/jesta-witness-update-2016-09-02

The data are provided under this URL:
https://steemdb.com/api/props

http://i.imgur.com/X6H12OY.jpg

````
        var url='https://steemdb.com/api/props';
        console.log( 'loading data from "' + url + '"');
        return fetch(url
            ).then((response) => response.json()
            ).then((data) => steemdApiPropsData = data);
````
<br>
Get the timestamp of an single item

````
var date = new Date(parseInt(steemdApiPropsDataItem.time.$date.$numberLong));
````
<br>

Calculate the *steem_per_mvests* value
````
steem_per_mvests = steemdApiPropsDataItem.total_vesting_fund_steem * 1000000 / steemdApiPropsDataItem.total_vesting_shares;
````

#### Example

time.$date.$numberLong 1515871554000 (GMT: Saturday, January 13, 2018 7:25:54 PM)
total_vesting_fund_steem 199304254.488
total_vesting_shares 408153245669.0034
steem_per_vests 0.000488307 = 199304254.488 / 408153245669.0034

#### small deviations

Unfortunately, there are small deviations in the comma range for the calculated Steem Power values compared to those in the wallet. Personally, I can live with this small deviations, but if you know a solution to this problem, I would appreciate a hint.

# Let's do it

Please have a look at the first post of this series if you want to know how to download, install and run this program.
https://steemit.com/steemdev/@schererf/tutorial-get-the-value-of-your-steemit-earnings-part-1


### Take a look at the output HTML

The created HTML now includes the values for *steem_per_mvests* and *SP* values.

http://i.imgur.com/klGHQHK.jpg

# Tutorial Preview

In the next parts of this little series add the STEEM and SBD earnings as EUR/USD based on the historical exchange rate of the reward claim date.

# Note
This tool can simply be used for your personal interests or of course to create a template for reporting your steemit earnings for a financial office (as we need it in Germany for the tax office).

***The created report is of course not an official document. It is just an idea on how to report your earnings!***

Please give me feedback if this tutorial was helpful for you.

Thanks for reading and watching,
@schererf
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
properties (23)
authorschererf
permlinktutorial-get-the-value-of-your-steemit-earnings-part-2-calculate-steem-power
categorysteemdev
json_metadata{"tags":["steemdev","steemit","steemtools","programming","blockchain"],"users":["lantto","jesta","schererf"],"image":["https://i.imgur.com/Cq1hhlw.jpg","http://i.imgur.com/J0VuhLa.jpg","http://i.imgur.com/X6H12OY.jpg","http://i.imgur.com/klGHQHK.jpg"],"links":["https://steemit.com/steemdev/@schererf/tutorial-get-the-value-of-your-steemit-earnings-part-1","https://nodejs.org","https://github.com/SchererF/steemit-earnings","https://steemit.com/steem/@lantto/how-to-calculate-steem-power-using-the-api","https://steemit.com/witness-category/@jesta/jesta-witness-update-2016-09-02","https://steemdb.com/api/props"],"app":"steemit/0.1","format":"markdown"}
created2018-02-18 21:46:03
last_update2018-02-18 21:46:03
depth0
children20
last_payout2018-02-25 21:46:03
cashout_time1969-12-31 23:59:59
total_payout_value18.131 HBD
curator_payout_value4.192 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length3,671
author_reputation26,658,463,264,121
root_title"Tutorial: Get the value of your steemit earnings, Part #2 - Calculate Steem Power"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,618,860
net_rshares4,004,479,939,127
author_curate_reward""
vote details (38)
@blazing ·
$0.07
Oh wow this can be done too interesting :D

Thanks for sharing a post on it how to do it :)
👍  
properties (23)
authorblazing
permlinkre-schererf-tutorial-get-the-value-of-your-steemit-earnings-part-2-calculate-steem-power-20180219t055140259z
categorysteemdev
json_metadata{"tags":["steemdev"],"app":"steemit/0.1"}
created2018-02-19 05:51:42
last_update2018-02-19 05:51:42
depth1
children1
last_payout2018-02-26 05:51:42
cashout_time1969-12-31 23:59:59
total_payout_value0.052 HBD
curator_payout_value0.016 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length91
author_reputation117,662,220,860,076
root_title"Tutorial: Get the value of your steemit earnings, Part #2 - Calculate Steem Power"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,703,224
net_rshares12,695,792,189
author_curate_reward""
vote details (1)
@schererf ·
You're welcome. Writing technical posts is not that easy as it seems ;-)
properties (22)
authorschererf
permlinkre-blazing-re-schererf-tutorial-get-the-value-of-your-steemit-earnings-part-2-calculate-steem-power-20180219t150011334z
categorysteemdev
json_metadata{"tags":["steemdev"],"app":"steemit/0.1"}
created2018-02-19 15:00:09
last_update2018-02-19 15:00:09
depth2
children0
last_payout2018-02-26 15:00:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length72
author_reputation26,658,463,264,121
root_title"Tutorial: Get the value of your steemit earnings, Part #2 - Calculate Steem Power"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,811,160
net_rshares0
@cityslicker ·
$0.07
i am gonna try this one out thanks bro for sharing it
👍  
properties (23)
authorcityslicker
permlinkre-schererf-tutorial-get-the-value-of-your-steemit-earnings-part-2-calculate-steem-power-20180219t090755558z
categorysteemdev
json_metadata{"tags":["steemdev"],"app":"steemit/0.1"}
created2018-02-19 09:08:00
last_update2018-02-19 09:08:00
depth1
children1
last_payout2018-02-26 09:08:00
cashout_time1969-12-31 23:59:59
total_payout_value0.052 HBD
curator_payout_value0.016 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length53
author_reputation4,742,456,214,205
root_title"Tutorial: Get the value of your steemit earnings, Part #2 - Calculate Steem Power"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,739,381
net_rshares12,695,792,189
author_curate_reward""
vote details (1)
@schererf ·
Yes, please try it and give me some feedback about it!
properties (22)
authorschererf
permlinkre-cityslicker-re-schererf-tutorial-get-the-value-of-your-steemit-earnings-part-2-calculate-steem-power-20180219t150129464z
categorysteemdev
json_metadata{"tags":["steemdev"],"app":"steemit/0.1"}
created2018-02-19 15:01:30
last_update2018-02-19 15:01:30
depth2
children0
last_payout2018-02-26 15:01:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length54
author_reputation26,658,463,264,121
root_title"Tutorial: Get the value of your steemit earnings, Part #2 - Calculate Steem Power"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,811,431
net_rshares0
@coin.info ·
$0.07
**Coins mentioned in post:**

Coin | | Price (USD) | 📉 24h | 📈 7d
- | - | - | - | -
**HTML** | HTMLCOIN | 0.002$ | _5.35%_ | _6.12%_
**SBD** | Steem Dollars | 5.427$ | _-4.35%_ | _17.43%_
**STEEM** | Steem | 4.358$ | _-5.19%_ | _6.99%_
👍  
properties (23)
authorcoin.info
permlinkre-schererf-tutorial-get-the-value-of-your-steemit-earnings-part-2-calculate-steem-power-20180218t214853578z
categorysteemdev
json_metadata{"app":"coininfo/1.0.0","format":"markdown"}
created2018-02-18 21:48:54
last_update2018-02-18 21:48:54
depth1
children0
last_payout2018-02-25 21:48:54
cashout_time1969-12-31 23:59:59
total_payout_value0.052 HBD
curator_payout_value0.016 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length235
author_reputation133,144,230,969
root_title"Tutorial: Get the value of your steemit earnings, Part #2 - Calculate Steem Power"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,619,372
net_rshares12,695,792,189
author_curate_reward""
vote details (1)
@crokkon · (edited)
$0.07
.
.
👍  
properties (23)
authorcrokkon
permlinkre-schererf-tutorial-get-the-value-of-your-steemit-earnings-part-2-calculate-steem-power-20180219t112200146z
categorysteemdev
json_metadata"{"app": ""}"
created2018-02-19 11:22:00
last_update2022-09-18 12:22:09
depth1
children4
last_payout2018-02-26 11:22:00
cashout_time1969-12-31 23:59:59
total_payout_value0.052 HBD
curator_payout_value0.016 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1
author_reputation81,214,366,861,104
root_title"Tutorial: Get the value of your steemit earnings, Part #2 - Calculate Steem Power"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,765,097
net_rshares12,695,792,189
author_curate_reward""
vote details (1)
@schererf ·
Thanks a lot, that sounds very interesting. Can you share an example for this query script?
properties (22)
authorschererf
permlinkre-crokkon-re-schererf-tutorial-get-the-value-of-your-steemit-earnings-part-2-calculate-steem-power-20180219t152515822z
categorysteemdev
json_metadata{"tags":["steemdev"],"app":"steemit/0.1"}
created2018-02-19 15:25:15
last_update2018-02-19 15:25:15
depth2
children3
last_payout2018-02-26 15:25:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length91
author_reputation26,658,463,264,121
root_title"Tutorial: Get the value of your steemit earnings, Part #2 - Calculate Steem Power"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,816,512
net_rshares0
@crokkon · (edited)
$0.08
.
.
👍  
properties (23)
authorcrokkon
permlinkre-schererf-re-crokkon-re-schererf-tutorial-get-the-value-of-your-steemit-earnings-part-2-calculate-steem-power-20180219t153715756z
categorysteemdev
json_metadata"{"app": ""}"
created2018-02-19 15:37:15
last_update2022-09-18 12:21:51
depth3
children2
last_payout2018-02-26 15:37:15
cashout_time1969-12-31 23:59:59
total_payout_value0.062 HBD
curator_payout_value0.019 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1
author_reputation81,214,366,861,104
root_title"Tutorial: Get the value of your steemit earnings, Part #2 - Calculate Steem Power"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,819,065
net_rshares14,936,226,104
author_curate_reward""
vote details (1)
@cutiepie ·
$0.07
Another awesome tutorial thanks for sharing it once again :)
👍  
properties (23)
authorcutiepie
permlinkre-schererf-tutorial-get-the-value-of-your-steemit-earnings-part-2-calculate-steem-power-20180219t072518005z
categorysteemdev
json_metadata{"tags":["steemdev"],"app":"steemit/0.1"}
created2018-02-19 07:25:21
last_update2018-02-19 07:25:21
depth1
children1
last_payout2018-02-26 07:25:21
cashout_time1969-12-31 23:59:59
total_payout_value0.052 HBD
curator_payout_value0.016 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length60
author_reputation5,599,036,868,065
root_title"Tutorial: Get the value of your steemit earnings, Part #2 - Calculate Steem Power"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,720,745
net_rshares12,695,792,189
author_curate_reward""
vote details (1)
@schererf ·
Thanks for reading it again :)
properties (22)
authorschererf
permlinkre-cutiepie-re-schererf-tutorial-get-the-value-of-your-steemit-earnings-part-2-calculate-steem-power-20180219t150047514z
categorysteemdev
json_metadata{"tags":["steemdev"],"app":"steemit/0.1"}
created2018-02-19 15:00:48
last_update2018-02-19 15:00:48
depth2
children0
last_payout2018-02-26 15:00:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length30
author_reputation26,658,463,264,121
root_title"Tutorial: Get the value of your steemit earnings, Part #2 - Calculate Steem Power"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,811,292
net_rshares0
@dalexx ·
$2.54
Thanks @schererf, pretty useful post ! Is there any possibility to pin your post on my steemit till next year:) Is it working for OSX ?
👍  ,
properties (23)
authordalexx
permlinkre-schererf-tutorial-get-the-value-of-your-steemit-earnings-part-2-calculate-steem-power-20180218t221246373z
categorysteemdev
json_metadata{"tags":["steemdev"],"users":["schererf"],"app":"steemit/0.1"}
created2018-02-18 22:13:18
last_update2018-02-18 22:13:18
depth1
children2
last_payout2018-02-25 22:13:18
cashout_time1969-12-31 23:59:59
total_payout_value1.906 HBD
curator_payout_value0.630 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length135
author_reputation2,849,270,015,369
root_title"Tutorial: Get the value of your steemit earnings, Part #2 - Calculate Steem Power"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,623,605
net_rshares455,407,226,476
author_curate_reward""
vote details (2)
@schererf ·
Just use browser bookmarks ;-)
Yes it should work. You can download nodeJS for OSX here: https://nodejs.org/en/download/
👍  
properties (23)
authorschererf
permlinkre-dalexx-re-schererf-tutorial-get-the-value-of-your-steemit-earnings-part-2-calculate-steem-power-20180219t145850096z
categorysteemdev
json_metadata{"tags":["steemdev"],"links":["https://nodejs.org/en/download/"],"app":"steemit/0.1"}
created2018-02-19 14:58:48
last_update2018-02-19 14:58:48
depth2
children1
last_payout2018-02-26 14:58:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length120
author_reputation26,658,463,264,121
root_title"Tutorial: Get the value of your steemit earnings, Part #2 - Calculate Steem Power"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,810,889
net_rshares2,181,749,089
author_curate_reward""
vote details (1)
@dalexx ·
$2.49
Thx !
👍  ,
properties (23)
authordalexx
permlinkre-schererf-re-dalexx-re-schererf-tutorial-get-the-value-of-your-steemit-earnings-part-2-calculate-steem-power-20180219t185447743z
categorysteemdev
json_metadata{"tags":["steemdev"],"app":"steemit/0.1"}
created2018-02-19 18:54:48
last_update2018-02-19 18:54:48
depth3
children0
last_payout2018-02-26 18:54:48
cashout_time1969-12-31 23:59:59
total_payout_value1.871 HBD
curator_payout_value0.618 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length5
author_reputation2,849,270,015,369
root_title"Tutorial: Get the value of your steemit earnings, Part #2 - Calculate Steem Power"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,859,646
net_rshares443,849,853,332
author_curate_reward""
vote details (2)
@oliveralexander ·
$0.07
Good post!👍
👍  
properties (23)
authoroliveralexander
permlinkre-schererf-tutorial-get-the-value-of-your-steemit-earnings-part-2-calculate-steem-power-20180218t215348411z
categorysteemdev
json_metadata{"tags":["steemdev"],"app":"steemit/0.1"}
created2018-02-18 21:53:51
last_update2018-02-18 21:53:51
depth1
children1
last_payout2018-02-25 21:53:51
cashout_time1969-12-31 23:59:59
total_payout_value0.052 HBD
curator_payout_value0.016 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length11
author_reputation2,076,637,482,966
root_title"Tutorial: Get the value of your steemit earnings, Part #2 - Calculate Steem Power"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,620,231
net_rshares12,695,792,189
author_curate_reward""
vote details (1)
@schererf ·
I'm glad you like it...
properties (22)
authorschererf
permlinkre-oliveralexander-re-schererf-tutorial-get-the-value-of-your-steemit-earnings-part-2-calculate-steem-power-20180219t145708662z
categorysteemdev
json_metadata{"tags":["steemdev"],"app":"steemit/0.1"}
created2018-02-19 14:57:09
last_update2018-02-19 14:57:09
depth2
children0
last_payout2018-02-26 14:57:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length23
author_reputation26,658,463,264,121
root_title"Tutorial: Get the value of your steemit earnings, Part #2 - Calculate Steem Power"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,810,561
net_rshares0
@resteemme ·
$0.07
This post received a upvote from @resteemme and it's trail. Thanks to @resteemme!
👍  
properties (23)
authorresteemme
permlinkre-schererf-tutorial-get-the-value-of-your-steemit-earnings-part-2-calculate-steem-power-20180219t214721273z
categorysteemdev
json_metadata{"app":"resteemebot/0.0.1"}
created2018-02-19 21:47:39
last_update2018-02-19 21:47:39
depth1
children0
last_payout2018-02-26 21:47:39
cashout_time1969-12-31 23:59:59
total_payout_value0.066 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length81
author_reputation24,766,792,891
root_title"Tutorial: Get the value of your steemit earnings, Part #2 - Calculate Steem Power"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,891,109
net_rshares11,948,980,883
author_curate_reward""
vote details (1)
@starboye ·
$0.07
Excellent lesson with step by step approach you explained it very simply
👍  
properties (23)
authorstarboye
permlinkre-schererf-tutorial-get-the-value-of-your-steemit-earnings-part-2-calculate-steem-power-20180219t122159766z
categorysteemdev
json_metadata{"tags":["steemdev"],"app":"steemit/0.1"}
created2018-02-19 12:22:03
last_update2018-02-19 12:22:03
depth1
children1
last_payout2018-02-26 12:22:03
cashout_time1969-12-31 23:59:59
total_payout_value0.052 HBD
curator_payout_value0.016 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length72
author_reputation1,548,341,121,513
root_title"Tutorial: Get the value of your steemit earnings, Part #2 - Calculate Steem Power"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,777,323
net_rshares12,695,792,189
author_curate_reward""
vote details (1)
@schererf ·
THX, glad you like it!
properties (22)
authorschererf
permlinkre-starboye-re-schererf-tutorial-get-the-value-of-your-steemit-earnings-part-2-calculate-steem-power-20180219t152544720z
categorysteemdev
json_metadata{"tags":["steemdev"],"app":"steemit/0.1"}
created2018-02-19 15:25:45
last_update2018-02-19 15:25:45
depth2
children0
last_payout2018-02-26 15:25:45
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length22
author_reputation26,658,463,264,121
root_title"Tutorial: Get the value of your steemit earnings, Part #2 - Calculate Steem Power"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,816,612
net_rshares0