STEEM POWER retention ratio of top 50 witnesses

by joviansummer original STEEMIT post: https://steemit.com/blog/@joviansummer/steem-power-retention-ratio-of-top-50-witnesses Hello, this is @joviansummer(witness: @jswit). Some time ago there was a bit of discussion on discord witness chanel about witnesses' power-down/cashing-out. So out of curiosity I just checked current ratio of witnesses' own STEEM POWER(VESTS) and all-time producer reward(VESTS). The ratio is calculated by the following simple formula: ratio(%) = account's own SP(MV) / all-time producer reward SP(MV) * 100% Ratio value less than 100% indicates power-down. If witness does additional power-up or gets other types of reward(e.g., curation reward), the ratio may exceed 100%. This does not take witness' other accounts into consideration. All-time producer reward data is from @steemchiller's SDS API. Here is the result: rank account own_sp prod_sp ratio 1 justyy 2188.411MV 1284.2MV 170.41% 2 steemchiller 982.134MV 124...

파이썬(steem-python)에서 스팀잇 계정의 현재 스팀파워(SP) 확인

by joviansummer
original STEEMIT post: https://steemit.com/blog/@joviansummer/steem-python-sp


steem-python을 이용해서 특정 스팀id의 현재 스팀파워를 확인할 수 있습니다. 우선 계정 정보를 가져옵니다. 이 부분은 예전에 포스팅했던 바 있습니다. 아래의 링크입니다.

파이썬(steem-python)에서 스팀잇 계정 정보 확인
https://steemit.com/hive-141029/@joviansummer/rvj35-steem-python

여기에 한번 더 써 보면 아래와 같습니다.

from steem import Steem

steem_id = 'joviansummer'
s = Steem()
user_info = s.get_account(steem_id)

스팀 블럭체인에서는 스팀파워가 아니라 VEST라는 단위를 사용합니다. 위의 코드로 가져온 계정 정보는 딕셔너리(dict) 형식이며, 스팀파워 관련 키(key)는 다음과 같습니다.

vesting_shares: 소유하고 있는 스팀파워(단위: VEST)
delegated_vesting_shares: 임대한 스팀파워(단위: VEST)
received_vesting_shares: 임대 받은 스팀파워(단위: VEST)

따라서, 현재 가용한 스팀파워 = 소유한 SP - 임대한 SP + 임대 받은 SP 이런 식으로 계산할 수 있습니다.

값은 '920224.825430 VESTS' 이렇게 문자열(str) 형식으로 받게 되므로, 위의 계산을 하려면 약간의 변환작업이 필요합니다.

from steem import Steem

s = Steem()
user_info = s.get_account('joviansummer')

vesting_shares = float(user_info['vesting_shares'].split(' ')[0])
delegated_shares = float(user_info['delegated_vesting_shares'].split(' ')[0])
received_shares = float(user_info['received_vesting_shares'].split(' ')[0])

current_shares = vesting_shares - delegated_shares + received_shares

문자열에서 split()을 이용해서 공백 기준으로 첫번째([0], 인덱스 0) 항목을 잘라낸 후에 부동소수점 수자(float) 형식으로 변환해 주었습니다.

이제 VEST 값을 스팀파워(SP)로 변환해 보겠습니다. Converter 객체의 vests_to_sp()를 이용합니다.

from steem.converter import Converter

c = Converter()
current_sp = c.vests_to_sp(current_shares)

Comments

Popular posts from this blog

스티미언의 영향력 지수 계산

jsup/avle code update - you don't have to write post everyday

jsup/avle 보팅 코드 갱신 - 1일1포스팅 강박에서 벗어나기