diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ef9f11997d2adbf07024479927d5649eee3ea816..618cd301e1cfa5e6ef04f040ecd370a9ce310957 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -9,7 +9,8 @@ Changelog * Add BLURT chain * Remove not used STEEM chains (STEEMZERO and STEEMAPPBASE) * add Blurt class -* rshares_to_token_backed_dollar, get_token_per_mvest, token_power_to_vests and vests_to_token_power have been added for chain independent usage +* rshares_to_token_backed_dollar, get_token_per_mvest, token_power_to_vests, token_power_to_token_backed_dollar + and vests_to_token_power have been added for chain independent usage * New beempy command followlist, which can be used on HIVE to receive info about follow lists * Fix beempy info on Hive * Use Hive() on beempy when setting default_chain to "hive" diff --git a/beem/account.py b/beem/account.py index 6a901ba386e772a9ad395698b281521d4af4d8eb..f5a2b222ead7f5a26b4bae7932fa90b68802450a 100644 --- a/beem/account.py +++ b/beem/account.py @@ -576,7 +576,7 @@ class Account(BlockchainObject): tp = self.get_token_power() else: tp = token_power - voteValue = self.blockchain.rshares_to_token_backed_dollar(tp, post_rshares=post_rshares, voting_power=voting_power * 100, vote_pct=voting_weight * 100, not_broadcasted_vote=not_broadcasted_vote) + voteValue = self.blockchain.token_power_to_token_backed_dollar(tp, post_rshares=post_rshares, voting_power=voting_power * 100, vote_pct=voting_weight * 100, not_broadcasted_vote=not_broadcasted_vote) return voteValue def get_voting_value_SBD(self, post_rshares=0, voting_weight=100, voting_power=None, steem_power=None, not_broadcasted_vote=True): diff --git a/beem/blockchaininstance.py b/beem/blockchaininstance.py index 95c4f819b39189709076cfc9de7b15137f8c0c19..3ef312056c06d8013e9b326ab49a9ba08ae2fe1d 100644 --- a/beem/blockchaininstance.py +++ b/beem/blockchaininstance.py @@ -689,6 +689,20 @@ class BlockChainInstance(object): """ raise Exception("not implemented") + def token_power_to_token_backed_dollar(self, token_power, post_rshares=0, voting_power=STEEM_100_PERCENT, vote_pct=STEEM_100_PERCENT, not_broadcasted_vote=True, use_stored_data=True): + """ Obtain the resulting Token backed dollar vote value from Token power + + :param number hive_power: Token Power + :param int post_rshares: rshares of post which is voted + :param int voting_power: voting power (100% = 10000) + :param int vote_pct: voting percentage (100% = 10000) + :param bool not_broadcasted_vote: not_broadcasted or already broadcasted vote (True = not_broadcasted vote). + + Only impactful for very big votes. Slight modification to the value calculation, as the not_broadcasted + vote rshares decreases the reward pool. + """ + raise Exception("not implemented") + def get_chain_properties(self, use_stored_data=True): """ Return witness elected chain properties diff --git a/beem/hive.py b/beem/hive.py index 8e5b574af4960122ecb853ce9403124fbaba24b6..6bb7ce272a2998bdf3cbe5b53ac41101c74c6745 100644 --- a/beem/hive.py +++ b/beem/hive.py @@ -225,6 +225,9 @@ class Hive(BlockChainInstance): def token_power_to_vests(self, token_power, timestamp=None, use_stored_data=True): return self.hp_to_vests(token_power, timestamp=timestamp, use_stored_data=use_stored_data) + def token_power_to_token_backed_dollar(self, token_power, post_rshares=0, voting_power=STEEM_100_PERCENT, vote_pct=STEEM_100_PERCENT, not_broadcasted_vote=True, use_stored_data=True): + return self.hp_to_hbd(token_power, post_rshares=post_rshares, voting_power=voting_power, vote_pct=vote_pct, not_broadcasted_vote=not_broadcasted_vote, use_stored_data=use_stored_data) + def hp_to_hbd(self, hp, post_rshares=0, voting_power=STEEM_100_PERCENT, vote_pct=STEEM_100_PERCENT, not_broadcasted_vote=True, use_stored_data=True): """ Obtain the resulting HBD vote value from Hive power diff --git a/beem/steem.py b/beem/steem.py index 02d1a7b77499ad504fc6c532c5ff774f55b38d03..8d0d3b845cb8a7a10ab23cc3f971c6b2e7bcb280 100644 --- a/beem/steem.py +++ b/beem/steem.py @@ -218,6 +218,9 @@ class Steem(BlockChainInstance): def get_token_per_mvest(self, time_stamp=None, use_stored_data=True): return self.get_steem_per_mvest(time_stamp=time_stamp, use_stored_data=use_stored_data) + def token_power_to_token_backed_dollar(self, token_power, post_rshares=0, voting_power=STEEM_100_PERCENT, vote_pct=STEEM_100_PERCENT, not_broadcasted_vote=True, use_stored_data=True): + return self.sp_to_sbd(token_power, post_rshares=post_rshares, voting_power=voting_power, vote_pct=vote_pct, not_broadcasted_vote=not_broadcasted_vote, use_stored_data=use_stored_data) + def sp_to_sbd(self, sp, post_rshares=0, voting_power=STEEM_100_PERCENT, vote_pct=STEEM_100_PERCENT, not_broadcasted_vote=True, use_stored_data=True): """ Obtain the resulting SBD vote value from Steem power