visualise_single_pair(state, candle_universe, start_at=None, end_at=None, pair_id=None, height=800, axes=True, technical_indicators=True, title=True, theme='plotly_white', volume_bar_mode=VolumeBarMode.overlay, vertical_spacing=0.05, subplot_font_size=11, relative_sizing=None, volume_axis_name='Volume USD', candle_decimals=4)[source]#

Visualise single-pair trade execution.

  • state (Optional[State]) –

    The recorded state of the strategy execution.

    You must give either state or positions.

  • 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.

  • candle_universe (tradingstrategy.candle.GroupedCandleUniverse | pandas.core.frame.DataFrame) – Price candles we used for the strategy

  • 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

  • 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.

  • title (Union[str, bool]) –

    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.

  • theme – Plotly colour scheme to use

  • volume_bar_mode – How to draw the volume bars

  • vertical_spacing – Vertical spacing between the subplots. Default is 0.05.

  • subplot_font_size – Font size of the subplot titles. Default is 11.

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

    Optional relative sizes of each plot. Starts with first main candle plot, then the volume plot if it is detached, then the other detached technical indicators.

    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.

    Remember to account for whether the volume subplot is detached or not. If it is detached, it should take up the second element in the list.

  • volume_axis_name (str) – Name of the volume axis. Default is “Volume USD”.

  • candle_decimals (int) – Number of decimal places to round the candlesticks to. Default is 4.

Return type: