Issue with Account History paramssteemCreated with Sketch.

in #utopian-io7 years ago (edited)

I am calling the get_account_history from the nodejs Steem package using

steem.api.getAccountHistory('user',-1,100)

which I expect to get back the first 100 items based on the API guide.

params: account(string), from(uint32_t), limit(uint32_t)

The result seems to return 294 which is the total account items. If I try to pass say 'name',290,200 via

steem.api.getAccountHistory('user',290,200)

I would expect to start at the 290th item and show the 5 from 290-294 but it returns the entire history again.

Sort:  

steem.api.getAccountHistory(username, 294, 4) gives you items #290 to #294. limit is the number of extra items returned preceding the item at from. So, steem.api.getAccountHistory(username, 294, 0)will give you just the item at 294.

it seems, that in my case the api returns always the first entry (account create) no matter what from i set. except if i set from = -1 it returns the last entry. And it seem to return not more then 30 entries no matter if i set a limit greater then 30. so i have no chance to query all entries for a given account. Do others have the same problem?

with phyton api this seem to work now:

# first install this:
#sudo apt-get install libssl-dev
#sudo pip install -U steem 

# if default api node not functioning use this node (use command line)
#steempy set nodes https://rpc.buildteam.io


from steem.account import Account
a = Account("arcurus")
for op in a.history(filter_by=['fill_order']):
    str
    if op['open_owner'] == 'arcurus':
            #print(op['open_owner'] + '; ' + op['current_pays'] + '; ' + op['open_pays'] + '; ' + op['timestamp']+ ';')
        str = 'Trade; ' + op['current_pays'] + '; ' + op['open_pays'] + '; ' + op['timestamp'].replace('T',  ' ') + ';'
    else:
            str = 'Trade; ' + op['open_pays'] + '; ' + op['current_pays'] + '; ' + op['timestamp'].replace('T',  ' ') + ';'
    print(str.replace(' SBD',  '; SBD').replace(' STEEM',  '; STEEM'));```

Also, if from is -1, it will start at the latest item in the account history.

Thank you for the clarfication. It seems this isn't documented and a very strange way of doing this since most API calls for history start at a value and return the future but this seem to be backwards. Doing some tests, my full history of an account is 309 ops.

Returns the two most recent ops.

steem.api.getAccountHistory(username, 309, 1)

Returns the first user op.

steem.api.getAccountHistory(username, 1, 1)

I think this can be closed as a bug and then moved to a documentation request on that method since it isn't really noted the from and limit goes backwards and not forwards.

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Hey @boxxa I am @utopian-io. I have just super-voted you at 12% Power!

Suggestions https://utopian.io/rules

-Your contribution is less informative than others in this category.

Achievements

-I am a bot...I need someone spotting my bugs!
-You have less than 250 followers. Just gave you a gift ;)
-This is your first accepted contribution here in Utopian. Welcome!
Up-vote this comment to grow my power and help Open Source contributions like this one.

Coin Marketplace

STEEM 0.18
TRX 0.13
JST 0.029
BTC 57617.33
ETH 3012.20
USDT 1.00
SBD 2.39