usually, we calculate the return with next row data by simply using df.Close.shift()
but if we want shifting by a specific time period, can try:
df['ret15min'] = (df.Close.shift(-15, freq="min") -df.Close)*100/df.Close
No comments:
Post a Comment