participant_health_for_company
Schema: lib_lending
Description
This function calculates the health for each borrower/lender within a lending protocol for a given company.
Usage
Signature
lib_lending.participant_health_for_company(company text, include_lending_pool_as_participant boolean, include_zero_balances boolean)
Parameters
Name | Type | Description |
---|---|---|
company | text | The name of the company; participant health will be calculated for all participants in any of the company's lending pools |
include_lending_pool_as_participant | boolean | Should the lending pool contract be considered a participant if it holds a balance of LP token? Defaults to false |
include_zero_balances | boolean | Should zero balances (no current borrows or lends) be included in the results? Defaults to false? |
Results
Column Name | Description |
---|---|
participant | The address of the participant |
usd_lend_balance | The total USD value the participant has lent across all pools |
usd_collateral_value | The total USD value of the participant's collateral, taking into account the latest collateral factor |
usd_borrow_balance | The total USD value the participant has borrowed across all pools |
lend_symbols | An array of all token symbols the participant is currently lending |
borrow_symbols | An array of all token symbols the participant is currently borrowing |
Examples
Get participant health for all participants in company XYZ's pools
select *
from lib_lending.participant_health_for_company('XYZ');
Get participant health for all participants in company XYZ's pools including zero-balances and lending contracts
select *
from lib_lending.participant_health_for_company(
'XYZ',
include_lending_pool_as_participant=>true,
include_zero_balances=>true
);