VaultPortfolio

Documentation for eth_defi.vault.base.VaultPortfolio Python class.

class VaultPortfolio[source]

Track assets and balances in a vault.

  • Offchain method to track what assets a vault contains

  • Takes TradingUniverse as an input and resolves all relevant balances the vault holds for this trading universe

  • Because of brainrotten and awful ERC-20 token standard, the vault does not know what tokens it owns and this needs to be specific offchain

  • See VaultBase.fetch_portfolio()

Attributes summary

tokens

Get list of tokens held in this portfolio

spot_erc20

List of tokens and their amounts

dex_hints

For route finding, which DEX tokens should use.

Methods summary

__init__(spot_erc20[, dex_hints])

get_position_count()

get_raw_spot_balances(web3)

Convert spot balances to raw token balances

is_spot_only()

Do we have only ERC-20 hold positions in this portfolio

spot_erc20: eth_defi.vault.lower_case_dict.LowercaseDict

List of tokens and their amounts

Addresses not checksummed

dex_hints: dict[eth_typing.evm.HexAddress, list[str]]

For route finding, which DEX tokens should use.

Token address -> DEX id string mapping

property tokens: set[eth_typing.evm.HexAddress]

Get list of tokens held in this portfolio

is_spot_only()[source]

Do we have only ERC-20 hold positions in this portfolio

Return type

bool

get_raw_spot_balances(web3)[source]

Convert spot balances to raw token balances

Parameters

web3 (web3.main.Web3) –

Return type

eth_defi.vault.lower_case_dict.LowercaseDict

__init__(spot_erc20, dex_hints=<factory>)
Parameters
Return type

None