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

calculate_equity_curve(state, attribute_name='total_equity', fill_time_gaps=False)[source]#

Calculate equity curve for the portfolio.

Translate the portfolio internal Statistics.portfolio to pd.Series that allows easy equity curve calculations.

This reads tradeexecutor.state.stats.PortfolioStatistics


equity_curve = calculate_equity_curve(state)
  • attribute_name – Calculate equity curve based on this attribute of :py:class:`

  • fill_time_gaps

    Insert a faux book keeping entries at start and end.

    If not set, only renders the chart when there was some activate deposits and ignores non-activity gaps at start and end.

    See tradeexecutor.state.state.State.get_strategy_time_range().

  • state (State) –


Pandas series (timestamp, equity value).

Index is DatetimeIndex.

Empty series is returned if there is no data.

We ensure only one entry per timestamp through filtering out duplicate indices.

Return type: