Compute maximum run-up in one pass
Asked at Citadel, Jump Trading
Maximum run-up is the largest percentage gain from a running trough to a subsequent peak of an equity curve, the upside twin of maximum drawdown:
where is the equity at time (assume all values positive).
equity = [100, 80, 130, 90, 150]
-> 0.875 # trough 80 up to peak 150
Return the maximum run-up as a fraction, in time and space. The naive all-pairs scan is .
Your answer
This one is open-ended. Work it through, then check your reasoning against the full solution.