.. _conventions: Conventions and limitations =========================== The rules the library applies to every input, the names its results use, and what it does not model. Read this before comparing its numbers with another system. Weight timing ------------- A weight dated :math:`t` is the weight held **over** day :math:`t`, from the close of :math:`t-1` to the close of :math:`t`: a start-of-day weight, which is the end-of-day weight of :math:`t-1`. It multiplies the return of the same date: .. math:: r_{p,t} = \sum_i w_{i,t}\, r_{i,t}, \qquad r_{i,t} = \frac{P_{i,t}}{P_{i,t-1}} - 1 Brinson-Fachler, the factor model and the active factor model all pair weights and returns this way. A weights file that records the book *after* the close of :math:`t` (after that day's rebalance) must be shifted one date forward before it is loaded. Otherwise day :math:`t` is attributed with a book that was only held from its close, which is a look-ahead. The Backtest-Engine adapter applies this shift itself: it uses the engine's end-of-day ``Daily_Weights`` of the previous date (see :ref:`from_backtest_engine`). Returns ------- - Asset returns are simple returns of consecutive prices, so the first price date has no return: textbook Brinson-Fachler starts on the second price date. - A date on which no held asset has a return, such as the first price date in the factor model, gets a null portfolio return, never 0: it is left out of the shares, the linked cumulative views and the summary statistics, and a warning counts such dates. A single held name without a return counts as 0 on that date (see `Known limitations`_). - Factor-file cells are asset-level contributions (exposure times factor return), simple returns unless ``factor_return_type = log`` (see :ref:`factor_model`). - All inputs are aligned to the intersection of their date ranges before any calculation. Cash ---- With the textbook Brinson-Fachler formula, net weights that sum below 1 are topped up with ``cash_ticker`` (default ``CASH``), which returns 0 every day. There is no cash-rate model: interest earned on cash is not part of the attributed return (in a Backtest-Engine run it is in the ``financing`` column of the implementation table). Outside textbook Brinson-Fachler, a file run treats ``cash_ticker`` as an ordinary ticker priced from its file. Holdings basis and the implementation table ------------------------------------------- Every method attributes the return of the weights it is given at the prices it is given: a holdings return, before commissions, slippage, financing and trade execution. It equals a fund's NAV return only on days without trading or financing. For a Backtest-Engine run the :ref:`implementation table ` reconciles the two on every date: .. math:: \text{engine (NAV)} = \text{holdings} + \text{commissions} + \text{slippage} + \text{financing} + \text{execution} A file run has no NAV to reconcile against, so ``AttributionResult.implementation`` is ``None``. Names of the residual --------------------- The factor model's idiosyncratic residual has a different name in each result, kept for compatibility: .. list-table:: :header-rows: 1 :widths: 55 45 * - Result - Residual * - ``FactorModelResult.daily_shares`` - column ``f_idio_returns`` * - ``FactorModelResult.cumulative_shares`` - key ``idio_returns`` * - ``cumulative_totals`` of ``FactorModelResult`` and ``ActiveFactorResult`` - column ``idiosyncratic_returns`` * - ``ActiveFactorResult.contributions`` and ``cumulative_contributions`` - column ``f_idio_returns`` * - ``FactorModelResult.contributions`` and ``cumulative_contributions`` - no column: it is the portfolio return minus the columns shown * - Charts and the dashboard - "Idiosyncratic" The vendor file ``f_idyo_returns`` is not the residual: it is an aggregate total, which is never loaded. Known limitations ----------------- - **Static segment map.** The ``ticker,segment`` map is not point-in-time: a ticker keeps one segment for the whole window, so a reclassification (for example a GICS sector change) restates history with the current map. - **Price gaps.** The price files are joined on the union of their dates. When one ticker has a price on a date the others lack, the others have no price that date, hence no return on that date nor on the next one: returns come from consecutive rows and prices are never carried forward. Both methods count a held name without a return as 0 that day, so its move over those two days is lost. This matters most for textbook Brinson-Fachler, which prices the whole benchmark universe together with the portfolio. Keep the price files on one calendar. (The active factor model prices the constituents the portfolio does not hold on the portfolio's own dates and keeps such moves.) - **No forward-fill of weights.** Weights files must hold every trading day; the library does not carry an allocation forward from its rebalancing date. A trading day missing from the weights is not attributed, and the loader rejects series that are clearly not daily (see :ref:`data_formats`). - **Cash earns 0** (see `Cash`_). - Menchero linking and geometric attribution are not offered (see :ref:`linking`), and the factor model does not split out beta or market timing (see :ref:`factor_model`).