helium_py.currency.balance.Balance

class helium_py.currency.balance.Balance(balance_in_currency: Union[int, float, Decimal], currency_type: str)[source]

Bases: object

Represents a balance in a particular currency.

__init__(balance_in_currency: Union[int, float, Decimal], currency_type: str)[source]

Initialize balance with a currency type and amount.

Methods

__init__(balance_in_currency, currency_type)

Initialize balance with a currency type and amount.

divided_by(balance)

Divide two Balances of the same type together.

minus(balance)

Subtract two Balances of the same type together.

plus(balance)

Add two Balances of the same type together.

times(balance)

Multiply two Balances of the same type together.

to_data_credits([oracle_price])

Convert a balance to DATA_CREDITS.

to_network_tokens([oracle_price])

Convert a balance to NETWORK_TOKENS.

to_string([max_decimal_places, show_ticker])

Convert Balance objects to a string.

to_test_network_tokens([oracle_price])

Convert a balance to TEST_NETWORK_TOKENS.

to_usd([oracle_price])

Convert a balance to US_DOLLARS.

Attributes

currency_type

balance_in_currency

divided_by(balance: Balance) Balance[source]

Divide two Balances of the same type together.

minus(balance: Balance) Balance[source]

Subtract two Balances of the same type together.

plus(balance: Balance) Balance[source]

Add two Balances of the same type together.

times(balance: Balance) Balance[source]

Multiply two Balances of the same type together.

to_data_credits(oracle_price: Optional[Balance] = None) Balance[source]

Convert a balance to DATA_CREDITS.

to_network_tokens(oracle_price: Optional[Balance] = None) Balance[source]

Convert a balance to NETWORK_TOKENS.

to_string(max_decimal_places: Optional[int] = None, show_ticker: Optional[bool] = True) str[source]

Convert Balance objects to a string.

to_test_network_tokens(oracle_price: Optional[Balance] = None) Balance[source]

Convert a balance to TEST_NETWORK_TOKENS.

to_usd(oracle_price: Optional[Balance] = None) Balance[source]

Convert a balance to US_DOLLARS.