Sort:  

It works now. My mistake was apparently that I did not generate a new version of the variable which take the get_account_history. After doing this in the loop, it works now.