@@ -50,3 +50,30 @@ comma-separated values:
5050To contribute price information you can either update an existing file, by
5151adding entries for days where data is missing, or create a new file for a
5252newly-supported ledger and add historical price data.
53+
54+ ## Add metrics
55+
56+ To add a new metric, you should do the following steps.
57+
58+ First, create a relevant function in the script
59+ ` tokenomics_decentralization/metrics.py ` . The function should be named
60+ ` compute_{metric_name} ` and is given two parameters:
61+ (i) a list of tuples, where each tuple's first value is a numeric type that
62+ defines the balance of an address;
63+ (ii) an integer that defines the circulation (that is the sum of all address
64+ balances).
65+
66+ Second, import this new function to ` tokenomics_decentralization/analyze.py ` .
67+ In this file, include the function as the value to the dictionary
68+ ` compute_functions ` of the ` analyze_snapshot ` function, using as a key the name
69+ of the function (which will be used in the config file).
70+
71+ Third, add the name of the metric (which was used as the key to the dictionary
72+ in ` analyze.py ` ) to the file ` config.yaml ` under ` metrics ` . You can optionally
73+ also add it under the plot parameters, if you want it to be included in the
74+ plots by default.
75+
76+ Finally, you should add unit tests for the new metric
77+ [ here] ( https://github.com/Blockchain-Technology-Lab/tokenomics-decentralization/tree/main/tests )
78+ and update the [ corresponding documentation
79+ page] ( https://github.com/Blockchain-Technology-Lab/tokenomics-decentralization/blob/main/docs/metrics.md )
0 commit comments