create account

My Hive Engine Tokens Snapshot Tool: Now It Becomes Really Useful by gadrian

View this thread on: hive.blogpeakd.comecency.com
· @gadrian · (edited)
$41.80
My Hive Engine Tokens Snapshot Tool: Now It Becomes Really Useful
In my [previous public update](https://peakd.com/hive-139531/@gadrian/added-one-more-brick-to-the-hive-engine-snapshot-tool) for this tool, the most important addition was support for diesel pools.

I guess the tool started to shape up quite well with today's [commits](https://github.com/gadrian78/he-tokens-snapshot/tree/main). By the way, I'm anxious to see VSC starting to get used, so I can build something for it too.

In the meantime, this is what's new for today's update:
* added persistent caching with a 15 minutes expiration time for Coingecko prices, market and diesel pool data, to avoid hitting the APIs too often (when the script is run for different accounts)
* added save snapshots as JSON files automatically after processing. Here's a nice image:
![image.png](https://files.peakd.com/file/peakd-hive/gadrian/23tGXhPaDXTHwis8eXyAy2eYmyNYERE3bf52xGP8D6hCCC9tzcihxW8GMggPK5szkLyoZ.png)
* created `setup.sh` which:
  * takes two variables for the project directory and the snapshots base directory (which must be updated to work!)
  * takes a list of usernames (which again, needs to be updated for your needs)
  * installs Python dependencies
  * creates and activates a service and a timer to run our tool for the list of accounts at 8am or later, when the computer is turned on and has access to the internet (`FIXED:` I just realized that this shell script runs all accounts with the same set of tokens defined in `config.py` for all accounts; I suggest you to use the `multiaccount-manual-run.sh` for snapshots of a different set of tokens for each account, until I fix this)
  * tests this setup
* created `multiaccount-manual-run.sh` where someone can add all their accounts and associated lists of tokens and the script will run for each account (and create a snapshot json file for each account); persistent caching helps prevent asking for the same data from APIs multiple times. I added this shell script thinking about people who don't want the snapshots being taken automatically (maybe because they don't want to add a service and a timer on their system or because they want it to run it occasionally)
* refactored the code as it grew and I could improve its structure

The structure of snapshots is as follows. Under the `SNAPSHOTS_DIR` (defined in `config.py` or taken as an argument in command line), we have:
```
[SMAPSHOTS_DIR]/[USERNAME]/[SNAPSHOT_TYPE]/timestamped-filename.json
```
Something like this:
![image.png](https://files.peakd.com/file/peakd-hive/gadrian/23u5tS6u8hVEbj4qYpVNwVsagTE4jYvsk7as8GdWhBvUmzyGHMGMH6Uch55xgvYmDX6GV.png)

The exact filename depends on the snapshot type. For example, for a weekly snapshot, it would be something like `2025-W26.json`.

At this point, after I fix (FIXED!) the oversight about the automated script using the same list of tokens for every account, instead of distinct ones (which can easily be circumvented for the short term by running the `multiaccount-manual-run.sh`), this side of the tool is pretty much feature complete.

What could be done next would be to use the snapshot JSON files to generate some reports / charts, but that's another big project by itself.

What I can say is that, despite using AIs to help with this project, I learned (or remembered where I already knew somewhere in the back of my mind) a bunch through it.

### UPDATES:
* Fixed `setup.sh` to work with a list of accounts AND the associated list of tokens for each account.
  * the script also deactivates and removes old service and timer at the beginning, if they were previously set; helpful if you change the code and re-run `setup.sh`
  * I carved out the part about deactivation and removal of the the current service and timer and added it to the shell script `stop-automation.sh`, in case someone doesn't want automated snapshots taken anymore
* created an `uninstall.sh` script with the obvious functionality (read the updated `readme.md` on the repo for more info)

Any feedback?
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 175 others
👎  , , , , , , , , , , , ,
properties (23)
authorgadrian
permlinkmy-hive-engine-tokens-snapshot-tool-now-it-becomes-really-useful
categoryhive-139531
json_metadata{"app":"peakd/2025.6.2","format":"markdown","image":["https://files.peakd.com/file/peakd-hive/gadrian/23tGXhPaDXTHwis8eXyAy2eYmyNYERE3bf52xGP8D6hCCC9tzcihxW8GMggPK5szkLyoZ.png","https://files.peakd.com/file/peakd-hive/gadrian/23u5tS6u8hVEbj4qYpVNwVsagTE4jYvsk7as8GdWhBvUmzyGHMGMH6Uch55xgvYmDX6GV.png"],"tags":["portfolio-tracker","snapshot-tool","automated-snapshots","portfolio-value","vibe-coding","hive-engine","proofofbrain"],"users":["gadrian"]}
created2025-06-25 16:22:06
last_update2025-06-26 11:17:03
depth0
children14
last_payout2025-07-02 16:22:06
cashout_time1969-12-31 23:59:59
total_payout_value20.912 HBD
curator_payout_value20.890 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length3,958
author_reputation636,266,133,719,289
root_title"My Hive Engine Tokens Snapshot Tool: Now It Becomes Really Useful"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id143,563,744
net_rshares146,136,144,218,097
author_curate_reward""
vote details (252)
@davideownzall ·
$0.04
How do you determine the second layer tokens value? I mean it's a market maker so it takes the buy orders value? 
👍  
properties (23)
authordavideownzall
permlinkre-gadrian-syfd5m
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2025.6.2","image":[],"users":[]}
created2025-06-25 18:39:27
last_update2025-06-25 18:39:27
depth1
children3
last_payout2025-07-02 18:39:27
cashout_time1969-12-31 23:59:59
total_payout_value0.020 HBD
curator_payout_value0.021 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length113
author_reputation100,892,654,960,654
root_title"My Hive Engine Tokens Snapshot Tool: Now It Becomes Really Useful"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id143,565,710
net_rshares150,942,313,448
author_curate_reward""
vote details (1)
@gadrian · (edited)
Ignore the previous message if you read it.

It's the average between buy price and sell price. If buy price is missing, it is considered 0, so in effect the price of the token is considered half the sell price. If both are missing, the price is 0.
👍  
👎  , , , , , , , , , , , , ,
properties (23)
authorgadrian
permlinkre-davideownzall-syfdws
categoryhive-139531
json_metadata{"tags":"hive-139531"}
created2025-06-25 18:55:39
last_update2025-06-25 19:20:45
depth2
children2
last_payout2025-07-02 18:55:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length248
author_reputation636,266,133,719,289
root_title"My Hive Engine Tokens Snapshot Tool: Now It Becomes Really Useful"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id143,565,898
net_rshares-37,018,171,697
author_curate_reward""
vote details (15)
@davideownzall ·
$0.04
could make a dynamic calculation? tokens with a wide spread or low sale volume i guess its optimistic even the average
👍  
properties (23)
authordavideownzall
permlinkre-gadrian-syffci
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2025.6.2","image":[],"users":[]}
created2025-06-25 19:26:48
last_update2025-06-25 19:26:48
depth3
children1
last_payout2025-07-02 19:26:48
cashout_time1969-12-31 23:59:59
total_payout_value0.020 HBD
curator_payout_value0.021 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length118
author_reputation100,892,654,960,654
root_title"My Hive Engine Tokens Snapshot Tool: Now It Becomes Really Useful"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id143,566,246
net_rshares148,143,870,268
author_curate_reward""
vote details (1)
@djbravo ·
$0.04
I haven't used this tool before, but since you said that using it makes things easier, I will definitely try using it. 
👍  
properties (23)
authordjbravo
permlinkre-gadrian-2025626t41622263z
categoryhive-139531
json_metadata{"tags":["portfolio-tracker","snapshot-tool","automated-snapshots","portfolio-value","vibe-coding","hive-engine","proofofbrain"],"app":"ecency/4.2.0-vision","format":"markdown+html"}
created2025-06-25 23:16:24
last_update2025-06-25 23:16:24
depth1
children1
last_payout2025-07-02 23:16:24
cashout_time1969-12-31 23:59:59
total_payout_value0.021 HBD
curator_payout_value0.022 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length119
author_reputation355,993,617,575,935
root_title"My Hive Engine Tokens Snapshot Tool: Now It Becomes Really Useful"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id143,569,676
net_rshares152,887,606,893
author_curate_reward""
vote details (1)
@gadrian ·
Well... I built it. How can I say otherwise? 😄
👎  , , , , , , , , , ,
properties (23)
authorgadrian
permlinkre-djbravo-sygnqq
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2025.6.2"}
created2025-06-26 11:25:39
last_update2025-06-26 11:25:39
depth2
children0
last_payout2025-07-03 11:25:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length46
author_reputation636,266,133,719,289
root_title"My Hive Engine Tokens Snapshot Tool: Now It Becomes Really Useful"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id143,578,149
net_rshares-8,086,255,974
author_curate_reward""
vote details (11)
@egris ·
Developed always makes a new moment ... thanks for sharing this beautiful content with us 💕
properties (22)
authoregris
permlinksyhg9x
categoryhive-139531
json_metadata{"app":"hiveblog/0.1"}
created2025-06-26 21:41:57
last_update2025-06-26 21:41:57
depth1
children0
last_payout2025-07-03 21:41:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length91
author_reputation347,663,633,434
root_title"My Hive Engine Tokens Snapshot Tool: Now It Becomes Really Useful"
beneficiaries
0.
accountdbuzz
weight500
max_accepted_payout1,000,000.000 HBD
percent_hbd0
post_id143,593,229
net_rshares0
@jfang003 ·
$0.04
@jfang003 "I think the tool is looking good. Are you having A..."
I think the tool is looking good. Are you having AI refractor the code for you? I remember that being a tedious step, but its good so that the code is more easily maintained.
👍  
properties (23)
authorjfang003
permlinkre-gadrian-3ceksyejd
categoryhive-139531
json_metadata{"app":"leothreads/0.3","format":"markdown","tags":["leofinance"],"canonical_url":"https://inleo.io/threads/view/jfang003/re-gadrian-3ceksyejd","isPoll":false,"pollOptions":{},"dimensions":[]}
created2025-06-26 05:07:45
last_update2025-06-26 05:07:45
depth1
children1
last_payout2025-07-03 05:07:45
cashout_time1969-12-31 23:59:59
total_payout_value0.020 HBD
curator_payout_value0.021 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length174
author_reputation636,067,630,711,361
root_title"My Hive Engine Tokens Snapshot Tool: Now It Becomes Really Useful"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id143,573,195
net_rshares153,139,731,660
author_curate_reward""
vote details (1)
@gadrian ·
> Are you having AI refractor the code for you?

It helps here and there. But I do more and more myself to avoid running out of free prompts for the day (for multiple models, lol).

> I remember that being a tedious step, but its good so that the code is more easily maintained.

It's quite complicated to get the AI involved in this. You have to be smart about it, because otherwise you could run out of prompts after... 1 prompt, and not even that one completed.
👎  , , , , , , , , , , ,
properties (23)
authorgadrian
permlinkre-jfang003-sygnmn
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2025.6.2"}
created2025-06-26 11:23:12
last_update2025-06-26 11:23:12
depth2
children0
last_payout2025-07-03 11:23:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length464
author_reputation636,266,133,719,289
root_title"My Hive Engine Tokens Snapshot Tool: Now It Becomes Really Useful"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id143,578,103
net_rshares-8,077,488,856
author_curate_reward""
vote details (12)
@pizzabot · (edited)
RE: My Hive Engine Tokens Snapshot Tool: Now It Becomes Really Useful
<center>PIZZA!


$PIZZA slices delivered:
@rzc24-nftbbg<sub>(3/10)</sub> tipped @gadrian (x2)


<sub>Come get [MOON](https://moon.hive.pizza)ed!</sub></center>
properties (22)
authorpizzabot
permlinkre-my-hive-engine-tokens-snapshot-tool-now-it-becomes-really-useful-20250628t094052z
categoryhive-139531
json_metadata"{"app": "pizzabot"}"
created2025-06-28 09:40:51
last_update2025-06-28 11:31:48
depth1
children0
last_payout1969-12-31 23:59:59
cashout_time2025-07-05 09:40:51
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length159
author_reputation7,502,365,506,933
root_title"My Hive Engine Tokens Snapshot Tool: Now It Becomes Really Useful"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id143,620,692
net_rshares0
@rzc24-nftbbg ·
$0.05
Wow! You are into coding too. Impressive!

!PIZZA

!BBH
👍  , , , ,
properties (23)
authorrzc24-nftbbg
permlinkre-gadrian-syk87h
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2025.6.3","image":[],"users":[]}
created2025-06-28 09:40:30
last_update2025-06-28 09:40:30
depth1
children3
last_payout1969-12-31 23:59:59
cashout_time2025-07-05 09:40:30
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.046 HBD
promoted0.000 HBD
body_length55
author_reputation129,772,100,109,921
root_title"My Hive Engine Tokens Snapshot Tool: Now It Becomes Really Useful"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id143,620,690
net_rshares164,988,317,484
author_curate_reward""
vote details (5)
@gadrian ·
$0.06
I used to. Nowadays... I rely mostly on AI. The coding world moved on while I took a break. But the fundamentals are there.
👍  
👎  , , , , , , , , , , , , ,
properties (23)
authorgadrian
permlinkre-rzc24-nftbbg-2025628t13623666z
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"ecency/4.2.0-vision","format":"markdown+html"}
created2025-06-28 10:06:24
last_update2025-06-28 10:06:24
depth2
children2
last_payout1969-12-31 23:59:59
cashout_time2025-07-05 10:06:24
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.055 HBD
promoted0.000 HBD
body_length123
author_reputation636,266,133,719,289
root_title"My Hive Engine Tokens Snapshot Tool: Now It Becomes Really Useful"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id143,620,938
net_rshares195,236,779,161
author_curate_reward""
vote details (15)
@rzc24-nftbbg ·
$0.00
Great for you. Coding is almost completely foreign to me. 😆😅

!LOLZ

!PIZZA
👍  , , ,
properties (23)
authorrzc24-nftbbg
permlinkre-gadrian-sykdcc
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2025.6.3","image":[],"users":[]}
created2025-06-28 11:31:27
last_update2025-06-28 11:31:27
depth3
children1
last_payout1969-12-31 23:59:59
cashout_time2025-07-05 11:31:27
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.004 HBD
promoted0.000 HBD
body_length75
author_reputation129,772,100,109,921
root_title"My Hive Engine Tokens Snapshot Tool: Now It Becomes Really Useful"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id143,621,843
net_rshares17,471,295,411
author_curate_reward""
vote details (4)