- Python 3.6
- Pyhmy (Harmony Python sdk)
Install Harmony Python sdk
pip3 install pyhmy
python3 get_balance_at_time.py -a [ADDRESS] -t [TIME]
python3 get_balance_at_time.py -a one1fdtcrkpkhm2ppnu05zmddgqvledqh7g6r2tgdy -t "01 01 2020 00:00:00"
[TIME] must follow the specified format "MM DD YYYY HH:MM:SS" (including quotes) and must be the time in UTC (+0000)
To use with Testnet:
python3 get_balance_at_time.py -a [ADDRESS] -t [TIME] -n testnet
$ python3 get_balance_at_time.py -a one1fdtcrkpkhm2ppnu05zmddgqvledqh7g6r2tgdy -t "01 01 2020 00:00:00"
Found block 1941880 at exact time 1577836800 on shard 0!
Could not find block at exact time 1577836800 on shard 1.
Using block right before requested time: 1857713 at 1577836797
Could not find block at exact time 1577836800 on shard 2.
Using block right before requested time: 1897249 at 1577836798
Could not find block at exact time 1577836800 on shard 3.
Using block right before requested time: 1881234 at 1577836796
Fetching account balances...
Account: one1fdtcrkpkhm2ppnu05zmddgqvledqh7g6r2tgdy
Shard 0: 0.0
Shard 1: 217127.60762872297
Shard 2: 0.0
Shard 3: 0.0
If there is no existing block at the the specified time, the script will use the first block before the time.
You can check the time conversion using a unix time converting website, like this one.
This script just reports balance at given block; it does not check transfers in and out of the account.