SteemVBS Update: Vests/Steem Conversion and Current Vote Worth

SteemVBS Update: Vests/Steem Conversion and Current Vote Worth

Introducing to SteemVBS

SteemVBS is the first Steem Library written in VBScript. Yes, it is VBScript. ;)

New Features

Adding the support for Vests/Steem Conversions and the functions to get the current vote worth. In particular, the following functions have been added to the library.

  1. Steem_Per_MVests
  2. Vests_To_Steem
  3. GetRewardFund
  4. GetRecentClaims
  5. GetAccountVests
  6. GetMedianPrice
  7. GetAccount_UpvoteValue

Examples

Vests and Steem:

1
2
3
4
5
6
Dim SteemIt
Set SteemIt = New Steem

WScript.Echo SteemIt.Steem_Per_MVests
WScript.Echo SteemIt.Vests_To_Steem(1)
WScript.Echo SteemIt.Steem_To_Vests(1)

Get Current Vote Worth:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
' get account upvote value
Public Function GetAccount_UpvoteValue(id, vp, weight)
Dim power
power = (100 * vp * 100 * weight / 1e4 + 49) / 50
Dim total_vests
total_vests = GetAccountVests(id)
Dim final_vests
final_vests = total_vests * 1e6
Dim rshares
rshares = power * final_vests / 1e4
Dim rewards
rewards = GetRewardFund
Dim sbd_median_price
sbd_median_price = GetMedianPrice
Dim estimate
estimate = rshares / GetRecentClaims * rewards * sbd_median_price
GetAccount_UpvoteValue = estimate
End Function

Fully Unit Tested:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Dim SteemIt
Set SteemIt = New Steem

Dim Util
Set Util = New Utility

Dim fund
fund = SteemIt.GetRewardFund
AssertTrue fund > 0, "Rewards Pool should be larger than zero"

Dim esp
esp = SteemIt.Vests_To_Steem(SteemIt.GetAccountVests("justyy"))
AssertTrue esp > 1000, "justyy's ESP should be at least 1000"

Dim price
price = SteemIt.GetMedianPrice
AssertTrue price > 0, "median price should be larger than 0"

Dim upvote_value
upvote_value = SteemIt.GetAccount_UpvoteValue("justyy", 100, 100)
AssertTrue upvote_value > 0.1, "full vote value should be at least $0.1"

Dim current_upvote_value
current_upvote_value = SteemIt.GetAccount_UpvoteValue("justyy", 50, 20)
AssertEqualFloat upvote_value * 0.5 * 0.2, current_upvote_value, 0.1, "current upvote value calculation error"

Set SteemIt = Nothing
Set Util = Nothing

image.png

Github

https://github.com/DoctorLai/steemvbs

Pull Requests

https://github.com/DoctorLai/steemvbs/pull/1

Support me and my work as a witness - witness thread by

  1. voting me here, or
  2. voting me as a witness proxy - let @justyy represent you.

Thank you! Some of My Contributions: SteemYY.com - SteemIt Tutorials, Robots, Tools and APIs and VPS Search Tool


This page is synchronized from the post: ‘SteemVBS Update: Vests/Steem Conversion and Current Vote Worth’

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×