gs_quant.timeseries.backtesting.basket¶
-
basket
(series, weights, costs=None, rebal_freq=<RebalFreq.DAILY: 'daily'>, return_type=<ReturnType.EXCESS_RETURN: 'excess_return'>)[source]¶ Calculates a basket return series.
- Parameters
series (
list
) – list of time series of instrument pricesweights (
list
) – list of weightscosts (
Optional
[list
]) – list of execution costs in decimal; defaults to costs of 0rebal_freq (
RebalFreq
) – rebalancing frequency - Daily or Monthlyreturn_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([prices1, prices2], [0.7, 0.3], [0.0005, 0.001], monthly)
See also
prices()