bittensor.utils.balance#
Classes#
Represents the bittensor balance of the wallet, stored as rao (int). |
Module Contents#
- class bittensor.utils.balance.Balance(balance)#
Represents the bittensor balance of the wallet, stored as rao (int). This class provides a way to interact with balances in two different units: rao and tao. It provides methods to convert between these units, as well as to perform arithmetic and comparison operations.
- Variables:
- Parameters:
Initialize a Balance object. If balance is an int, it’s assumed to be in rao. If balance is a float, it’s assumed to be in tao.
- Parameters:
balance (Union[int, float]) – The initial balance, in either rao (if an int) or tao (if a float).
- __abs__()#
- __float__()#
Convert the Balance object to a float. The resulting value is in tao.
- __int__()#
Convert the Balance object to an int. The resulting value is in rao.
- __neg__()#
- __pos__()#
- __repr__()#
- __rich__()#
- __rich_rao__()#
- __str__()#
Returns the Balance object as a string in the format “symbolvalue”, where the value is in tao.
- __str_rao__()#
- static from_float(amount)#
Given tao, return
Balance()
object with rao(int
) and tao(float
), where rao = int(tao*pow(10,9)) :param amount: The amount in tao. :type amount: float- Returns:
A Balance object representing the given amount.
- Parameters:
amount (float)
- static from_rao(amount)#
Given rao, return Balance object with rao(
int
) and tao(float
), where rao = int(tao*pow(10,9))- Parameters:
amount (int) – The amount in rao.
- Returns:
A Balance object representing the given amount.
- static from_tao(amount)#
Given tao, return Balance object with rao(
int
) and tao(float
), where rao = int(tao*pow(10,9))- Parameters:
amount (float) – The amount in tao.
- Returns:
A Balance object representing the given amount.
- property tao#