jsup 2.1 - investor's relief (experiment on separation of investment and SNS)

by joviansummer original STEEMIT post: https://steemit.com/blog/@joviansummer/jsup-2-1-investor-s-relief-experiment-on-separation-of-investment-and-sns Hello, this is @joviansummer(witness: @jswit). I'm starting a new experiment regarding my @jsup vote service. The purpose of this experiment is to separate STEEM investment and social interaction(posting/commenting). For many people, writing a post daily(literally 365 posts per year) is not easy. It's not fun, and mandatory daily post only written for self-voting delegation service tends to result in useless low-quality content. I hope this new function of @jsup will reduce those posts, and also make it a bit more easy to invest in STEEM without worrying about daily posting. I think pressure of daily posting significantly undermines Steem as SNS. It's not fun. This is how it works: From 11:45 PM to 11:50 PM every night(reference time zone is GMT+9), @jsup checks if eligible delegators wrote something and received daily v...

파이썬 beem을 이용해서 현재 스팀파워(SP) 확인하기

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


파이썬 beem에서 계정의 현재 스팀파워를 조회하는 방법입니다. Account 객체를 이용해서 계정에 대한 정보를 가져와 json()함수를 통해 계정 정보를 딕셔너리(dict) 형식으로 얻을 수 있습니다. 아래의 코드는 @joviansummer 계정의 정보를 가져오는 예시입니다.

from beem import Steem
from beem.account import Account

node_list = ["https://api.steemit.com"]

steem = Steem(node=node_list)
account = Account('joviansummer', blockchain_instance=steem)

acc_json_data = account.json()

json() 함수를 이용해서 계정 정보를 딕셔너리 형식으로 변수 acc_json_data에 할당했습니다. 이제 여기에서 필요한 값들을 가져와서 스팀 파워를 파악합니다.

스팀파워는 VEST라는 단위로 조회되며, 조회한 결과를 스팀파워로 변환해서 출력해 주어야 합니다. acc_json_data에 저장된 딕셔너리(dict)에서 소유하거나 임대하거나 임대받은 VEST는 아래의 키(key)를 이용해 찾을 수 있습니다.

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

vesting_shares = acc_json_data['vesting_shares']['amount']
delegated_shares = acc_json_data['delegated_vesting_shares']['amount']
received_shares = acc_json_data['received_vesting_shares']['amount']

위의 코드에서 가져온 값들의 형식은 문자열(string)입니다. 그러므로, 각 값들을 부동소수점(float)으로 변환해서 계산하여 현재 스팀파워를 VEST 단위로 얻을 수 있습니다. 계산 방식은 아래와 같습니다.

현재 가용한 스팀파워 = 소유한 SP - 임대한 SP + 임대 받은 SP

VEST값을 아래와 같이 계산해서 가용한 스팀파워(단위:VEST)를 변수 current_shares에 할당합니다.

current_shares = float(vesting_shares) - float(delegated_shares) + float(received_shares)

이제 current_shares에 저장된 값을 스팀파워로 변환해야 합니다. Steem 클래스의 vests_to_sp() 함수를 사용하는데, 입력하는 값은 VEST가 아니라 이를 100만으로 나눈 값인 MV입니다(1MV = 1000000VESTS). 이 값을 계산해서 출력해 주면 됩니다.

current_sp = steem.vests_to_sp(current_shares/1000000)
print(current_sp, "SP")

예전에 포스팅했던 steem-python을 이용한 스팀파워 조회와 비교해 보셔도 재미있을 것 같습니다.

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


@joviansummer의 스팀 프로젝트

스팀 증인노드를 운영중입니다. @jswit에 증인투표해 주시면 감사하겠습니다.
(https://steemitwallet.com/~witnesses)

jswit 증인 노드 프로젝트를 시작합니다.

jsup 업보팅(upvoting) 서비스 소개

jsup 수혜자 지정 기능 추가

Comments

Popular posts from this blog

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

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

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