Recreate excel strategy in Python

I'm fairly inexperienced in Python and trying to recreate a simple excel strategy in a Python dataframe. The excel file has the following columns:

A. Price;

B. return%;

C. volatility measure%;

D. allocation%: = Max (e.g 1% or (previous period drawdown)/previous period volatility measure)

E. returnallocation%;

F. new index: cumprod of return
allocation%

G. Highwatermark of new index

H. Drawdown of new index



The issue I have in python is that D need previous period H but i can't define H without having a value for D. There are no circular references as I use previous period drawdown for current period allocation%





 

Hi Charl,



You can calculate column D using the expanding window in Python. Then the column H will be the running drawdown of column F.



Hope this helps!