11 namespace account_statistics {
65 from_stat.transfers_from++;
66 from_stat.scorum_sent += op.
amount;
69 to_stat.transfers_to++;
70 to_stat.scorum_received += op.
amount;
78 auto& db =
_self.database();
87 , _my(new detail::account_statistics_plugin_impl(*this))
96 boost::program_options::options_description& cfg)
99 "account-stats-bucket-size",
100 boost::program_options::value<std::string>()->default_value(
"[60,3600,21600,86400,604800,2592000]"),
101 "Track account statistics by grouping orders into buckets of equal size measured in seconds specified as a "
102 "JSON array of numbers")(
103 "account-stats-history-per-bucket", boost::program_options::value<uint32_t>()->default_value(100),
104 "How far back in time to track history for each bucker size, measured in the number of buckets (default: 100)")(
105 "account-stats-tracked-accounts", boost::program_options::value<std::string>()->default_value(
"[]"),
106 "Which accounts to track the statistics of. Empty list tracks all accounts.");
128 return _my->_tracked_buckets;
133 return _my->_maximum_history_per_bucket_size;
#define API_ACCOUNT_STATISTICS
SCORUM_DEFINE_PLUGIN(account_statistics, scorum::account_statistics::account_statistics_plugin)
uint32_t get_max_history_per_bucket() const
account_statistics_plugin(application *app)
virtual ~account_statistics_plugin()
virtual void plugin_startup() override
Begin normal runtime operations.
virtual void plugin_initialize(const boost::program_options::variables_map &options) override
Perform early startup routines and register plugin indexes, callbacks, etc.
const flat_set< uint32_t > & get_tracked_buckets() const
virtual void plugin_set_program_options(boost::program_options::options_description &cli, boost::program_options::options_description &cfg) override
Fill in command line parameters used by the plugin.
account_statistics_plugin_impl(account_statistics_plugin &plugin)
virtual void process_post_operation(const bucket_object &bucket, const operation_notification &o) override
virtual ~account_statistics_plugin_impl()
void register_api_factory(const std::string &name, std::function< fc::api_ptr(const api_context &)> factory)
application & app() const
tracks the blockchain state in an extensible manner
account_statistics_plugin & _self
fc::shared_map< account_name_type, account_metric > account_statistic
void operator()(const T &) const
activity_operation_process(chain::database &db, const activity_bucket_object &b)
const activity_bucket_object & _bucket
void operator()(const transfer_operation &op) const
operation_process(chain::database &db, const bucket_object &b)
void operator()(const T &) const
const bucket_object & _bucket
const protocol::operation & op
Transfers SCR from one account to another.
account_name_type to
Account to transfer asset to.
asset amount
The amount of asset to transfer from from to to.