Skip to content

Commit

Permalink
chore(docs): homogenize (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
BobTheBuidler authored Aug 15, 2024
1 parent 8824118 commit 85681c8
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions eth_portfolio/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -807,8 +807,19 @@ def __validateitem(self, key: CategoryLabel, item: Any) -> None:

class PortfolioBalances(DefaultChecksumDict[WalletBalances], _SummableNonNumericMixin):
"""
Keyed: ``wallet -> category -> token -> balance``
"""
Aggregates :class:`~eth_portfolio.typing.WalletBalances` for multiple wallets, providing operations to sum
balances across an entire portfolio.
The class uses wallet addresses as keys and :class:`~eth_portfolio.typing.WalletBalances` objects as values.
Args:
seed: An initial seed of portfolio balances, either as a dictionary or an iterable of tuples.
Example:
>>> portfolio_balances = PortfolioBalances({'0x123': WalletBalances({'assets': TokenBalances({'0x456': Balance(Decimal('100'), Decimal('2000'))})})})
>>> portfolio_balances['0x123']['assets']['0x456'].balance
Decimal('100')
"""
def __init__(self, seed: Optional[_PBSeed] = None) -> None:
super().__init__(WalletBalances)
if seed is None:
Expand Down Expand Up @@ -976,8 +987,8 @@ class WalletBalancesRaw(DefaultChecksumDict[TokenBalances], _SummableNonNumericM
We need a new structure for key pattern: ``wallet -> token -> balance``
Example:
>>> raw_balances = WalletBalancesRaw({'0x123': TokenBalances({'0x123': Balance(Decimal('100'), Decimal('2000'))})})
>>> raw_balances['0x123']['0x123'].balance
>>> raw_balances = WalletBalancesRaw({'0x123': TokenBalances({'0x456': Balance(Decimal('100'), Decimal('2000'))})})
>>> raw_balances['0x123']['0x456'].balance
Decimal('100')
"""
def __init__(self, seed: Optional[_WTBInput] = None) -> None:
Expand Down

0 comments on commit 85681c8

Please sign in to comment.