Settlements & Legs
Exploring Settlements and Legs
The settlements metrics aims to provide an understanding the dynamics of digital asset trades Polymesh network, covering key aspects of settlement activities.
Settlements
Nb of settlements
Total number of transactions settled on the network
Settlements
Number of settlements by status
Number of successful vs. failed vs rejected settlements.
Settlements
Settlements over time
Number of settlements by status by month.
Nb of settlements
This metric helps gauging the overall activity level within the Polymesh network in terms of trade settlements.
How many trades of assets have been settled on the Polymesh network?
SQL
SELECT COUNT(DISTINCT ID)
FROM
settlements

GraphQL
query {
settlements {
totalCount
}
}

Number of settlements by status
This metric captures the operational efficiency and reliability of the settlement process on the network by differentiating between successful, failed, and rejected settlements.
How efficient and reliable is the settlement process on the Polymesh network, based on the outcomes of settlement attempts?
SQL
SELECT
s.result,
COUNT(*) AS number_of_settlements
FROM
settlements s
JOIN
blocks b ON s.created_block_id::integer = b.block_id
GROUP BY
s.result
ORDER BY
s.result;

GraphQL
query {
settlements {
nodes {
result
}
}
}
This query retrieves all the settlements and their corresponding result
field. Since the provided schema doesn't support aggregation directly, you'll need to handle the grouping and counting of settlements by their result in the application code.
Settlements over time
This metric provides an overview of the settlement process's outcomes on the Polymesh network, segmented into categories like successful, failed, and rejected settlements over each month.
SQL
SELECT
DATE_TRUNC('month', b.datetime) AS settlement_month,
s.result as status,
COUNT(*) AS number_of_settlements
FROM
settlements s
JOIN
blocks b ON s.created_block_id::integer = b.block_id
GROUP BY
settlement_month, s.result
ORDER BY
settlement_month ASC, s.result;

GraphQL
query {
settlements {
nodes {
result
createdBlock {
datetime
}
}
}
}
This query retrieves all the settlements along with their corresponding result
and createdBlock.datetime
fields. Since the provided schema doesn't support aggregation directly, you'll need to handle the grouping and counting of settlements by settlement month and result in the application code.
Last updated