In QC, Is it possible to use functions with pandas series argument?

For example I would like to use function from mlfinlab packages `get_daily_vol`:

get_daily_vol(close, lookback=100)

where series is the pandas series with timestamp index and lookback is some number.

Now, I would like to calculate daily volatility for every bar (slice). Here is code that doesn't work:

import numpy as np import mlfinlab as ml import pandas as pd class CalibratedResistanceAtmosphericScrubbers(QCAlgorithm): def Initialize(self): self.SetStartDate(2019, 1, 1) # Set Start Date self.SetEndDate(2019, 3, 1) self.SetCash(100000) # Set Strategy Cash self.spy = self.AddEquity("SPY", Resolution.minute) self.spy.SetDataNormalizationMode(DataNormalizationMode.Adjusted) # Raw, SplitAdjusted, TotalReturn self.SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage, AccountType.Cash) # init close prices self.open = np.array([]) self.high = np.array([]) self.low = np.array([]) self.close = np.array([]) self.volume = np.array([]) self.lookback = max(self.periods) self.SetWarmUp(self.lookback * 2) def OnData(self, data): '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here. Arguments: data: Slice object keyed by symbol containing the stock data ''' if "SPY" not in data.Bars: return open_ = data["SPY"].Open high_ = data["SPY"].High low_ = data["SPY"].Low close_ = data["SPY"].Close volume_ = data["SPY"].Volume self.open = np.append(self.open, close_)[-self.lookback*2:] self.high = np.append(self.high, close_)[-self.lookback*2:] self.low = np.append(self.low, close_)[-self.lookback*2:] self.close = np.append(self.close, close_)[-self.lookback*2:] self.volume = np.append(self.volume, close_)[-self.lookback*2:] self.time = self.Time if self.IsWarmingUp: return df = pd.DataFrame({'open': self.open, 'high': self.high, 'low': self.low, 'close': self.close, 'volume': self.volume}) # HERE I SHOULD SOMEHOW CREATE INDEX VECTOR WITH FOR DF WITH ALL PASSED CLOSE PRICES # Compute volatility - THATS THE FUNCTION I NEED TO APPLY INE EVERY STEP daily_vol = ml.util.get_daily_vol(self.close, lookback=self.volatility_lookback)