๐ Net Annualized Return
๐ก Purpose
LibreFolio reports annualized return only when the observed window is long enough to make compounding meaningful. The shared conversion is:
where \(d\) is calendar days. It is the inverse of:
The implementation returns None when:
- \(r_{\mathrm{cum}} \leq -1\)
- \(d < 30\)
- the computation overflows
Thirty-day guard
A one-week return annualized to 365 days can explode into meaningless percentages. LibreFolio therefore suppresses annualization below 30 days and displays an empty value instead of a mathematically correct but misleading CAGR.
๐งพ Holdings View
For an open holding in โYour positionsโ / portfolio summary:
where:
Annualization window:
Lot-affecting transaction types are:
This includes in-kind successions, broker transfers, and adjustment-seeded positions. Old BUY/SELL-only discovery would miss those holdings.
๐ช Period View
For per-asset period contribution:
The displayed period percentage remains:
when StartValue is non-zero. Annualization can fall back to end cost basis for assets opened mid-period:
The sum is over the transfers from another broker of the scope the position received in the period, each counted as in Positions Closed in the Period: what their units gained before they arrived, value on arrival less the historical cost moved (MF-A9). The position's result counts those units from their value on arrival, its end cost at their historical cost, so the base adds the same amount. It applies only while no unit has left the position in the period, before the arrival or after it: once units left it, a transfer carries no quantity to tell which part of the sum left with them, and the sum is dropped โ the end cost alone is the base, as for any position opened mid-period that sold part of what it bought.
Window start is clamped to the oldest FIFO lot still open at period end:
Lots are counted at each broker: a transfer opens a lot dated at its arrival at the receiving broker. A stock split rescales the open lots and keeps their dates, so it never shortens the window. The oldest lots that together hold \(10^{-5}\) units or fewer โ the residual a sale leaves โ are set aside, as a closed position counts such a residual as closed: a residual left years ago does not pull the window start back to its date, and a position holding nothing more than that residual has no open lot (MF-A7). The quantities are the engine's, at the owner's share of the broker: on a broker held at 50 %, a residual of \(0.000012\) units is \(0.000006\) for the owner, dust for the window as for the row (MF-A10).
Then:
๐ Positions Closed in the Period
A position is closed when its quantity at \(t_{\mathrm{end}}\), at the owner's share of the broker, is at or below the dust threshold of \(10^{-5}\) units, so a residual left by redemptions in tranches counts as closed. It has no end cost, and a start value says nothing about a holding sold a few weeks in. Its annualized return uses the capital it deployed and the time it was held inside the period:
- \(C_s\) is the historical cost, in \(C^*\), of each disposal the period's Realized counts โ a SELL, or an outgoing ADJUSTMENT not linked to a split (Portfolio Engine โ ยง8). A disposal left out of Realized adds no cost.
- \(C_m\) is the historical cost each transfer to another broker of the scope moved out, when the row counts that transfer's tract: it left after \(t_{\mathrm{from}}\), arrived by \(t_{\mathrm{end}}\), and both its value on arrival and the cost moved are known (Period P&L, developer decision P22). The row's result carries what those units did until they arrived (the tract adjustment), so their cost belongs in the base.
- \(V_a - C_a\) is, for each such transfer the position received, what its units gained before they arrived: their value on arrival less the historical cost moved with them. The row's result starts those units at \(V_a\) (the tract adjustment takes back \(V_a - C_a\)), while \(C_s\) and \(C_m\) carry their historical cost, so the base adds the same amount and counts them at their value on arrival too (MF-A8). So \(\mathrm{CostOut}\) is not only historical cost: for the units the position received, the base holds their value on arrival.
- \(t_{\mathrm{first\ opening}}\) is the position's first acquisition at that broker: a transfer opens it on its arrival there, a split never does. It is the first one ever, not the last lot's, so days at zero between two closes inside the period stay in the window.
- The numerator is the row's whole \(\mathrm{PnL}_{period}\): for a position held at \(t_{\mathrm{from}}\), its \(\Delta\mathrm{UGL}\) gives back the unrealized gain/loss it started with.
- The displayed period percentage keeps \(|\mathrm{StartValue}|\) as base: only the annualized value changes base and window.
When this gives no value, two cases follow:
- Fewer than 30 days held in the period, \(t_{\mathrm{close}} - t_{\mathrm{start}} < 30\): the row has no annualized return (
โ), whatever else made the base unusable. The rule above would annualize over \(t_{\mathrm{from}} \to t_{\mathrm{end}}\), as if ten days held had lasted the whole period (MF-A3). - Otherwise the row keeps the rule above. That happens when units left the position in any other way โ a transfer outside the scope, or still in transit at \(t_{\mathrm{end}}\), a transfer or a disposal whose value or cost is unknown โ since the row's result would then hold more than its base covers; and with a return of \(-100\%\) or worse. The rule above is: \(|\mathrm{StartValue}|\) over \(t_{\mathrm{from}} \to t_{\mathrm{end}}\), and no value for a position opened in the period.
Example: a position sold 90 days into a one-year period
At \(t_{\mathrm{from}}\) the position is worth 1,100 for a cost of 1,000. All of it is sold 90 days later for 1,250:
The unrealized +100 it started with comes back out of \(\Delta\mathrm{UGL}\), Realized adds +250. The period percentage stays \(150 / 1{,}100 = 13.64\%\); annualized over the whole year on the start value, as an open position would be, the same +150 would read 13.64% as well.
Example: half sold, half moved to another broker
At \(t_{\mathrm{from}}\) the position holds 10 units, worth 1,100 for a cost of 1,000. Five are sold for 625; five move to another broker of the scope and are worth 600 when they arrive:
The cost of the sold units alone would read \(125 / 500 = 25\%\): the moved units' result in the numerator, without their cost in the base (MF-A5).
The broker that received the five units and later sold them for 660 reads the mirror: its result is \((660 - 500) - (600 - 500) = +60\), and its base \(500 + (600 - 500) = 600\), so \(60 / 600 = 10\%\) โ the units count from their value on arrival, in the result and in the base alike (MF-A8).
๐งฌ FIFO Lots
FIFO lot annualized return is net of allocated income, fees, and taxes:
The annualized value uses net_total_return, not gross total_return:
where \(t_{\mathrm{lot\ end}}\) is the closing date for fully closed lots, otherwise the analysis end date.
๐ Related
- ๐งญ Price Resolution โ source of market and trade-origin valuations
- ๐ Simple ROI โ headline and position-level return context
- ๐ Period PnL โ period decomposition
- ๐ฌ FIFO Lot Analysis โ per-lot net metrics
- โ๏ธ Portfolio Engine โ full mathematical model