# Singular Peak Return

In measuring trading performances, a simple benchmark is the **maximum return
that can be obtained by a single trade**. Given the set of times
$T= \{ t_1, \dots, t_n \} \subset\mathbb{R}$, $t_{i-1} \leq t_i$ for all $i=2,\dots,n$
and bijection of prices $P=T\to \mathbb{R}_+$, we have the optimization problem

We define

as the set of local maxima and the boundaries for which $P$ takes a greater value than their defined neighborhoods.

The solution to the optimization problem is called **singular peak return** and
defined as

It can be calculated in $O(n)$ time with this simple algorithm: Start iterating from the first time, and keep a record of the minimum price encountered before current time. Whenever a local maximum is encountered, divide it by the recorded minimum and add it to the result set. After iteration ends, return the maximum of the result set.