data.gearbox
Fetches Gearbox data and returns it as polars.Dataframe.
Using GearboxData you can:
Get the list of liquidation events
Get dynamic health factor for the position
Examples
from datetime import datetime
from web3cat.data import GearboxData
data = GearboxData(start = datetime(2022, 1, 1), end = datetime(2022, 12, 12))
# List all liquidations
data.liquidations
- class web3cat.data.gearbox.GearboxData(start: int | datetime.datetime, end: int | datetime.datetime, **kwargs)
Bases:
DataCoreData for the gearbox protocol
- Parameters:
start – Starting timepoint
end – Ending timepoint
- credit_account_data(credit_accounts: List[str], timepoints: List[int | datetime.datetime]) DataFrame
Health factor for borrower in a credit pool specified by token.
- Parameters:
borrower_address – address of the borrower
token – token that determines the credit pool
timepoints – a list of timepoints
- Returns:
A dataframe with fields
Field
Type
Description
timestampTimestamp for the snapshot of the balance
dateDate for the timestamp
block_numberNumber of the block
tokenPool token name
facadeAddress of the credit facade
managerAddress of the credit manager
tvlPosition Total value
health_factorPosition Health factor
- property liquidations: DataFrame
Dataframe with liquidation events.
Field
Type
Description
timestampTimestamp for the snapshot of the balance
dateDate for the timestamp
block_numberNumber of the block
transaction_hashHash of the liquidation tx
tokenName of the token for the Gearbox pool
borrowerAddress of the liquidated borrower
liquidatorAddress of the liquidator
toAddress of the liquidation funds receiver
remaining_fundsAmount of remaining funds