In [74]:
import pandas as pd
import numpy as np
import datetime as dt
from steemdata import SteemData
In [52]:
db = SteemData().db
In [ ]:
In [65]:
conditions = {
'created': '$gte': dt.datetime.now() - dt.timedelta(days=90),
'total_payout_value.amount': {"$gt": 5},
'tags': 'dtube'
}
projection = {
'_id': 0,
'author': 1,
'total_payout_value.amount': 1,
}
In [66]:
posts = list(db['Posts'].find(conditions, projection))
In [67]:
len(posts)
Out[67]:
In [68]:
posts2 = [{
"author": x['author'],
"reward": x['total_payout_value']['amount']
} for x in posts]
In [69]:
posts2[0]
Out[69]:
In [70]:
df = pd.DataFrame(posts2)
In [71]:
rewards = df[df.author != 'heimindanger'].sort_values('reward', ascending=False)
rewards.head()
Out[71]:
In [72]:
rewards['reward'].sum() / 4
Out[72]:
In [ ]:
In [ ]: