data.gearbox

Fetches Gearbox data and returns it as polars.Dataframe.

Using GearboxData you can:

  1. Get the list of liquidation events

  2. 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: DataCore

Data 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

timestamp

numpy.int64

Timestamp for the snapshot of the balance

date

datetime.datetime

Date for the timestamp

block_number

numpy.int64

Number of the block

token

str

Pool token name

facade

str

Address of the credit facade

manager

str

Address of the credit manager

tvl

numpy.float64

Position Total value

health_factor

numpy.float64

Position Health factor

property liquidations: DataFrame

Dataframe with liquidation events.

Field

Type

Description

timestamp

numpy.int64

Timestamp for the snapshot of the balance

date

datetime.datetime

Date for the timestamp

block_number

int

Number of the block

transaction_hash

str

Hash of the liquidation tx

token

str

Name of the token for the Gearbox pool

borrower

str

Address of the liquidated borrower

liquidator

str

Address of the liquidator

to

str

Address of the liquidation funds receiver

remaining_funds

numpy.float64

Amount of remaining funds

credit_accounts(timepoint: Optional[Union[int, datetime]] = None) List[str]

A list of all credit accounts for a specific timepoint (incl v1)

Parameters:

timepoint – a timepoint to fetch credit accounts for

property pools: List[Dict[str, Any]]

Gearbox pools data.