I am trying to daily calculate the close-to-open return for j stocks for t days. Is there anyway I can calculate without using a for loop? I have one Dataframe for daily close prices and one for daily open. I am using python.
If it is close-to-close return, I am able to use the pct_change, not sure for close-to-open.
RCO(t,j) = SO(t,j)/SC(t-1,j)-1
where RCO is the returns on day t for stock j, SO is the opening price and SC is the previous days closing price.