def annualize(returns, durations, one_year=365.):
    """
    Annualize returns using their respective durations.

    Formula used is:
        (1 + returns) ** (1 / (durations / one_year)) - 1

    """
    return (1. + returns) ** (1. / (durations / one_year)) - 1.