Active Premium¶
-
perfana.core.returns.
active_premium
(ra, rb, freq=None, geometric=True, prefixes=('PRT', 'BMK'))[source]¶ The return on an investment’s annualized return minus the benchmark’s annualized return.
- Parameters
ra (
Union
[DataFrame
,Iterable
[Union
[int
,float
]],ndarray
,Series
]) – The assets returns vector or matrixrb (
Union
[DataFrame
,Iterable
[Union
[int
,float
]],ndarray
,Series
]) – The benchmark returnsfreq (
Optional
[str
]) – Frequency of the data. Use one of monthly, quarterly, semi-annually, yearlygeometric – If True, calculates the geometric returns. Otherwise, calculates the arithmetic returns
prefixes – Prefix to apply to overlapping column names in the left and right side, respectively. This is also applied when the column name is an integer (i.e. 0 -> PRT_0). It is the default name of the Series data if there are no name to the Series
- Returns
Active premium of each strategy against benchmark
- Return type
TimeSeriesData
Examples
>>> from perfana.datasets import load_etf >>> from perfana.core import active_premium # Get returns starting from the date where all etf has data >>> etf = load_etf().dropna().pa.to_returns().dropna() >>> active_premium(etf, etf) VBK BND VTI VWO VBK 0.000000 -0.055385 -0.010407 -0.063939 BND 0.055385 0.000000 0.044979 -0.008554 VTI 0.010407 -0.044979 0.000000 -0.053532 VWO 0.063939 0.008554 0.053532 0.000000 >>> active_premium(etf.VBK, etf.BND) VBK BND 0.055385