I am setting up a volume profile series over a stock data. I have implemented the market profile code from this github repo!
Here the author gets his final results by applying this code:
mp = MarketProfile(df, tick_size=1)
mp_slice = mp[df.index.max() - pd.Timedelta(13, 'H'):df.index.max()]
Here the function takes a slice of indexes from the whole dataframe and apply its function that slice and the author get his results through this code:
mp_slice.initial_balance()
mp_slice.open_range()
mp_slice.poc_price
mp_slice.profile_range
mp_slice.value_area
mp_slice.balanced_target
What I want is to make rolling(w) columns of results in the data frame from the starting date. i.e df['poc_price'], df['value_area']
I have tried the df.rolling()
and .apply()
method which throws me errors.