You are viewing a single comment's thread:
Hey!
Here is some Python code that should work or at least get you close :)
from beem import Hive
from beem.account import Account
import requests
import datetime
from pytz import timezone
hive = Hive()
account_name = 'your_account_name'
est = timezone('EST')
now = datetime.datetime.now(est)
if now.hour == 20:
# Retrieve Hive price from a market API (CoinGecko)
hive_price = requests.get('https://api.coingecko.com/api/v3/simple/price?ids=hive&vs_currencies=usd').json()['hive']['usd']
# Retrieve account details
account = Account(account_name, hive)
# Retrieve delegation to Ecency
ecency_delegation = account.get_vesting_delegations(to_account='ecency')
# Retrieve delegation to Brofi
brofi_delegation = account.get_vesting_delegations(to_account='brofi')
# Retrieve Hive earned from Ecency
hive_earned_ecency = account.history_reverse(filter_by='claim_reward')
# Retrieve Ecency Points earned from delegation
ecency_points_earned = account.get_ecency_points()
# Retrieve Bro token balance
bro_balance = account.get_balances()['bro']
# Retrieve Hive earned from Bro
hive_earned_bro = account.get_hive_from_token('bro')
# Retrieve Hive Power earned from posts
hive_power_earned = account.get_author_rewards()
# Retrieve HP earned from Account Growth
hive_earned_growth = requests.get('https://hivestats.io/api/accountgrowth/freecompliments').json()['growthData'][0]['hive']
# Format the report
report = f"""
Daily Report for {account_name} - {now.strftime("%Y-%m-%d")}
Delegation to Ecency: {ecency_delegation:.3f} HP (${hive_price:.3f})
Delegation to Brofi: {brofi_delegation:.3f} HP (${hive_price:.3f})
Hive earned from Ecency: {hive_earned_ecency:.3f} HIVE
Ecency Points earned from delegation: {ecency_points_earned:.3f} POINTS
Bro token balance: {bro_balance:.3f} BRO
Hive earned from Bro: {hive_earned_bro:.3f} HIVE
Hive Power earned from posts: {hive_power_earned:.3f} HP
HP earned from Account Growth: {hive_earned_growth:.3f} HP
"""
# Save the report to a file
with open('daily_report.txt', 'w') as file:
file.write(report)
print("Daily report generated successfully!")
else:
print("It's not the specified time to generate the report.")
(
Replace ‘your_account_name’ with your actual name, and install been and requests libraries using:
)
This is quite amazing! The only issue for me (personally) is that I don't have a clue what to do with this code. 😅 I've never used Python before.
Fair enough :)
I’ve been having a hard time installing the beem library on my work computer (only computer I have). It seems I have root locations for two versions of the IDE and half of my pip installs go to one version or the other’s root directory, woo woo woo, probably all sounds like a bunch of whatever hahaha - let me see if I can find a way to clean up my python IDEs and get the library over to the right place and I will test it. If it works out, I can give you step by step instructions how to run the code yourself. And if someone else beats me to the punch in the meantime, works out for you and I’m cool with it too :)
View more