How much SPORTS have I staked in last 30 days? - Hive-Engine API codes included.

avatar

Good morning to one and all . I hope you are having a good day.

I don't usually post I staked 'x' token 'y' amount so I thought instead of posting daily I will gather the data for the past 30 days and post it . This post is about SPORTS token and I will also show how I got the data from Hive-Engine API .

First of all I have the hive-engine transaction data gathered from Hive-Engine API from December 21st onwards . Not only data related to my account but all the transactions . I have stored it in 'Shelve' which is persistent dictionary ( in layman term it means I have stored it in key,value pair)

import shelve 
import pandas as pd
import json
from datetime import datetime as dt


s=shelve.open('Blocks\Blockchain') # This is where I have stored all transaction details
df=pd.DataFrame.from_dict(s.items()) # I am transferring the shelve data to a dataframe

df.columns=['Blocks','Transactions'] # Naming the columns

This is how the table looks like -


image.png

for i in range(0,len(df)):
    if(df['Transactions'][i]['Transaction']['contract']=='tokens'):
        if(df['Transactions'][i]['Transaction']['action']=='stake'):
            json_sports_stake=json.loads(df['Transactions'][i]['Transaction']['logs'])
            if 'events' in json_sports_stake:
                if(json_sports_stake['events'][0]['data']['symbol']=='SPORTS'):
                    if(json_sports_stake['events'][0]['data']['account']=='amr008'):
                        print(json_sports_stake['events'][0]['data'],df['Transactions'][i]['Date'])

This will give me all the staking 'amr008' account has done for SPORTS token .


image.png

Last column is date and time of staking.

I can change this to any other token and I can even change the account name too . So if you need your data , feel free to ask but remember I have transaction details from only Dec 21st right now , I will try to download full data in couple of days.

list_sports_stake=[]
for i in range(0,len(df)):
    if(df['Transactions'][i]['Transaction']['contract']=='tokens'):
        if(df['Transactions'][i]['Transaction']['action']=='stake'):
            json_sports_stake=json.loads(df['Transactions'][i]['Transaction']['logs'])
            if 'events' in json_sports_stake:
                if(json_sports_stake['events'][0]['data']['symbol']=='SPORTS'):
                    if(json_sports_stake['events'][0]['data']['account']=='amr008'):
                        list_sports_stake.append([json_sports_stake['events'][0]['data']['quantity'],df['Transactions'][i]['Date']])

Here I have just stored the data into a list instead of printing . I am storing the quantity of SPORTS staked in the list .

Then I am using DataFrame again to get the table format -

df_stake=pd.DataFrame(list_sports_stake)
df_stake.columns=['Amount','Date']


image.png

Now a simple sum function will give me the total value staked -

df_stake['Amount']=pd.to_numeric(df_stake['Amount'])# To convert string to numeric
df_stake['Amount'].sum()

Output -
100847.91300000002

So the answer to the question is - I have staked 100847 SPORTS in the past 30 days :)

The beauty of programming these is I need not code it again and again , I can use this script to get any account info by changing a few lines .

Note: The program I have written might not be the ideal way to gather info , I was just trying a few things and it came off right lol so you might fine tune this code to get results in a faster way


Regards,
MR.

Posted Using LeoFinance Beta



0
0
0.000
19 comments
avatar

100K in a month is nice.

0
0
0.000
avatar

I don't think I have earned all of them . I guess 50% of those are bought on the market . But yeah 100k this month :) I feel good about SPORTS.

0
0
0.000
avatar

Really cool to see. Maybe gonna use your code to see how much I have gotten the last 30 days :)

0
0
0.000
avatar

Want me to get it for you ? Let me know .

Posted Using LeoFinance Beta

0
0
0.000
avatar

Oh, can you check it for me? :)

0
0
0.000
avatar

Sure here you go -

SPORTS staking data for @anderssinho

Amount  Date

0 3273.869 2020-12-23T08:29:51
1 566.969 2020-12-24T08:18:12
2 11119.782 2020-12-30T08:29:45
3 4353.625 2020-12-31T07:31:36
4 3067.029 2021-01-01T10:46:48
5 702.039 2021-01-04T08:39:30
6 981.66 2021-01-05T08:29:39
7 9390.372 2021-01-06T10:33:06
8 11567.133 2021-01-08T08:10:39
9 18490.408 2021-01-11T07:52:00
10 10269.294 2021-01-12T07:53:51
11 17602.757 2021-01-13T08:24:33
12 28272.618 2021-01-17T17:32:18
13 15763.309 2021-01-18T08:34:45

Sum= 135420.864

Data is between Dec 19th to Jan 19th half day , any staking done after or before won't be shown here .

0
0
0.000
avatar

Nice can you pleaee check for guurry123

0
0
0.000
avatar
(Edited)

I hope you are asking for SPORTS -

@guurry123 account SPORTS staking -

Amount Date
3053.136 2020-12-19T09:25:18
4047.784 2020-12-20T15:05:51
802.663 2020-12-22T15:04:57
482.373 2020-12-25T18:01:27
3322.663 2020-12-26T18:07:03
3486.658 2020-12-27T15:03:57
276.854 2020-12-28T15:56:06
4616.317 2020-12-30T01:44:15
3100.192 2020-12-31T04:04:30
3345.912 2021-01-02T03:44:12
6682.569 2021-01-06T06:58:42
8720.67 2021-01-08T17:12:24
2573.491 2021-01-09T18:32:30
5269.506 2021-01-19T17:40:06

sum= 49780.788 SPORTS

NOTE : This is only after December 19th .

Posted Using LeoFinance Beta

0
0
0.000
avatar

Cna you help me check mine, for Botefarm and for Botefarm.sport

0
0
0.000
avatar

Hey sure why not.

But right now I am segregating the data month wise. So December data might not be available till tomorrow. Is it okay if I gave you Jan 1 to Jan 20th data for now?

0
0
0.000
avatar

for botefarm account SPORTS staked details -
Account name - Amount - Date and Time
botefarm 28697.122 2021-01-03T23:30:39
botefarm 43872.651 2021-01-13T06:31:12
botefarm 11991.868 2021-01-13T06:32:54
botefarm 3065.769 2021-01-13T06:42:36
botefarm 33055.216 2021-01-14T06:19:00
botefarm 60552.091 2021-01-16T14:57:54

Total - Between Jan 1st and Jan 20th - SUM = 181234.717 SPORTS

Note: if botefarm has staked to other accounts then it won't appear in botefarm data but it will appear in the staked account data.

botefarm.sport SPORTS staked details - Jan 1st to Jan 20th -

55709.238 2021-01-12T06:44:57

The above stake is actually done from @botefarm account . There are no staking done by botefarm.sport from Jan 1st till now.

Do you need any other token data?

0
0
0.000
avatar

Unfortunately; I haven't been investing in the sports token. Looks like I need to follow and do some research on this Sports token on hive-engine and will plan to buy some when the right opportunity strikes. cheers

0
0
0.000
avatar

The community is becoming active again so it is worth to look at it .

0
0
0.000