API documentation for tradeexecutor.utils.sort.unique_sort Python function.

unique_sort(items, key, reverse=False, filter_na=True, check_number=True)[source]#

Sort the list, but return the unique results only.

  • Used for sorting the best grid search results (by CAGR, Sharpe)

  • Similar as sorted()

  • The first unique matched value is returned

  • key (Callable) – Accessor function

  • items (list) – Items to sort

  • accessor – Accessor function

  • reverse – Reverse the result

  • filter_na

    If the sorted value is NA, ignore it.

    Use pandas.isna to detect.

  • check_number

    Make sure all values in items list are numbers.

    A helper check to avoid malformed data leaking through.

Return type: