volume_weighted_average_price(prices_tms: qf_lib.containers.series.prices_series.PricesSeries, volumes_tms: qf_lib.containers.series.qf_series.QFSeries, interval: pandas._libs.tslibs.timedeltas.Timedelta) → qf_lib.containers.series.prices_series.PricesSeries[source]¶
Aggregates prices in the prices_tms by calculating the average weighted price for each period. The average weighted prices are weighted by the volumes traded in each period.
prices_tms (PricesSeries) – timeseries of prices which should be aggregated
volumes_tms (QFSeries) – timeseries of volumes traded; must correspond to the prices_tms
interval (Timedelta) – the length of each period from which prices should be aggregated
timeseries of aggregated prices; first datetimes are: first_price_datetime + interval, first_price_datetime + 2*interval, …, first_price_datetime + i*interval, where first_price_datetime is the datetime of the first price in the original prices_tms The last datetime is always <= last datetime in the prices_tms
- Return type