create account

scotbot: get account history api endpoint by holger80

View this thread on: hive.blogpeakd.comecency.com
· @holger80 · (edited)
$31.09
scotbot: get account history api endpoint
![](https://cdn.steemitimages.com/DQmVLEQz4R6TLspWojh1uHaiMhZ2w8125zWdBp1YeodBrzM/image.png)

## New get account history api

There is a new account history api for scotbot which can be used to get information about the following types:
* `curation_reward`
* `author_reward`
* `staking_reward`
* `mining_reward`
* `comment_benefactor_reward`


### Endpoint

`GET /get_account_history`

### Query Parameters

| Name           |  Type   | Description                             |      Required      |
| :------------- | :-----: | :-------------------------------------- | :----------------: |
| account          | strings | account name                         | yes |
| token          | strings | token name                         |   |
| type | strings | limit result by reward type                   |                    |
| limit          |   int   | limit results (default 1000)             |                    |
| offset |   int   | skips results (default 0)             |          |
| author   | strings | When set, output is limited to this author  |                    |

## Some examples

* http://scot-api.steem-engine.com/get_account_history?account=holger80&type=curation_reward&token=PAL&limit=100
* http://scot-api.steem-engine.com/get_account_history?account=holger80&type=author_reward&token=PAL&limit=100
* http://scot-api.steem-engine.com/get_account_history?account=holger80&type=staking_reward&token=BEER&limit=100
* http://scot-api.steem-engine.com/get_account_history?account=holger80&type=curation_reward&token=PAL&author=minnowsupport

The results include only rewards from the 12.08.2019.

## Python script to receive detailed reward information about all rewards from the last 7 days
```
#!/usr/bin/python
from datetime import datetime, timedelta
from beem.utils import formatTimeString
import requests

def get_scot_token():
    url = "http://scot-api.steem-engine.com/info"
    # sending get request and saving the response as response object 
    r = requests.get(url = url) 
    
    # extracting data in json format 
    data = r.json()
    token_list = []
    for token in data:
        token_list.append(token)
    return token_list

def get_rewards_from_last_week(account_name, rewards, offset=0):
    url = "http://scot-api.steem-engine.com/get_account_history"
    start_date = datetime.utcnow() - timedelta(days=7)
    params = {"account": account_name, "offset": offset}
    # sending get request and saving the response as response object 
    r = requests.get(url = url, params = params) 
    
    # extracting data in json format 
    data = r.json()
    n = 0
    for reward in data:
        timestamp = formatTimeString(reward["timestamp"]).replace(tzinfo=None)
        if timestamp < start_date:
            continue
        rewards[reward["type"]][reward["token"]] += reward["int_amount"] / 10**reward["precision"]
        n += 1
    return rewards, n

if __name__ == "__main__":
    account = "holger80"
    scot_token_list = get_scot_token()
    reward_types = ["curation_reward", "author_reward", "staking_reward", "mining_reward", "comment_benefactor_reward"]
    rewards = {}
    for reward_type in reward_types:
        rewards[reward_type] = {}
        for token in scot_token_list:
            rewards[reward_type][token] = 0
    n = 0
    rewards, n = get_rewards_from_last_week(account, rewards)
    offset = 1000
    while n == 1000:
        rewards = get_rewards_from_last_week(account, rewards, offset=offset)
        offset += 1000
    for reward_type in reward_types:
        print("%s from the last 7 days:" % reward_type)
        for token in scot_token_list:
            if rewards[reward_type][token] > 0:
                print("%f %s" % (rewards[reward_type][token], token))
        print("--------------")
                
```
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 275 others
properties (23)
authorholger80
permlinkscotbot-get-account-history-api-endpoint
categoryscotbot
json_metadata"{"tags": ["scotbot", "scot", "steemleo", "palnet", "neoxian", "sct", "stem", "sct-en", "sct-freeboard"], "image": ["https://cdn.steemitimages.com/DQmVLEQz4R6TLspWojh1uHaiMhZ2w8125zWdBp1YeodBrzM/image.png"], "links": ["http://scot-api.steem-engine.com/get_account_history?account=holger80&amp;type=curation_reward&amp;token=PAL&amp;limit=100", "http://scot-api.steem-engine.com/get_account_history?account=holger80&amp;type=author_reward&amp;token=PAL&amp;limit=100", "http://scot-api.steem-engine.com/get_account_history?account=holger80&amp;type=staking_reward&amp;token=BEER&amp;limit=100", "http://scot-api.steem-engine.com/get_account_history?account=holger80&amp;type=curation_reward&amp;token=PAL&amp;author=minnowsupport"], "app": "beempy/0.23.10", "format": "markdown", "canonical_url": "https://hive.blog/scotbot/@holger80/scotbot-get-account-history-api-endpoint"}"
created2019-08-21 15:59:39
last_update2020-05-23 14:24:00
depth0
children19
last_payout2019-08-28 15:59:39
cashout_time1969-12-31 23:59:59
total_payout_value16.834 HBD
curator_payout_value14.254 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length3,794
author_reputation358,857,509,568,825
root_title"scotbot: get account history api endpoint"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id89,789,876
net_rshares89,787,854,666,676
author_curate_reward""
vote details (339)
@abh12345.stem ·
Excellent stuff! :)
πŸ‘  
properties (23)
authorabh12345.stem
permlinkpwlhmp
categoryscotbot
json_metadata{"tags":["scotbot","stem"],"app":"stemgeeks/0.1"}
created2019-08-21 16:25:39
last_update2019-08-21 16:25:39
depth1
children0
last_payout2019-08-28 16: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_length19
author_reputation410,560,470,359
root_title"scotbot: get account history api endpoint"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id89,790,747
net_rshares11,082,078,745
author_curate_reward""
vote details (1)
@ausbitbank ·
FYI it doesn't actually seem to be filtering results by token:
eg `http://scot-api.steem-engine.com/get_account_history?account=ausbitbank&symbol=PAL&limit=100` returns non PAL results as well
properties (22)
authorausbitbank
permlinkpwqdmv
categoryscotbot
json_metadata{"tags":["scotbot"],"app":"steemit/0.1"}
created2019-08-24 07:47:18
last_update2019-08-24 07:47:18
depth1
children1
last_payout2019-08-31 07:47:18
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_length192
author_reputation287,009,709,424,827
root_title"scotbot: get account history api endpoint"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id89,890,767
net_rshares0
@cadawg ·
Hi, I've noticed the mistake!

It should be `token` and not `symbol` like so:

`http://scot-api.steem-engine.com/get_account_history?account=ausbitbank&token=PAL&limit=100 `
πŸ‘  , ,
properties (23)
authorcadawg
permlinkre-ausbitbank-pwrhsn
categoryscotbot
json_metadata{"tags":["scotbot"],"app":"steempeak/1.14.19"}
created2019-08-24 22:14:45
last_update2019-08-24 22:14:45
depth2
children0
last_payout2019-08-31 22:14:45
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_length173
author_reputation100,771,927,095,688
root_title"scotbot: get account history api endpoint"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id89,913,550
net_rshares42,714,052,035
author_curate_reward""
vote details (3)
@bala41288 ·
Nice work @holger80. If permlink can be added as one of the query parameters, it will be awesome. I can pass account and permlink to get full details about a post in one shot.
πŸ‘  ,
properties (23)
authorbala41288
permlinkpwlmnz
categoryscotbot
json_metadata{"tags":["scotbot"],"users":["holger80"],"app":"steemit/0.1"}
created2019-08-21 18:14:24
last_update2019-08-21 18:14:24
depth1
children0
last_payout2019-08-28 18:14:24
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_length175
author_reputation1,525,144,340,141,343
root_title"scotbot: get account history api endpoint"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id89,794,327
net_rshares11,318,515,745
author_curate_reward""
vote details (2)
@chireerocks ·
@holger80, Keep bringing more updates which making this Ecosystem more enhancing.

Posted using [Partiko Android](https://partiko.app/referral/chireerocks)
properties (22)
authorchireerocks
permlinkchireerocks-re-holger80-scotbot-get-account-history-api-endpoint-20190823t010302881z
categoryscotbot
json_metadata{"app":"partiko","client":"android"}
created2019-08-23 01:03:03
last_update2019-08-23 01:03:03
depth1
children0
last_payout2019-08-30 01:03:03
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_length155
author_reputation327,821,690,945,691
root_title"scotbot: get account history api endpoint"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id89,844,135
net_rshares0
@contrabourdon ·
!steem2email
properties (22)
authorcontrabourdon
permlinkpzer2q
categoryscotbot
json_metadata{"app":"steemit/0.1"}
created2019-10-15 08:47:15
last_update2019-10-15 08:47:15
depth1
children1
last_payout2019-10-22 08:47:15
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_length12
author_reputation224,243,959,152,036
root_title"scotbot: get account history api endpoint"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id91,571,891
net_rshares0
@steem2email ·
Emailed &#128076;
<hr>Powered by witness <a href="https://untersatz.steem.design">untersatz</a>!
properties (22)
authorsteem2email
permlink26lyyussj3q
categoryscotbot
json_metadata""
created2019-10-15 08:47:24
last_update2019-10-15 08:47:24
depth2
children0
last_payout2019-10-22 08:47:24
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_length96
author_reputation112,313,680
root_title"scotbot: get account history api endpoint"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id91,571,900
net_rshares0
@flemingfarm ·
Works like a charm!
I have  setup on my desktop now but I had to add a "raw_input()" to the end of the script so it would not automatically close the  terminal window at the completion of the script. 

Are we able to pull data for more than a 7 day period?
πŸ‘  , ,
properties (23)
authorflemingfarm
permlinkpwli2d
categoryscotbot
json_metadata{"tags":["scotbot"],"app":"steemit/0.1"}
created2019-08-21 16:35:03
last_update2019-08-21 16:35:03
depth1
children4
last_payout2019-08-28 16:35:03
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_length256
author_reputation1,376,521,384,301,602
root_title"scotbot: get account history api endpoint"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id89,791,121
net_rshares85,223,698,416
author_curate_reward""
vote details (3)
@tonimontana ·
Yes you can get more than 7 days. I think all you have to do is edit this line (20)
"start_date = datetime.utcnow() - timedelta(days=7)". If you want e.g. 14 days you would change it to
"start_date = datetime.utcnow() - timedelta(days=14)". 
πŸ‘  , ,
properties (23)
authortonimontana
permlinkre-flemingfarm-pwlmy6
categoryscotbot
json_metadata{"tags":["scotbot"],"app":"steempeak/1.14.19"}
created2019-08-21 18:20:33
last_update2019-08-21 18:20:33
depth2
children3
last_payout2019-08-28 18:20:33
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_length242
author_reputation4,423,485,388,975
root_title"scotbot: get account history api endpoint"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id89,794,481
net_rshares30,111,638,637
author_curate_reward""
vote details (3)
@flemingfarm ·
When I try that it does not give me the correct outputs. When looking at the transaction history on SE explorer the script only seems to go back 9 days max. When I set it to 14 days the same output is given. Maybe a limitation of the api?
πŸ‘  , ,
properties (23)
authorflemingfarm
permlinkpwlpnv
categoryscotbot
json_metadata{"tags":["scotbot"],"app":"steemit/0.1"}
created2019-08-21 19:19:09
last_update2019-08-21 19:19:09
depth3
children2
last_payout2019-08-28 19:19:09
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_length238
author_reputation1,376,521,384,301,602
root_title"scotbot: get account history api endpoint"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id89,796,171
net_rshares14,966,579,047
author_curate_reward""
vote details (3)
@midlet ·
So does this mean we can get a tribes version of Steemworld?

Posted using [Partiko iOS](https://partiko.app/referral/midlet)
πŸ‘  ,
properties (23)
authormidlet
permlinkmidlet-re-holger80-scotbot-get-account-history-api-endpoint-20190821t175507610z
categoryscotbot
json_metadata{"app":"partiko","client":"ios"}
created2019-08-21 17:55:09
last_update2019-08-21 17:55:09
depth1
children1
last_payout2019-08-28 17:55:09
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_length125
author_reputation293,267,832,592,637
root_title"scotbot: get account history api endpoint"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id89,793,743
net_rshares11,308,749,913
author_curate_reward""
vote details (2)
@jasonbu ·
@steemchiller just added SE tokens to his interface. You can switch to a view of your account for a specific token.

Posted using [Partiko Android](https://partiko.app/referral/jasonbu)
πŸ‘  ,
properties (23)
authorjasonbu
permlinkjasonbu-re-midlet-midlet-re-holger80-scotbot-get-account-history-api-endpoint-20190823t105459400z
categoryscotbot
json_metadata{"app":"partiko","client":"android"}
created2019-08-23 10:55:00
last_update2019-08-23 10:55:00
depth2
children0
last_payout2019-08-30 10:55:00
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_length185
author_reputation26,685,474,279,235
root_title"scotbot: get account history api endpoint"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id89,857,936
net_rshares15,663,509,488
author_curate_reward""
vote details (2)
@neoxian-city ·
This post has been rewarded with an upvote from city trail as part of Neoxian City Curation program ![](https://cdn.steemitimages.com/DQmZ4SqDess96h8nz3E2BnRczepPF9WaYa2MrGdgGbf6yTT/ezgif-5-4ec7c52a09cb.gif) ![](https://cdn.steemitimages.com/DQmZLjMtgpjfPzjf6xmHUpCH4DYmFjXRZJrHb3KmUkQCcSj/ezgif-5-7a2c6f978f8b.gif). We are glad to see you using #neoxian tag in your posts. If you still not in our discord, you can join our [Discord Server](https://discord.gg/TvcKKcJ) for more goodies and giveaways.

Do you know that you can earn NEOXAG tokens as passive income by delegating to @neoxiancityvb. Here are some handy links for delegations: [100SP](https://beta.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=neoxiancityvb&vesting_shares=200000%20VESTS), [250SP](https://beta.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=neoxiancityvb&vesting_shares=500000%20VESTS), [500SP](https://beta.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=neoxiancityvb&vesting_shares=999000%20VESTS), [1000SP](https://beta.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=neoxiancityvb&vesting_shares=2000000%20VESTS). Read more about the bot in [this post](https://www.neoxian.city/neoxian/@zaku/introducing-neoxag-bid-bot-sink-delegate-steem-power-and-earn-neoxag-each-and-every-day-passive-profit-for-upvote-buyers). 
<center>[![](https://ipfs.busy.org/ipfs/QmTLAG3rV9fUr2N9XrdoVrAmot4APQXZQeaYJqbw9Jtp1G)](https://discord.gg/TvcKKcJ)</center> 

properties (22)
authorneoxian-city
permlinkneoxian-1566411936810
categoryscotbot
json_metadata{"tags":["neoxian"]}
created2019-08-21 18:25:36
last_update2019-08-21 18:25:36
depth1
children0
last_payout2019-08-28 18: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_length1,500
author_reputation66,002,411,848,758
root_title"scotbot: get account history api endpoint"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id89,794,618
net_rshares0
@partiko ·
Thank you so much for participating in the Partiko Delegation Plan Round 1! We really appreciate your support! As part of the delegation benefits, we just gave you a 3.00% upvote! Together, let’s change the world!
properties (22)
authorpartiko
permlinkre-scotbot-get-account-history-api-endpoint-20190821t163012
categoryscotbot
json_metadata"{"app": "partiko"}"
created2019-08-21 16:30:15
last_update2019-08-21 16:30:15
depth1
children0
last_payout2019-08-28 16:30:15
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_length213
author_reputation39,207,160,334,751
root_title"scotbot: get account history api endpoint"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id89,790,893
net_rshares0
@pennsif ·
This post has been included in the latest edition of  [**The Steem News**](https://steemit.com/steem/@pennsif/the-steem-news-21-august-2019) - a compilation of the key news stories on the Steem blockchain.
properties (22)
authorpennsif
permlinkpwmal8
categoryscotbot
json_metadata{"tags":["scotbot"],"links":["https://steemit.com/steem/@pennsif/the-steem-news-21-august-2019"],"app":"steemit/0.1"}
created2019-08-22 02:51:09
last_update2019-08-22 02:51:09
depth1
children0
last_payout2019-08-29 02:51:09
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_length205
author_reputation636,410,097,572,565
root_title"scotbot: get account history api endpoint"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id89,807,733
net_rshares0
@steem-plus ·
SteemPlus upvote
Hi, @holger80!

You just got a **4.89%** upvote from SteemPlus!
To get higher upvotes, earn more SteemPlus Points (SPP). On your Steemit wallet, check your SPP balance and click on "How to earn SPP?" to find out all the ways to earn.
If you're not using SteemPlus yet, please check our last posts in [here](https://steemit.com/@steem-plus) to see the many ways in which SteemPlus can improve your Steem experience on Steemit and Busy.
properties (22)
authorsteem-plus
permlinkscotbot-get-account-history-api-endpoint---vote-steemplus
categoryscotbot
json_metadata{}
created2019-08-21 18:19:48
last_update2019-08-21 18:19:48
depth1
children0
last_payout2019-08-28 18:19:48
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_length435
author_reputation247,952,188,232,400
root_title"scotbot: get account history api endpoint"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id89,794,450
net_rshares0
@steem-ua ·
#### Hi @holger80!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your **UA** account score is currently 7.611 which ranks you at **#49** across all Steem accounts.
Your rank has not changed in the last three days.

In our last Algorithmic Curation Round, consisting of 147 contributions, your post is ranked at **#1**. Congratulations! 
##### Evaluation of your UA score:

* Your follower network is great!
* The readers appreciate your great work!
* Great user engagement! You rock!


**Feel free to join our [@steem-ua Discord server](https://discord.gg/KpBNYGz)**
properties (22)
authorsteem-ua
permlinkre-scotbot-get-account-history-api-endpoint-20190822t082822z
categoryscotbot
json_metadata"{"app": "beem/0.20.23"}"
created2019-08-22 08:28:24
last_update2019-08-22 08:28:24
depth1
children0
last_payout2019-08-29 08:28:24
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_length624
author_reputation23,214,230,978,060
root_title"scotbot: get account history api endpoint"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id89,816,467
net_rshares0