Hello QC Support,

I have a question regarding how to convert the rolling window to a dataframe. In the documentation on rolling window here it is stated that:

RollingWindow is an array of data that allows for reverse list access semantics, where the object with index [0] refers to the most recent item in the window, and index [Length-1] refers to the last item in the window, where Length is the number of elements in the window.

Does that mean when the rolling window is moved into a dataframe, e.g.:

df = pd.DataFrame(symbolData.Close_rolling, columns=["Close"]).reset_index(drop=True)

that the most recent closing price is df["Close][0] and not df["Close][-1]? Can you confirm pls.

And if I wanted to calculate forward returns, which one below should it be:

df['FwdReturn'] = np.log(df["Close"].shift(-1)/df["Close"]) 

OR

df['FwdReturn'] = np.log(df["Close"] / df["Close"].shift(1)) 

And if I wanted to check “if current_price > previous_price”, which should it be:

if df["Close"][0] > df["Close"][1]

OR

if df["Close"][-1] > df["Close"][-2]

Thanks again.