gs_quant.timeseries.algebra.multiply¶
- multiply(x, y, method=Interpolate.STEP)[source]¶
Multiply two series or scalars
- Parameters:
x (
Union
[Series
,Real
]) – timeseries or scalary (
Union
[Series
,Real
]) – timeseries or scalarmethod (
Interpolate
) – interpolation method (default: step). Only used when both x and y are timeseries
- Return type:
Union
[Series
,Real
]- Returns:
timeseries of x * y or product of the given real numbers
Usage
Multiply two series or scalar variables applying the given interpolation method
\(R_t = X_t \times Y_t\)
Alignment operators:
Method
Behavior
intersect
Resultant series only has values on the intersection of dates. Values for dates present in only one series will be ignored
nan
Resultant series has values on the union of dates in both series. Values for dates only available in one series will be treated as nan in the other series, and therefore in the resultant series
zero
Resultant series has values on the union of dates in both series. Values for dates only available in one series will be treated as zero in the other series
step
Resultant series has values on the union of dates in both series. Values for dates only available in one series will be interpolated via step function in the other series
time
Resultant series have values on the union of dates / times. Missing values surrounded by valid values will be interpolated given length of interval. Input series must use DateTimeIndex.
Examples
Multiply two series:
>>> a = generate_series(100) >>> b = generate_series(100) >>> multiply(a, b, Interpolate.STEP)
See also