gs_quant.timeseries.backtesting.basket_series¶
- basket_series(series, weights=None, costs=None, rebal_freq=RebalFreq.DAILY, return_type=ReturnType.EXCESS_RETURN)[source]¶
Calculates a basket return series.
- Parameters:
series (
list
) – list of time series of instrument pricesweights (
Optional
[list
]) – list of weights (defaults to evenly weight series)costs (
Optional
[list
]) – list of execution costs in decimal (defaults to costs of 0)rebal_freq (
RebalFreq
) – rebalancing frequency - Daily, Weekly or Monthly (defaults to Daily)return_type (
ReturnType
) – return type of underlying instruments - only excess return is supported
- Return type:
Series
- Returns:
time series of the resulting basket
Usage
Calculates a basket return series.
Examples
Generate price series and combine them in a basket (weights 70%/30%) which rebalances monthly and assumes execution costs 5bps and 10bps each time the constituents are traded.
>>> prices1 = generate_series(100) >>> prices2 = generate_series(100) >>> mybasket = basket_series([prices1, prices2], [0.7, 0.3], [0.0005, 0.001], monthly)
See also
prices()