API documentation for tradeexecutor.visual.equity_curve.calculate_compounding_realised_trading_profitability Python function.

calculate_compounding_realised_trading_profitability(state, fill_time_gaps=True)[source]#

Calculate realised profitability of closed trading positions, with the compounding effect.

Assume the profits from the previous PnL are used in the next one.

This function returns the profitability of individually closed trading positions, relative to the portfolio total equity.

  • fill_time_gaps

    Insert a faux book keeping entries at star tand end.

    There chart ends at the last profitable trade. However, we want to render the chart all the way up to the current date. If True then insert a booking keeping entry to the last strategy timestamp (`State.last_updated_at), working around various issues when dealing with this data at the frontend.

    Any fixes are not applied to empty arrays.

  • state (State) –


Pandas series (DatetimeIndex, cumulative % profit).

Cumulative profit is 0% if there is no market action. Cumulative profit is 1 (100%) if the equity has doubled during the period.

The last value of the series is the total trading profitability of the strategy over its lifetime.

Return type: