Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Currency

Help on class Currency in module pydicts.currency:

class Currency(builtins.object)
 |  Currency(amount=None, currency='EUR')
 |
 |  ## Class to manage currencies in officegenerator
 |  ##
 |  ## The symbol is defined by code with self.symbol()
 |
 |  Methods defined here:
 |
 |  __add__(self, other)
 |      Adds two Currency objects.
 |      Raises CurrencyOperationsException if currencies are different.
 |
 |      Args: other (Currency): The other Currency object to add.
 |
 |  __eq__(self, other)
 |      Compares two Currency objects for equality.
 |      They are equal if both amount and currency are the same.
 |
 |  __ge__(self, other)
 |      Compares if this Currency object is greater than or equal to another.
 |      Raises CurrencyOperationsException if currencies are different.
 |
 |      Args: other (Currency): The other Currency object to compare with.
 |
 |  __gt__(self, other)
 |      Compares if this Currency object is greater than another.
 |      Raises CurrencyOperationsException if currencies are different.
 |
 |      Args: other (Currency): The other Currency object to compare with.
 |
 |  __init__(self, amount=None, currency='EUR')
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  __le__(self, other)
 |      Compares if this Currency object is less than or equal to another.
 |      Raises CurrencyOperationsException if currencies are different.
 |
 |      Args: other (Currency): The other Currency object to compare with.
 |
 |  __lt__(self, other)
 |      Compares if this Currency object is less than another.
 |      Raises CurrencyOperationsException if currencies are different.
 |
 |      Args: other (Currency): The other Currency object to compare with.
 |
 |  __mul__(self, other)
 |      # Original comments:
 |      # ## Si las divisas son distintas, queda el resultado con la divisa del primero
 |      # ## En caso de querer multiplicar por un numero debe ser despues. For example: other*4
 |
 |  __neg__(self)
 |      Returns a new Currency object with the negated amount.
 |
 |  __repr__(self)
 |      Return repr(self).
 |
 |  __sub__(self, other)
 |      Subtracts one Currency object from another.
 |      Raises CurrencyOperationsException if currencies are different.
 |
 |      Args: other (Currency): The other Currency object to subtract.
 |
 |  __truediv__(self, other)
 |      Divides the Currency object by another Currency object of the same type.
 |      Raises CurrencyOperationsException if currencies are different.
 |
 |      Args: other (Currency): The other Currency object to divide by.
 |
 |  isGETZero(self)
 |      Checks if the currency amount is greater than or equal to zero.
 |
 |  isGTZero(self)
 |      Checks if the currency amount is strictly greater than zero.
 |
 |  isLETZero(self)
 |      Checks if the currency amount is less than or equal to zero.
 |
 |  isLTZero(self)
 |      Checks if the currency amount is strictly less than zero.
 |
 |  isZero(self)
 |      Checks if the currency amount is exactly zero.
 |
 |  round(self, decimals=2)
 |      Rounds the currency amount to the specified number of decimals.
 |
 |      Args:
 |          decimals (int, optional): The number of decimal places to round to. Defaults to 2.
 |
 |      Returns:
 |          Decimal: The rounded amount.
 |
 |  string(self, decimals=2)
 |      Returns a typical currency string representation (e.g., "12.34 €").
 |
 |      Args:
 |          decimals (int, optional): The number of decimal places to round to. Defaults to 2.
 |
 |      Returns:
 |          str: The formatted currency string.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
 |
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |
 |  __hash__ = None