-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
92 lines (80 loc) · 3.2 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import config
from calculate_daily_payment_data import calculate_daily_payment_data
from calculate_daily_retention_data import calculate_daily_retention_data
from calculate_daily_transaction_data import calculate_daily_transaction_data
from calculate_market_data import calculate_market_data
from calculate_rolling_retention_data import calculate_rolling_retention_data
from calculate_total_user_data import calculate_total_user_data
from final_data_general import final_data_general
from final_data_payments import final_data_payments
from final_data_rolling_retention import final_data_rolling_retention
from final_data_transactions import final_data_transactions
from final_data_user import final_data_user
from manage_realized_market_capitalization import update_realized_market_capitalization
from manage_transactions import update_token_transactions
from util import logging
log = logging.get_custom_logger(__name__, config.LOG_LEVEL)
if __name__ == "__main__":
log.info('fetching new token transactions')
update_token_transactions()
update_realized_market_capitalization()
#
# calculate interim results
#
calculate_total_user_data()
# structure ./raw/stats_daily_payments/<token>.csv
calculate_daily_payment_data()
calculate_daily_transaction_data()
calculate_daily_retention_data()
calculate_rolling_retention_data()
calculate_market_data()
#
# calculate final results to use in the frontend
#
final_data_general()
final_data_payments()
final_data_transactions()
final_data_user()
final_data_rolling_retention()
# structure ./raw/stats_total_amount_of_coins/<token>.csv
# calculate_total_amount_of_coins()
# - total amount of coins
# - velocity of currency per day
# see https://www.investopedia.com/articles/investing/091814/what-bitcoins-intrinsic-value.asp
# -- M1: circulating supply
# * - daily payments - total amount
# * - daily payments - count
# * - daily payment - average
# * - daily transactions by type
# * - daily new users (no transaction before)
# * - user count total
# * - daily active users (accounts with at least 1 transaction on this day)
# * - daily payments (count) by address
# * - daily payments (amount) by address
# user_count/<currency>.csv
# <date>,<count>
# - rolling retention
# - daily swap volume
# if token['source_exchange_rates'] == 'coin_gecko':
# source_coin_gecko.update_exchange_rates(token['symbol'])
# elif token['source_exchange_rates'] == 'nexustracker':
# source_nexustracker.update_exchange_rates(token['symbol'])
#
#
# update_realized_market_capitalization(token)
# update_balances(token)
#
# #
# # calculation of results
# #
#
# calculate_realized_market_capitalization(token['symbol'])
# calculate_token_holder_stats(token)
#
# log.debug('--------')
# # postphone calculation of top token holders to have the other data faster
# for token in config.TOKEN:
# calculate_top_token_holder(token)
#
# if len(token['lending_contracts']) > 0:
# calculate_top_token_holder_normalized(token)