I am trying to create a function that calculates specific daily returns (i.e. 1,2,5,10 and 30-day returns). I would like to create a different list that has the appropriate name (i.e. one_day_return_list) which contains the returns for that given period.
def calculate_returns(trading_day):
for i in [1,2,5,10,30]:
i_day_return = (closing_prices[(trading_day + i)] - closing_prices[(trading_day)]) / closing_prices[(trading_day)
i_day_return_list.append(i_day_return_return)
where during the first iteration , i_day_return should result in one_day_return and i_day_return_list should result in one_day_return_list. Any clue how I can turn the above pseudo code into an actual code ?