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)
Bases: object
A class used to specify daily HMT data.
__init__(timestamp, total_transaction_amount, total_transaction_count)
Initializes a DailyHMTData instance.
Parameters:
timestamp (
datetime
) – Timestamptotal_transaction_amount (
int
) – Total transaction amounttotal_transaction_count (
int
) – Total transaction count
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.HMTStatistics(total_transfer_amount, total_transfer_count, total_holders, holders, daily_hmt_data)
Bases: object
A class used to specify HMT statistics.
__init__(total_transfer_amount, total_transfer_count, total_holders, holders, daily_hmt_data)
Initializes a HMTStatistics instance.
Parameters:
total_transfer_amount (
int
) – Total transfer amounttotal_transfer_count (
int
) – Total transfer counttotal_holders (
int
) – Total holdersholders (
List
[HMTHolder
]) – Holdersdaily_hmt_data (
List
[DailyHMTData
]) – Daily HMT data
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(param=<human_protocol_sdk.statistics.statistics_client.StatisticsParam object>)
Get escrow statistics data for the given date range.
Parameters: param (
StatisticsParam
) – Object containing the date rangeReturn type:
EscrowStatistics
Returns: Escrow statistics data
Example:
get_hmt_statistics(param=<human_protocol_sdk.statistics.statistics_client.StatisticsParam object>)
Get HMT statistics data for the given date range.
Parameters: param (
StatisticsParam
) – Object containing the date rangeReturn type:
HMTStatistics
Returns: HMT statistics data
Example:
get_payment_statistics(param=<human_protocol_sdk.statistics.statistics_client.StatisticsParam object>)
Get payment statistics data for the given date range.
Parameters: param (
StatisticsParam
) – Object containing the date rangeReturn type:
PaymentStatistics
Returns: Payment statistics data
Example:
get_worker_statistics(param=<human_protocol_sdk.statistics.statistics_client.StatisticsParam object>)
Get worker statistics data for the given date range.
Parameters: param (
StatisticsParam
) – 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.StatisticsParam(date_from=None, date_to=None, limit=None)
Bases: object
A class used to specify statistics params.
__init__(date_from=None, date_to=None, limit=None)
Initializes a StatisticsParam instance.
Parameters:
date_from (
Optional
[datetime
]) – Statistical data from datedate_to (
Optional
[datetime
]) – Statistical data to datelimit (
Optional
[int
]) – Limit of statistical data
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