lending_pool_summaries_for_company
Schema: lib_lending
Description
This function allows you to retrieve lending pool summaries for all lending pools within a lending protocol. These summaries include total supply, total borrows, total reserves, and the price of the underlying token. This information can be useful for analyzing the overall health and activity of a lending protocol.
Usage
Signature
lib_lending.lending_pool_summaries_for_company(
company text,
start_time timestamptz default now() - '1 week'::interval
)
Parameters
Name | Type | Description |
---|---|---|
company | text | The name of the company whose lending pool summaries you want to retrieve. |
start_time | timestamptz | Only consider data points that occurred at or after this specific time. The assumption is lending pools are updated regularly, so you can generally set this to a value like now() - '1 week'::interval to get query results faster |
Results
The function returns a table with the following columns:
Name | Type | Description |
---|---|---|
contract | text | The address of the lending pool contract |
symbol | text | The symbol of the lending pool |
underlying_symbol | text | The symbol of the underlying token. |
updated_time | timestamptz | The timestamp of when the data was last updated. |
price | numeric | The price of the underlying token. |
total_supply | numeric | The total amount of underlying token supplied to the lending pool. |
total_cash | numeric | The total amount of underlying token available for borrow. |
total_borrows | numeric | The total amount of underlying token borrowed from the lending pool. |
total_reserves | numeric | The total amount of underlying token held in reserve by the lending protocol. |
total_supply_usd | numeric | The USD value of the total amount of underlying token supplied to the lending pool. |
total_cash | numeric | The USD value of the total underlying token available for borrow. |
total_borrows_usd | numeric | The USD value of the total underlying token borrowed from the lending pool. |
total_reserves_usd | numeric | The USD value underlying token held in reserve by the lending protocol. |
Examples
Retrieve lending pool summaries for a specific company
select * from lib_lending.lending_pool_summaries_for_company('company_name');
Retrieve lending pool summaries for a company ABC with a custom start time
select * from lib_lending.lending_pool_summaries_for_company('ABC', now() - '3 days'::interval);