visualise_single_pair_positions_with_duration_and_slippage#

API documentation for tradeexecutor.visual.single_pair.visualise_single_pair_positions_with_duration_and_slippage Python function.

visualise_single_pair_positions_with_duration_and_slippage(state, candles, pair_id=None, start_at=None, end_at=None, height=800, axes=True, title=True, theme='plotly_white', technical_indicators=True, vertical_spacing=0.05, relative_sizing=None, subplot_font_size=11)[source]#

Visualise performance of a live trading strategy.

Unlike visualise_single_pair() attempt to visualise

  • position duration, as a colored area

  • more position tooltip text

  • trade duration (started at - executed)

  • slippage

Parameters:
  • state (State) – The recorded state of the strategy execution. Either live or backtest.

  • candle_universe – Price candles we used for the strategy

  • pair_id (Optional[int]) –

    The visualised pair in the case the strategy contains trades for multiple pairs.

    If the strategy contains trades only for one pair this is not needed.

  • height – Chart height in pixels

  • start_at (Optional[Union[Timestamp, datetime]]) – When the backtest started or when we crop the content

  • end_at (Optional[Union[Timestamp, datetime]]) – When the backtest ended or when we crop the content

  • axes – Draw axes labels

  • title (Union[bool, str]) –

    Draw the chart title.

    Set to string to give your own name.

    Set True to use the state name as a title. TODO: True is a legacy option and will be removed.

  • technical_indicators

    Extract technical indicators from the state and overlay them on the price action.

    Only makes sense if the indicators were drawn against the price action of this pair.

  • theme – Plotly colour scheme to use

  • vertical_spacing – Vertical spacing between subplots

  • relative_sizing (Optional[list[float]]) –

    Optional relative sizes of each plot. Starts with first main candle plot. In this function, there is no volume plot (neither overlayed, hidden, or detached), so the first plot is the candle plot, and the rest are the technical indicator plots.

    e.g. [1, 0.2, 0.3, 0.3] would mean the second plot is 20% the size of the first, and the third and fourth plots are 30% the size of the first.

  • subplot_font_size (int) – Font size of the subplot titles

  • candles (DataFrame) –

Returns:

Plotly figure

Return type:

Figure