Skip to content

Commit

Permalink
adding difficulty min, max and median
Browse files Browse the repository at this point in the history
  • Loading branch information
Srayman committed Jul 6, 2019
1 parent 46782d3 commit 47d8b81
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion node_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import json
import time
import datetime
import statistics
from collections import defaultdict
from sys import exit
from time import sleep
Expand Down Expand Up @@ -58,7 +59,7 @@ async def main():
print("Connecting to: "+URL)

# defining a params dict for the parameters to be sent to the API
data1 = {'action':'active_difficulty'}
data1 = {'action':'active_difficulty','include_trend': 'true'}
data2 = {'action':'confirmation_active'}
data3 = {'action':'stats','type':'objects'}
data4 = {'action':'block_count','include_cemented':'true'}
Expand Down Expand Up @@ -100,6 +101,9 @@ async def main():
data['network_minimum'] = response['network_minimum']
data['network_current'] = response['network_current']
data['multiplier'] = response['multiplier']
data['difficulty_trend_min'] = str(min(map(float,response['difficulty_trend'])))
data['difficulty_trend_max'] = str(max(map(float,response['difficulty_trend'])))
data['difficulty_trend_median'] = str(statistics.median(map(float,response['difficulty_trend'])))
data['alarm_operations_count'] = response3['node']['alarm']['operations']['count']
data['ledger_bootstrap_weights_count'] = response3['node']['ledger']['bootstrap_weights']['count']
data['active_roots_count'] = response3['node']['active']['roots']['count']
Expand Down

0 comments on commit 47d8b81

Please sign in to comment.