diff --git a/docs/en/assets/test-07-split.xml b/docs/en/assets/test-07-split.xml
index 49b89645..8858b67d 100644
--- a/docs/en/assets/test-07-split.xml
+++ b/docs/en/assets/test-07-split.xml
@@ -2767,32 +2767,6 @@
2024-02-13T08:38:39.322993400ZBUY
-
- d90240a1-8dcd-40b0-87ad-69d52e3d94c4
- 2023-09-14T00:00
- EUR
- 2341
-
-
-
-
-
-
- c834289f-f76f-4cfd-865d-a4e1ae370637
- 2023-09-14T00:00
- EUR
- 2341
-
-
- 0
- 2024-02-13T08:40:46.205249800Z
- SELL
-
-
- 79600000
- 2024-02-13T08:40:46.205249800Z
- SELL
- 9951730c-575c-4b3d-bd3e-1aad3438edf12022-01-03T00:00
@@ -2838,7 +2812,6 @@
- db63c1b7-1b39-4311-bf5a-85b646d492b92022-01-01T00:00
diff --git a/docs/en/assets/test.xml b/docs/en/assets/test.xml
index 89d16a96..1a895e58 100644
--- a/docs/en/assets/test.xml
+++ b/docs/en/assets/test.xml
@@ -9,10 +9,11 @@
MANUAL
+
-
+
@@ -27,21 +28,6 @@
false2024-10-06T09:30:00.517050900Z
-
- 46f2a45f-07dc-4a6e-b01f-207324111ac8
- Siemens
- EUR
- GENERIC-JSON
- https://www.nseindia.com/api/historical/cm/equity?symbol=SIEMENS&from=07-06-2024&to=07-10-2024
-
-
-
-
- $.data[*].CH_TIMESTAMP
- $.data[*].CH_CLOSING_PRICE
- false
- 2024-10-07T18:51:06.265580600Z
-
@@ -87,27 +73,27 @@
10000100000000
- 2024-10-07T15:46:05.811492400Z
+ 2024-10-08T08:33:13.968147400ZDELIVERY_INBOUND5416412c-1064-4d05-aa16-4d3eb17b8611
- 2022-01-01T00:00
+ 2021-12-31T00:00EUR11000100000000
- 2024-10-07T17:40:38.254937400Z
+ 2024-10-08T09:12:45.770071400ZDELIVERY_OUTBOUND
- 5b0f4675-e27c-477c-b43a-2a36585238e7
+ 3b82a560-4436-40b4-a463-414f6b220de52022-01-01T00:00EUR11000
- 1100000000
- 2024-10-07T17:40:19.257730900Z
+ 1000000000
+ 2024-10-08T08:34:53.232412900ZDELIVERY_INBOUND
@@ -404,7 +390,7 @@
ec4dc660-8854-43ad-80d4-31584fe10e19Standard
- Client-absolute_delta_all_records;#ff8040;SOLID;false;2,Client-absolute_delta;#c0c0c0;SOLID;false;2
+ Client-absolute_delta_all_records;#ff8040;SOLID;false;2;true,Client-absolute_delta;#c0c0c0;SOLID;false;2;true
@@ -440,7 +426,7 @@
7600e16d-0168-49d1-aadb-18c66a64bc8fStandard
- Securitye11ee537-a363-4166-a9dd-f950ad8e1a9b;#e279bb;SOLID;false;2,[b]Securitydb4362cf-a2eb-4edc-878c-ac398c5f5e0a;#ff8000;SOLID;false;2
+ Client-totals;#000000;SOLID;false;2;true
@@ -471,16 +457,6 @@
L5Y0
-
-
-
- F2021-01-01_2023-01-01
-
-
-
-
- F2020-12-31_2023-01-01
-
diff --git a/docs/en/reference/view/reports/performance/images/trades-info-overlay.png b/docs/en/reference/view/reports/performance/images/trades-info-overlay.png
index 03d9592f..fc156287 100644
Binary files a/docs/en/reference/view/reports/performance/images/trades-info-overlay.png and b/docs/en/reference/view/reports/performance/images/trades-info-overlay.png differ
diff --git a/docs/en/reference/view/reports/performance/images/trades-overview.svg b/docs/en/reference/view/reports/performance/images/trades-overview.svg
new file mode 100644
index 00000000..eaeadcce
--- /dev/null
+++ b/docs/en/reference/view/reports/performance/images/trades-overview.svg
@@ -0,0 +1,161 @@
+
+
diff --git a/docs/en/reference/view/reports/performance/trades.md b/docs/en/reference/view/reports/performance/trades.md
index 6380d744..3cd1de73 100644
--- a/docs/en/reference/view/reports/performance/trades.md
+++ b/docs/en/reference/view/reports/performance/trades.md
@@ -2,13 +2,17 @@
title: Trades
---
-A trade refers to the act of buying or selling a financial security, such as a stock or bond. In PP, this can be executed through buy/sell transactions as well as through Inbound or Outbound Deliveries.
+A trade occurs whenever you buy or sell a financial security through a `Buy` or `Sell` transaction or an `Inbound` or `Outbound Delivery`. All trades are listed in the `Reports > Performance > Trades` view. There are two kinds of trades:
-Figure: The Reports > Performance > Trades view. {class=pp-figure}
+- **Open Trade**: An open trade is initiated with the first `Buy` or `Inbound Delivery` transaction for a security. The `Start Date` is set to the date of this initial transaction, while the `End Date` remains open as no `Sell` or `Outbound Delivery` has occurred yet. Subsequent purchases of the same security are added to *this* open trade, updating the number of shares and performance indicators such as Entry Value and Profit/Loss. Thus, an open trade can include multiple purchases.
+
+- **Closed Trade**: A closed trade is generated with *each* `Sell` or `Outbound Delivery` transaction of a security. If you sell a specific security on three different dates, three separate closed trades will be created, each identified by their respective buy and sell dates. Selling a security can affect the `Start Date` of the associated open trade, as the system uses the FIFO (First In, First Out) methodology. If all shares from a specific purchase are sold, the `Start Date` of the open trade will shift to the date of the next purchase.
+
+For example, in Figure 1, `share-1` has two associated trades, characterized by one sell transaction, depicted by the first closed trade (row 1), and two buy transactions, consolidated into the open trade (row 2).
-![](./images/trades-overview.png)
+Figure: The Reports > Performance > Trades view. {class=pp-figure}
-In the `Reports > Performance > Trades` menu, an open trade is constructed by consolidating all buy/Inbound Delivery transactions associated with a particular security. Hence, an open trade may encompass several buy transactions. Conversely, each sell or outbound delivery transaction generates one individual closed trade. For example, in Figure 1, `share-1` is characterized by one sell transaction, depicted by the first closed trade (row 1), and two buy transactions, consolidated into the open trade (row 2).
+![](./images/trades-overview.svg)
With the `Filter` menu, you can limit the list of trades to `Only open trades` or `Only closed trades`. If neither is selected in this group, all trades are displayed. In the second group, you can choose between `Only profitable trades` or `Only lossmaking trades`; essentially the green colored versus the red colored rows.
@@ -16,54 +20,60 @@ The `Export as CSV` icon contains one export, named `Trades` which represents th
## Available columns
-- *Name*: The trades are named by the name of the security that is traded (e.g. share-1). You can rename the trade by double-clicking the name.
-- *Start date*: The date of the first buy/Inbound delivery transaction.
-- *End date*: Either the selling date of the security or `(open)` if there are still securities left in the portfolio.
-- *# transactions*: The number of transactions in a trade is typically one (buy) or two (buy + sell). Hovering over the cell near the :material-information-outline: icon will trigger a pop-up displaying additional information. From Figure 2, it can be deduced that 5 shares of `share-1` were sold on April 12, 2023. Hovering over the open trade (row 2) will reveal that 5 shares were purchased on January 15, 2021, and another 5 on January 14, 2022. Here, you can observe the FIFO principle in action. The five sold shares are subtracted from the first purchase, which initially consisted of 10 shares.
+- *Name*: The trades are named by the name of the security that is traded (e.g. `share-1`). You can rename the trade by double-clicking the name.
+- *Start date*: The date of the first buy/Inbound delivery transaction. If all shares from a particular purchase are sold (following the FIFO method), the start date will update to the date of the next purchase.
+- *End date*: This is either the date when the security is sold or marked as (open) if the position is still active. Once all shares are sold, the open trade will be removed from the list.
+- *# transactions*: The number of transactions in a trade is typically one (only one buy transaction) or two (buy + sell). Hovering over the cell near the :material-information-outline: icon will trigger a pop-up displaying additional information. From Figure 2, it can be deduced that 5 shares of `share-1` were sold on April 12, 2023. Hovering over the open trade (row 2) will reveal that 5 shares were purchased on January 15, 2021, and another 5 on January 14, 2022. Here, you can observe the FIFO principle in action. The five sold shares are subtracted from the first purchase, which initially consisted of 10 shares.
Figure: Info overlay closed trade share-1. {class=pp-figure}
![](./images/trades-info-overlay.png)
- *Shares*: The number of shares in the trade.
-- *Entry value*: This represents the Net Transaction Value (NTV) of the trade, which includes fees and taxes. For an open trade with a single buy transaction, this is the NTV of the purchase. For example, if 3 shares of share-3 are bought at 413.64 USD per share with 50 USD in fees and taxes, the Net Transaction Value after conversion at a rate of 0.9384 USD/EUR is 1211.40 EUR.
- For a single buy/sell trade like share-2, the Net Transaction Value of the original purchase (67 EUR) is distributed over the open trade of 5 shares (41.88 EUR = 67/8 * 5) and the closed trade of 3 shares (25.13 EUR).
+- *Entry value*: This represents the Net Transaction Value (NTV) of the trade, which includes fees and taxes. You can find this value in Figure 1, in the top panel's last column. For an open trade with no sell transaction, this is the NTV of the purchase. For example, the purchase of `share-3` is accomplished by a single purchase with NTV of 1211.40 EUR; including (foreign) taxes and fees. For a buy + sell trade like `share-2`, the Net Transaction Value of the original purchase (67 EUR for 8 shares) is distributed over the open trade of the remaining 5 shares (41.88 EUR = 5/8 * 67 EUR) and the closed trade of 3 shares (25.13 EUR = 3/8 * 67 EUR).
- The situation is more complex with the multiple buy/sell trade of share-1. The entry value (161.50 EUR) of the open trade is formed by 5 shares from the first purchase and 5 from the second, following the FIFO principle. The original Net Transaction Value of the purchase of 10 shares on January 15, 2021, was 155 EUR. The second purchase of 5 shares had a net transaction value of 84 EUR. Combined, 161.50 EUR equals (155/2 + 84).
+ The situation is more complex with the 2 buy + 1 sell trade of `share-1`. The original Net Transaction Value of the purchase of 10 shares on January 15, 2021, was 155 EUR. The second purchase of 5 shares had a net transaction value of 84 EUR. The entry value of the remaining 5 shares in the open trade (161.50 EUR) is formed by 5 shares from the first purchase and 5 from the second, following the FIFO principle in the sell transaction. The 5 shares that were sold came from the first purchase. The NTV of the open trade becomes then: (5/10 * 155 EUR) + (5/5 * 84 EUR) or 161.50 EUR.
-- *Entry value (per share)*: Enable this column by using the Settings (gear) icon. The value can be easily calculated by dividing the Entry value by the number of shares.
-- *Exit value*: For open trades, this is the market value, which equals the number of shares multiplied by the current quote price. For example, the current quote price of `share-2` is 12.405 EUR/share. The exit value is 5 x 12.405 = 62.03 EUR. For closed trades, the exit value is the Net Transaction Value of the sale. For instance, if `share-2` was sold on April 15, 2024, for 3 shares x 12.48 EUR/share minus fees & taxes (4 EUR), the exit value is 34.46 EUR.
+- *Entry value (per share)*: Enable this column by using the Settings :gear: (gear) icon. The value can be easily calculated by dividing the Entry value by the number of shares.
+- *Exit value*: For open trades, this is the market value, which equals the number of shares multiplied by the current quote price. For example, the current quote price (Oct 11, 2024) of `share-2` is 11.645 EUR/share. The exit value is 5 x 11.645 = 58.23 EUR. For a closed trade, the exit value is the Net Transaction Value of the sale. For instance, `share-2` was sold on April 15, 2024: 3 shares x 12.48 EUR/share minus fees & taxes (4 EUR). The exit value is thus 34.46 EUR.
- *Exit value (per share)*: Similar to Entry value (per share); as described above.
- *Profit/Loss*: The profit/loss is the difference between the Exit value and the Entry value. Green numbers indicate a profit, while red numbers indicate a loss.
- *Gross Profit/Loss*: This equals the value of the previous column plus taxes and fees. Because for closed trades, the taxes and fees of the sell transaction are included in the Gross Profit/Loss column, this field cannot be calculated for the open trades.
-- *Holding period (days)*: For single purchase closed trades, it equals the number of days between the End and the start date. For open trades, it is the difference between today and the Start date. This calculation does not consider weekends, holidays or any other calendar.
+- *Holding period (days)*: For a single purchase closed trade, it equals the number of days between the End and the start date. For open trades, it is the difference between **today** and the Start date. This calculation does *not* consider weekends, holidays or any other calendar.
!!! Note
- For multiple purchase trades, the holding period is an average, weighted by the number of shares. For example, assuming today is 2024-04-22, then the holding period for the first purchase in Figure 2 is: (2024-04-22 - 2021-01-15) = 1193 days and for the second buy 829 days. The weighted average is [(5 x 1193) + (5 x 829)]/10 = 1011 days.
+ For multiple purchase trades, the holding period is an average, weighted by the number of shares. For example, assuming today is 2024-10-13, then the holding period of `share-1` for the first purchase in Figure 2 is: (2024-10-13 - 2021-01-15) = 1367 days and for the second purchase (2024-10-13 - 2022-01-14) = 1003 days. The weighted average is [(5 x 1367) + (5 x 1003)]/10 = 1185 days.
-- *Latest Trade*: Enable this column using the Settings (gear) icon. It typically contains either the End Date for closed trades or the Start date for open trades. An exception is an open trade with multiple buy transactions, in which case the date of the last transaction is used.
+- *Latest Trade*: Enable this column using the Settings :gear: (gear) icon. It typically contains either the End Date for closed trades or the Start date for open trades. An exception is an open trade with multiple buy transactions, in which case the date of the last transaction is used.
- *IRR*: The Internal Rate of Return; for detailed calculation, refer to the following section.
-- *Return*: This actually represents the True Time-Weighted Rate of Return (TTWROR); for further explanation, see below. This column is not visible by default; use the Settings (gear) icon to display it.
-- *Note*: The note associated with the security.
+- *Return*: Enable this column using the Settings :gear: (gear) icon. The Return is calculated as: `(Exit Value/Entry Value) -1`. This serves as an indicator of the trade's performance (see below for more details).
+- *Note*: The note associated with the security. You cannot have a separate note for each trade.
Additionally, the following columns can be made visible using the Settings (gear) icon: `Securities Account`, `ISIN`, `Symbol`, and `WKN`. Explanation of these fields can be found at the description of the [master data](../../../file/new.md#security-master-data) of the security.
## Performance calculation
-The IRR and Return column represent the performance of the open or closed trade. Please note that you cannot set a Reporting period explicitly. The Reporting period of a trade is always between today and the start date of the trade. The column Holding period (days) gives an indication of the number of days between these two dates.
+The IRR and Return column represent the performance of the open or closed trades. Please note that you cannot set a Reporting period explicitly. The Reporting period of a trade is always between today and the start date of the trade. The column Holding period (days) gives an indication of the number of days between these two dates.
In the section [Reference > Basic concepts > Performance > Money-weighted return](../../../../concepts/performance/money-weighted.md#irr-at-trade-level) an extensive calculation of the IRR of open and closed trades is given (using the same example of `share-1` as above).
In summary, given the [IRR equation](../../../../concepts/performance/money-weighted.md): $\mathrm{MVE = MVB \times (1 + IRR)^{\frac{RD_1}{365}} + \sum_{t=1} ^{n}CF_t \times (1+IRR)^{\frac{RD_t}{365}} \qquad \text{(Eq 1)}}$
-- Closed trade (share-1): 105 EUR = 77.50 EUR x (1 + IRR)^(817/365). An IRR of 14.53% will solve this equation exactly. To reach an Exit value of 105 EUR, it would require an initial Entry value of 77.50 EUR to grow at a compound annual interest rate (IRR) of 14.53%, over a period of 817 days.
+- Closed trade (`share-1`): `105 EUR = 0 + 77.50 EUR * (1 + IRR)^(817/365)`. An IRR of 14.53% will solve this equation exactly. To reach an Exit value of 105 EUR, it would require an initial Entry value of 77.50 EUR to grow at a compound annual interest rate (IRR) of 14.53%, over a period of 817 days. The MVB of a trade is always zero, because the trade starts with the first purchase or cash flow.
+
+- Open trade (`share-1`): The open trade has two cashflows (buy). Hovering over the Transactions cell will reveal the data (see Figure 2). Assuming today is 2024-10-13:
+
+ - First purchase: 5 remaining shares, bought at 77.50 EUR (=5/10 * 155 EUR), held for 1367 days (`2024-10-13 - 2021-01-15`).
+ - Second purchase: 5 shares bought for 84 EUR, held for 1003 days (`2024-10-13 - 2022-01-14`).
+
+ The IRR equation becomes: `271.40 EUR = 0 + 77.50 * (1 + IRR)^(1367/365) + 84 * (1 + IRR)^(1003/365)` or 11.12%. Please note that the holding periods and Exit value will change upon trying this example on a later date.
-- Open trade (share-1): The open trade has two cashflows (buy). Hovering over the Transactions cell will reveal the data (see Figure 2). The holding period for the first buy is 1193 days = (2024-04-22 - 2021-01-15) and for the second buy 829 days = (2024-04-22 - 2022-01-14). The IRR equation becomes: 216.10 EUR = 77.50 EUR x (1 + IRR)^(1193/365) + 84 EUR x (1 + IRR)^(829/365) or 11.12%. Please note that the holding periods and Exit value will change upon trying this example on a later date.
+The Return column is a [simple measure of performance](../../../../concepts/performance/index.md): `Exit Value/Entry Value) -1`.
-The Return column is in fact a simple return or the [TTWROR](../../../../concepts/performance/time-weighted.md#time-weighted-rate-of-return) with a single subperiod. It is the result of Exit value/Entry value or Profit/loss/Entry value.
+- Closed trade (share-1): r = (105 EUR/77.50 EUR) - 1 = 35.48%
+- Open trade (share-1): r = (271.40 EUR/161.50 EUR) - 1 = 68.05%
-- Closed trade (share-1): r = 105 EUR/77.50 EUR = 35.48%
-- Open trade (share-1): r = 216.10 EUR/161.50 EUR = 33.81%
+For a single purchase trade, such as the open trade of share-3, the Internal Rate of Return (IRR), the Time-Weighted Rate of Return per annum (TTWROR p.a.), and the simple Return are identical. For example the *periodical* simple return of `share-3` is -5.74%. The *annualized* IRR is -11.24%. You can annualize a periodical return r with the [formula](../../../../concepts/performance/time-weighted.md#ttwror-pa): `((1 + r)^(365/HP)) - 1`; where HP is the holding period. For example, the periodical return of -5.74% for a holding period of 181 days has an annualized value of `((1 - 0.0574)^(365/181)) - 1` or -11.24%, which is exactly the IRR.
diff --git a/todo/todo.md b/todo/todo.md
index b2198218..632414b1 100644
--- a/todo/todo.md
+++ b/todo/todo.md
@@ -161,3 +161,4 @@ Historical prices: many of the presets don't seem to function?
### 2024-10-05
- with missing historical prices: the line in the chart between the two known prices is "misleading" (increasing or decreasing) in stead of staying at the last known historical price. For example, two known prices (100 & 200 EUR at jan 1, 2023 & 2024), the line for the year 2023 is increasing from 100 to 200, even though (I think) the price that is taken for calculations in that period is the last known price, e.g. 100 EUR.
+- File > Save as > XML with "ID" attributes? Comparing the file contents reveal that to som sections (e.g. ) an ID is added. In the comments: "New: Alternative XML format that uses “id” attributes for references (and is therefore easier to read/manipulate by other programs)". Example? Which programs?