calculate_annualised_return#

API documentation for tradeexecutor.analysis.trade_analyser.calculate_annualised_return Python function.

calculate_annualised_return(profit_pct, duration)[source]#

Calculate annualised return %.

Uses seconds as the base unit for duration to accomodate for strategies that have been live for less than a day.

Parameters:
  • profit_pct (float) – Profit % over the duration

  • duration (timedelta) – Duration of the trade as a datetime object

Returns:

Annualised return % if profit_pct is not None

Return type:

float | None