Source code for kaxanuk.attribution_analysis.interfaces.brinston_fachler_interface
import abc
import pandas as pd
[docs]
class BrinstonFachlerInterface(metaclass=abc.ABCMeta):
def __init__(
self,
returns_investible_assets: pd.DataFrame,
portfolio_weights: pd.DataFrame,
benchmark_weights: pd.DataFrame
):
self.returns_investible_assets = returns_investible_assets
self.portfolio_weights = portfolio_weights
self.benchmark_weights = benchmark_weights
[docs]
@abc.abstractmethod
def brinson_fachler_model(
self,
date: str
):
"""
Calculate the Brinson-Fachler attribution model for a given date.
:param date: The date for which to calculate the attribution.
:return: A tuple containing the detailed attribution DataFrame and a totals DataFrame.
"""
...
[docs]
@abc.abstractmethod
def time_series_calculation(
self
):
"""
Calculate the time series attribution for the entire period.
:return: A tuple containing the detailed attribution DataFrame and a totals DataFrame.
"""
...