Share and Money Management 0.18devel
|
Functions to support GUI functions e.g. More...
Classes | |
class | ReverseDict |
A dictionary which can look up values by key, and keys by value. More... | |
Functions | |
def | formatShareNotesShort (share, max_len=25) |
Returns additional note to a share - short formatted. More... | |
def | formatShareNotesLong (share) |
Returns additional note to a share - long formatted. More... | |
def | formatCurrencySign (currency) |
Returns the sign of a currency or an empty string. More... | |
def | formatCurrencyShort (currency) |
Returns the currency sign or code or an empty string. More... | |
def | formatCurrencyLong (currency) |
Returns the formatted currency or an empty string. More... | |
def | formatDate (date, fmt="%d.%m.%Y") |
Returns the formatted date or an empty string. More... | |
def | formatDecimal (value, places=2, grouping=True) |
Returns the formatted decimal value or an empty string. More... | |
def | formatDuration (duration) |
Returns the given duration formatted. More... | |
def | formatDailyQuoteEvent (quote) |
Returns the DailyQuote.event formatted. More... | |
def | formatExchange (exchange) |
Returns the formatted exchange or an empty string. More... | |
def | formatMoney (value, currency, places=3, grouping=True) |
Returns the formatted decimal value incl. More... | |
def | formatPercent (value, places=3) |
Returns the formatted decimal value incl. More... | |
def | formatPosition (pos) |
Returns the formatted position or an empty string. More... | |
def | formatShare (share) |
Returns the formatted share or an empty string. More... | |
def | formatShareShort (share) |
Returns the formatted share or an empty string. More... | |
def | formatShareKind (share) |
Returns the type of the share or an empty string. More... | |
def | formatTransactionKind (transaction) |
Returns the transaction type as a string or an empty string. More... | |
def | moneyfmt (value, places=2, curr="", sep=",", dp=".", pos="", neg="-", trailneg="") |
Convert Decimal to a money formatted string. More... | |
def | wxdate2pydate (wxdate) |
Convert a date from wxDateTime to Python datetime.date . More... | |
def | pydate2wxdate (pydate) |
Convert a date from Python datetime.date to wxDateTime . More... | |
def | formatTransactionElements (transaction) |
Format all attributes of a Transaction for showing and sorting. More... | |
def | setlocale () |
Set localisation to German. More... | |
Variables | |
RE_WHITESPACES = re.compile(r"\s{2,}|[\r\n]") | |
Precompiled RE pattern to match two or more white spaces or single linebreak characters. More... | |
DAYS_PER_YEAR = decimal.Decimal("365.25") | |
Number of days in a year. More... | |
Functions to support GUI functions e.g.
to format values
def gui.helper.formatCurrencyLong | ( | currency | ) |
Returns the formatted currency or an empty string.
def gui.helper.formatCurrencyShort | ( | currency | ) |
Returns the currency sign or code or an empty string.
Referenced by gui.helper.formatMoney().
def gui.helper.formatCurrencySign | ( | currency | ) |
Returns the sign of a currency or an empty string.
def gui.helper.formatDailyQuoteEvent | ( | quote | ) |
Returns the DailyQuote.event formatted.
def gui.helper.formatDate | ( | date, | |
fmt = "%d.%m.%Y" |
|||
) |
Returns the formatted date or an empty string.
Referenced by gui.helper.formatPosition(), and gui.helper.formatTransactionElements().
def gui.helper.formatDecimal | ( | value, | |
places = 2 , |
|||
grouping = True |
|||
) |
Returns the formatted decimal value or an empty string.
Formatting will be done automatically using the database of the local conventions
value | The decimal value |
places | Required number of places after the decimal point |
grouping | Grouping part before decimal point |
References gui.helper.moneyfmt().
Referenced by gui.helper.formatTransactionElements().
def gui.helper.formatDuration | ( | duration | ) |
Returns the given duration formatted.
duration | Duration in days as a decimal.Decimal . |
Referenced by gui.helper.formatTransactionElements().
def gui.helper.formatExchange | ( | exchange | ) |
Returns the formatted exchange or an empty string.
Referenced by gui.helper.formatTransactionElements().
def gui.helper.formatMoney | ( | value, | |
currency, | |||
places = 3 , |
|||
grouping = True |
|||
) |
Returns the formatted decimal value incl.
the currency or an empty string
Formatting will be done automatically using the database of the local conventions
value | The decimal value |
currency | A smm.objects.Currency instance |
places | Required number of places after the decimal point |
grouping | Grouping part before decimal point |
References gui.helper.formatCurrencyShort(), and gui.helper.moneyfmt().
Referenced by gui.helper.formatTransactionElements().
def gui.helper.formatPercent | ( | value, | |
places = 3 |
|||
) |
Returns the formatted decimal value incl.
percent sign or an empty string
value | The decimal value |
places | Required number of places after the decimal point |
References gui.helper.moneyfmt().
def gui.helper.formatPosition | ( | pos | ) |
Returns the formatted position or an empty string.
References gui.helper.formatDate(), and gui.helper.formatShare().
def gui.helper.formatShare | ( | share | ) |
Returns the formatted share or an empty string.
Referenced by gui.helper.formatPosition(), gui.helper.formatTransactionElements(), and gui.helper.formatTransactionKind().
def gui.helper.formatShareKind | ( | share | ) |
Returns the type of the share or an empty string.
def gui.helper.formatShareNotesLong | ( | share | ) |
Returns additional note to a share - long formatted.
def gui.helper.formatShareNotesShort | ( | share, | |
max_len = 25 |
|||
) |
Returns additional note to a share - short formatted.
share | The smm.objects.Share object |
max_len | Length of the note |
def gui.helper.formatShareShort | ( | share | ) |
Returns the formatted share or an empty string.
def gui.helper.formatTransactionElements | ( | transaction | ) |
Format all attributes of a Transaction for showing and sorting.
References gui.helper.formatDate(), gui.helper.formatDecimal(), gui.helper.formatDuration(), gui.helper.formatExchange(), gui.helper.formatMoney(), gui.helper.formatShare(), and gui.helper.formatTransactionKind().
def gui.helper.formatTransactionKind | ( | transaction | ) |
Returns the transaction type as a string or an empty string.
References gui.helper.formatShare().
Referenced by gui.helper.formatTransactionElements().
def gui.helper.moneyfmt | ( | value, | |
places = 2 , |
|||
curr = "" , |
|||
sep = "," , |
|||
dp = "." , |
|||
pos = "" , |
|||
neg = "-" , |
|||
trailneg = "" |
|||
) |
Convert Decimal to a money formatted string.
value | the decimal value |
places | required number of places after the decimal point |
curr | optional currency symbol before the sign (maybe blank) |
sep | optional grouping separator (comma, period, space, or blank) |
dp | decimal point indicator (comma or period) only specify as blank when places are zero |
pos | optional sign for positive numbers: '+', space or blank |
neg | optional sign for negative numbers: '-', '(', space or blank |
trailneg | optional trailing minus indicator: '-', ')', space or blank |
Referenced by gui.helper.formatDecimal(), gui.helper.formatMoney(), and gui.helper.formatPercent().
def gui.helper.pydate2wxdate | ( | pydate | ) |
Convert a date from Python datetime.date
to wxDateTime
.
def gui.helper.setlocale | ( | ) |
Set localisation to German.
If setting the localisation to German is failing. The default localisation will be used.
def gui.helper.wxdate2pydate | ( | wxdate | ) |
Convert a date from wxDateTime
to Python datetime.date
.
gui.helper.DAYS_PER_YEAR = decimal.Decimal("365.25") |
Number of days in a year.
gui.helper.RE_WHITESPACES = re.compile(r"\s{2,}|[\r\n]") |
Precompiled RE pattern to match two or more white spaces or single linebreak characters.