statistics_client
This client enables to obtain statistical information from the subgraph.
Code Example
Module
class human_protocol_sdk.statistics.statistics_client.DailyEscrowData(timestamp, escrows_total, escrows_pending, escrows_solved, escrows_paid, escrows_cancelled)
Bases: object
A class used to specify daily escrow data.
__init__(timestamp, escrows_total, escrows_pending, escrows_solved, escrows_paid, escrows_cancelled)
Initializes a DailyEscrowData instance.
Parameters:
timestamp (
datetime
) – Timestampescrows_total (
int
) – Total escrowsescrows_pending (
int
) – Pending escrowsescrows_solved (
int
) – Solved escrowsescrows_paid (
int
) – Paid escrowsescrows_cancelled (
int
) – Cancelled escrows
class human_protocol_sdk.statistics.statistics_client.DailyHMTData(timestamp, total_transaction_amount, total_transaction_count, daily_unique_senders, daily_unique_receivers)
Bases: object
A class used to specify daily HMT data.
__init__(timestamp, total_transaction_amount, total_transaction_count, daily_unique_senders, daily_unique_receivers)
Initializes a DailyHMTData instance.
Parameters:
timestamp (
datetime
) – Timestamptotal_transaction_amount (
int
) – Total transaction amounttotal_transaction_count (
int
) – Total transaction countdaily_unique_senders (
int
) – Total unique sendersdaily_unique_receivers (
int
) – Total unique receivers
class human_protocol_sdk.statistics.statistics_client.DailyPaymentData(timestamp, total_amount_paid, total_count, average_amount_per_worker)
Bases: object
A class used to specify daily payment data.
__init__(timestamp, total_amount_paid, total_count, average_amount_per_worker)
Initializes a DailyPaymentData instance.
Parameters:
timestamp (
datetime
) – Timestamptotal_amount_paid (
int
) – Total amount paidtotal_count (
int
) – Total countaverage_amount_per_worker (
int
) – Average amount per worker
class human_protocol_sdk.statistics.statistics_client.DailyWorkerData(timestamp, active_workers)
Bases: object
A class used to specify daily worker data.
__init__(timestamp, active_workers)
Initializes a DailyWorkerData instance.
Parameters:
timestamp (
datetime
) – Timestampactive_workers (
int
) – Active workers
class human_protocol_sdk.statistics.statistics_client.EscrowStatistics(total_escrows, daily_escrows_data)
Bases: object
A class used to specify escrow statistics.
__init__(total_escrows, daily_escrows_data)
Initializes a EscrowStatistics instance.
Parameters:
total_escrows (
int
) – Total escrowsdaily_escrows_data (
List
[DailyEscrowData
]) – Daily escrows data
class human_protocol_sdk.statistics.statistics_client.HMTHolder(address, balance)
Bases: object
A class used to specify HMT holder.
__init__(address, balance)
Initializes a HMTHolder instance.
Parameters:
address (
str
) – Holder addressbalance (
int
) – Holder balance
class human_protocol_sdk.statistics.statistics_client.HMTHoldersParam(address=None, order_direction='asc')
Bases: object
A class used to specify parameters for querying HMT holders.
__init__(address=None, order_direction='asc')
Initializes a HMTHoldersParam instance.
Parameters:
address (
Optional
[str
]) – Filter by holder’s addressorder_direction (
str
) – Optional. Direction of sorting (‘asc’ for ascending, ‘desc’ for descending)
class human_protocol_sdk.statistics.statistics_client.HMTStatistics(total_transfer_amount, total_transfer_count, total_holders)
Bases: object
A class used to specify HMT statistics.
__init__(total_transfer_amount, total_transfer_count, total_holders)
Initializes a HMTStatistics instance.
Parameters:
total_transfer_amount (
int
) – Total transfer amounttotal_transfer_count (
int
) – Total transfer counttotal_holders (
int
) – Total holders
class human_protocol_sdk.statistics.statistics_client.PaymentStatistics(daily_payments_data)
Bases: object
A class used to specify payment statistics.
__init__(daily_payments_data)
Initializes a PaymentStatistics instance.
Parameters: daily_payments_data (
List
[DailyPaymentData
]) – Daily payments data
class human_protocol_sdk.statistics.statistics_client.StatisticsClient(chain_id=ChainId.POLYGON_AMOY)
Bases: object
A client used to get statistical data.
__init__(chain_id=ChainId.POLYGON_AMOY)
Initializes a Statistics instance
Parameters: chain_id (
ChainId
) – Chain ID to get statistical data from
get_escrow_statistics(filter=<human_protocol_sdk.filter.StatisticsFilter object>)
Get escrow statistics data for the given date range.
Parameters: filter (
StatisticsFilter
) – Object containing the date rangeReturn type:
EscrowStatistics
Returns: Escrow statistics data
Example:
get_hmt_daily_data(filter=<human_protocol_sdk.filter.StatisticsFilter object>)
Get HMT dailt statistics data for the given date range.
Parameters: filter (
StatisticsFilter
) – Object containing the date rangeReturn type:
List
[DailyHMTData
]Returns: HMT statistics data
Example:
get_hmt_holders(param=<human_protocol_sdk.statistics.statistics_client.HMTHoldersParam object>)
Get HMT holders data with optional filters and ordering.
Parameters: param (
HMTHoldersParam
) – Object containing filter and order parametersReturn type:
List
[HMTHolder
]Returns: List of HMT holders
Example:
get_hmt_statistics()
Get HMT statistics data.
Return type:
HMTStatistics
Returns: HMT statistics data
Example:
get_payment_statistics(filter=<human_protocol_sdk.filter.StatisticsFilter object>)
Get payment statistics data for the given date range.
Parameters: filter (
StatisticsFilter
) – Object containing the date rangeReturn type:
PaymentStatistics
Returns: Payment statistics data
Example:
get_worker_statistics(filter=<human_protocol_sdk.filter.StatisticsFilter object>)
Get worker statistics data for the given date range.
Parameters: filter (
StatisticsFilter
) – Object containing the date rangeReturn type:
WorkerStatistics
Returns: Worker statistics data
Example:
exception human_protocol_sdk.statistics.statistics_client.StatisticsClientError
Bases: Exception
Raises when some error happens when getting data from subgraph.
class human_protocol_sdk.statistics.statistics_client.WorkerStatistics(daily_workers_data)
Bases: object
A class used to specify worker statistics.
__init__(daily_workers_data)
Initializes a WorkerStatistics instance.
Parameters: daily_workers_data (
List
[DailyWorkerData
]) – Daily workers data
Last updated