def get_max_drawdown_underwater(underwater):
valley = np.argmin(underwater)  <EOL>peak = underwater[:valley][underwater[:valley] == <NUM_LIT:0>].index[-<NUM_LIT:1>]<EOL>try:<EOL><INDENT>recovery = underwater[valley:][underwater[valley:] == <NUM_LIT:0>].index[<NUM_LIT:0>]<EOL><DEDENT>except IndexError:<EOL><INDENT>recovery = np.nan  <EOL><DEDENT>return peak, valley, recovery<EOL>
Determines peak, valley, and recovery dates given an 'underwater'
DataFrame.

An underwater DataFrame is a DataFrame that has precomputed
rolling drawdown.

Parameters
----------
underwater : pd.Series
   Underwater returns (rolling drawdown) of a strategy.

Returns
-------
peak : datetime
    The maximum drawdown's peak.
valley : datetime
    The maximum drawdown's valley.
recovery : datetime
    The maximum drawdown's recovery.