LiquidityResult

Documentation for eth_defi.uniswap_v2.liquidity.LiquidityResult class.

class LiquidityResult[source]

Sampled liquidity on Uniswap v2 pool.

Reserves are returned in raw token amounts.

Attributes summary

pair_contract

Direct Contract proxy to the pair contract

token0

Side a

token1

Side b

token0_reserve

Liquidity a

token1_reserve

Liquidity b

block_number

When this sample was token

Methods summary

__init__(pair_contract, token0, token1, ...)

get_liquidity_for_token(token_address)

Get liquidity value of a given pair token.

pair_contract: web3.contract.Contract

Direct Contract proxy to the pair contract

token0: HexAddress

Side a

token1: HexAddress

Side b

token0_reserve: int

Liquidity a

token1_reserve: int

Liquidity b

block_number: int

When this sample was token

get_liquidity_for_token(token_address)[source]

Get liquidity value of a given pair token.

Because Uniswap liquidity tuple can be either order.

Raise

UnmatchedToken

Parameters

token_address (Union[HexAddress, str]) –

Return type

int

__init__(pair_contract, token0, token1, token0_reserve, token1_reserve, block_number)
Parameters
  • pair_contract (web3.contract.Contract) –

  • token0 (HexAddress) –

  • token1 (HexAddress) –

  • token0_reserve (int) –

  • token1_reserve (int) –

  • block_number (int) –

Return type

None