Skip to content

Commit

Permalink
Added 'fees' and 'accumulated fees' data series to statement of asset…
Browse files Browse the repository at this point in the history
…s series

Issue: #2933
Signed-off-by: OnkelDok <90478568+OnkelDok@users.noreply.github.com>
[squashed commits; small change when collecting fees; rebased to master]
Signed-off-by: Andreas Buchen <andreas.buchen@gmail.com>
  • Loading branch information
OnkelDok authored and buchen committed Aug 7, 2022
1 parent 6df2afa commit 18a624f
Show file tree
Hide file tree
Showing 15 changed files with 75 additions and 3 deletions.
Expand Up @@ -606,6 +606,8 @@ public class Messages extends NLS
public static String LabelExchangeRate;
public static String LabelExchangeRates;
public static String LabelExport;
public static String LabelFees;
public static String LabelFeesAccumulated;
public static String LabelFirstDayOfWeek;
public static String LabelFontSize;
public static String LabelFormatJSON;
Expand Down
Expand Up @@ -1228,6 +1228,10 @@ LabelExpenses = Expenses

LabelExport = Export ''{0}''

LabelFees = Fees

LabelFeesAccumulated = Fees (accumulated)

LabelFirstDayOfWeek = First day of week

LabelFontSize = Font size
Expand Down
Expand Up @@ -1214,6 +1214,10 @@ LabelExpenses = N\u00E1klady

LabelExport = Exportovat ''{0}''

LabelFees = Poplatky

LabelFeesAccumulated = Poplatky (nahromad\u011Bné)

LabelFirstDayOfWeek = Prvn\u00ED den v t\u00FDdnu

LabelFontSize = Velikost p\u00EDsma
Expand Down
Expand Up @@ -1213,6 +1213,10 @@ LabelExpenses = Ausgaben

LabelExport = ''{0}'' exportieren

LabelFees = Gebühren

LabelFeesAccumulated = Gebühren (akkumuliert)

LabelFirstDayOfWeek = Erster Tag der Woche

LabelFontSize = Schriftgr\u00F6\u00DFe
Expand Down
Expand Up @@ -1211,6 +1211,10 @@ LabelExpenses = Gastos

LabelExport = Exportar ''{0}''

LabelFees = Tasas

LabelFeesAccumulated = Tasas (acumulado)

LabelFirstDayOfWeek = Primer dia de la semana

LabelFontSize = Tama\u00F1o de fuente
Expand Down
Expand Up @@ -1216,6 +1216,10 @@ LabelExpenses = D\u00E9penses

LabelExport = Exporter ''{0}''

LabelFees = Honoraires

LabelFeesAccumulated = Honoraires (accumul\u00E9)

LabelFirstDayOfWeek = Premier jour de la semaine

LabelFontSize = Taille de police
Expand Down
Expand Up @@ -1215,6 +1215,10 @@ LabelExpenses = Spese

LabelExport = Esporta ''{0}''

LabelFees = Tasse

LabelFeesAccumulated = Tasse (accumulato)

LabelFirstDayOfWeek = Primo giorno della settimana

LabelFontSize = Dimensione del font
Expand Down
Expand Up @@ -1211,6 +1211,10 @@ LabelExpenses = Uitgaven
LabelExport = Exporteer ''{0}''
LabelFees = Vergoedingen
LabelFeesAccumulated = Vergoedingen (gecumuleerd)
LabelFirstDayOfWeek = Eerste dag van de week
LabelFontSize = Lettertypegrootte
Expand Down
Expand Up @@ -1213,6 +1213,10 @@ LabelExpenses = Despesas

LabelExport = Exportar ''{0}''

LabelFees = Taxas

LabelFeesAccumulated = Taxas (acumulado)

LabelFirstDayOfWeek = Primeiro dia da semana

LabelFontSize = Tamanho da fonte
Expand Down
Expand Up @@ -1215,6 +1215,10 @@ LabelExpenses = \u0417\u0430\u0442\u0440\u0430\u0442\u044B

LabelExport = \u042D\u043A\u0441\u043F\u043E\u0440\u0442 ''{0}''

LabelFees = \u0413\u043E\u043D\u043E\u0440\u0430\u0440\u044B

LabelFeesAccumulated = \u0413\u043E\u043D\u043E\u0440\u0430\u0440\u044B (\u043D\u0430\u043A\u043E\u043F\u043B\u0435\u043D\u043D\u044B\u0439)

LabelFirstDayOfWeek = \u041F\u0435\u0440\u0432\u044B\u0439 \u0434\u0435\u043D\u044C \u043D\u0435\u0434\u0435\u043B\u0438

LabelFontSize = \u0420\u0430\u0437\u043C\u0435\u0440 \u0448\u0440\u0438\u0444\u0442\u0430
Expand Down
Expand Up @@ -37,7 +37,7 @@ public enum ClientDataSeries
{
TOTALS, INVESTED_CAPITAL, ABSOLUTE_INVESTED_CAPITAL, TRANSFERALS, TAXES, ABSOLUTE_DELTA, ABSOLUTE_DELTA_ALL_RECORDS, //
DIVIDENDS, DIVIDENDS_ACCUMULATED, INTEREST, INTEREST_ACCUMULATED, DELTA_PERCENTAGE, INTEREST_CHARGE, INTEREST_CHARGE_ACCUMULATED, //
EARNINGS, EARNINGS_ACCUMULATED;
EARNINGS, EARNINGS_ACCUMULATED, FEES, FEES_ACCUMULATED;
}

/**
Expand Down Expand Up @@ -81,7 +81,7 @@ String buildUUID(Object instance)
private boolean isLineChart = true;
private boolean isBenchmark = false;
private int lineWidth = 2;

private RGB color;

private boolean showArea;
Expand Down Expand Up @@ -270,4 +270,4 @@ public String toString()
{
return getSearchLabel() + " [" + getUUID() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
Expand Up @@ -140,6 +140,14 @@ private void buildStatementOfAssetsDataSeries()
Messages.LabelAccumulatedEarnings, Colors.DARK_GREEN.getRGB());
availableSeries.add(series);

series = new DataSeries(DataSeries.Type.CLIENT, ClientDataSeries.FEES, Messages.LabelFees,
Colors.GRAY.getRGB());
series.setLineChart(false);
availableSeries.add(series);

series = new DataSeries(DataSeries.Type.CLIENT, ClientDataSeries.FEES_ACCUMULATED,
Messages.LabelFeesAccumulated, Colors.GRAY.getRGB());
availableSeries.add(series);
}

private void buildPerformanceDataSeries(Client client, IPreferenceStore preferences, ColorWheel wheel)
Expand Down
Expand Up @@ -87,6 +87,12 @@ private void addClient(DataSeries series, PerformanceIndex clientIndex)
values = accumulateAndToDouble(add(clientIndex.getDividends(), clientIndex.getInterest()),
Values.Amount.divider());
break;
case FEES:
values = toDouble(add(clientIndex.getFees(), clientIndex.getInterest()), Values.Amount.divider());
break;
case FEES_ACCUMULATED:
values = accumulateAndToDouble(clientIndex.getFees(), Values.Amount.divider());
break;
default:
throw new IllegalArgumentException(String.valueOf(series.getInstance()));
}
Expand Down
Expand Up @@ -11,6 +11,7 @@
import name.abuchen.portfolio.model.Client;
import name.abuchen.portfolio.model.Portfolio;
import name.abuchen.portfolio.model.Transaction.Unit;
import name.abuchen.portfolio.model.Transaction.Unit.Type;
import name.abuchen.portfolio.money.CurrencyConverter;
import name.abuchen.portfolio.money.Money;
import name.abuchen.portfolio.money.Values;
Expand Down Expand Up @@ -57,6 +58,7 @@
interestCharge = new long[size];
buys = new long[size];
sells = new long[size];
fees = new long[size];

collectTransferalsAndTaxes(interval);

Expand Down Expand Up @@ -144,6 +146,8 @@ private void collectTransferalsAndTaxes(Interval interval)
addValue(taxes, t.getCurrencyCode(), t.getUnitSum(Unit.Type.TAX).getAmount(),
interval, d);
addValue(dividends, t.getCurrencyCode(), t.getAmount(), interval, d);
addValue(fees, t.getCurrencyCode(), t.getUnitSum(Type.FEE).getAmount(),
interval, d);
break;
case INTEREST:
addValue(interest, t.getCurrencyCode(), t.getAmount(), interval, d);
Expand All @@ -152,6 +156,12 @@ private void collectTransferalsAndTaxes(Interval interval)
addValue(interest, t.getCurrencyCode(), -t.getAmount(), interval, d);
addValue(interestCharge, t.getCurrencyCode(), t.getAmount(), interval, d);
break;
case FEES:
addValue(fees, t.getCurrencyCode(), t.getAmount(), interval, d);
break;
case FEES_REFUND:
addValue(fees, t.getCurrencyCode(), -t.getAmount(), interval, d);
break;
default:
// do nothing
break;
Expand All @@ -172,6 +182,10 @@ private void collectTransferalsAndTaxes(Interval interval)
addValue(taxes, t.getCurrencyCode(), t.getUnitSum(Unit.Type.TAX).getAmount(), //
interval, d);

// collect fees
addValue(fees, t.getCurrencyCode(), t.getUnitSum(Unit.Type.FEE).getAmount(), //
interval, d);

// collect transferals
switch (t.getType())
{
Expand Down
Expand Up @@ -49,6 +49,7 @@ public class PerformanceIndex
protected long[] outboundTransferals;
protected long[] taxes;
protected long[] dividends;
protected long[] fees;
protected long[] interest;
protected long[] interestCharge;
protected long[] buys;
Expand Down Expand Up @@ -270,6 +271,11 @@ public long[] getDividends()
return dividends;
}

public long[] getFees()
{
return fees;
}

public long[] getInterest()
{
return interest;
Expand Down

0 comments on commit 18a624f

Please sign in to comment.