How to count the trades using steem api

in #dev6 years ago

Just in case you need, here a small code to query the steem api for done trades on the internal market. Its my first phyton script, so dont judge me too much :) It has no error handling at all, so make sure the trades are done right. You can check here.
Sadly the normal steem api for the default nodes did not work, so i had to switch to another node.

Much thx @crokkon for helping with the python api and choosing an functioning node.
Thx also to @holger80 he posted here a nice list about the state of current nodes.

Have fun!

# 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'));```
Sort:  

Welcome back :)

thx, currently mainly to finish my taxes, but i posted also some ideas here:

i think the post earnings should be fixed in steem...
For example:

  • double the votes on accounts that earned less then 1000 dollar in he last year
  • double the votes on accounts that earned less then 1000 dollar in he last month
  • double the votes on accounts that earned less then 100 dollar in he last year
  • double the votes on accounts that earned less then 100 dollar in he last month
  • double the votes on accounts that earned less then 10 dollar in he last year
  • double the votes on accounts that earned less then 10 dollar in he last month

Of course only for verified accounts...

Are these your reward proposals?

just came into my mind...

Is it possible?

why not, they can change everything...

You seem to have a heart for everyone in the community. You wanted all to enjoy the benefits of the platform. I remember someone who also have this kind of idea, unfortunately he's out now because the big guys doesn't like it.

It's great to see you here sir @holger80

I'm not able to run "sudo apt-get install libssl-dev" on a Mac, do you know how I can do it?

sorry, im not a mac user yet. sudo... is for linux - unbuntu. I guess you can install phyton and ssl also on a mac and then run the phyton script above, or you can install a virtual machine and install unbuntu there...

Thank you, will try it on a Raspberry Pi and see if it works :)

Congratulations @arcurus! You have received a personal award!

2 Years on Steemit
Click on the badge to view your Board of Honor.

Do not miss the last post from @steemitboard:
SteemitBoard World Cup Contest - Play-off for third result


Participate in the SteemitBoard World Cup Contest!
Collect World Cup badges and win free SBD
Support the Gold Sponsors of the contest: @good-karma and @lukestokes


Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Congratulations @arcurus! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 3 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.32
TRX 0.11
JST 0.034
BTC 66384.36
ETH 3272.25
USDT 1.00
SBD 4.27