Plot#
API documentation for tradeexecutor.state.visualisation.Plot Python class in Trading Strategy framework.
- class Plot[source]#
Bases:
object
Descibe singe plot on a strategy.
Plot is usually displayed as an overlay line over the price chart. E.g. simple moving average over price candles.
- __init__(name, kind, colour=None, points=<factory>, plot_shape=PlotShape.linear, detached_overlay_name=None, indicator_size=None, recording_time=RecordingTime.decision_making_time, pair=None, label=None, height=None)#
- Parameters:
name (str) –
kind (PlotKind) –
recording_time (RecordingTime) –
pair (Optional[TradingPairIdentifier]) –
- Return type:
None
Methods
__init__
(name, kind[, colour, points, ...])add_point
(timestamp, value)from_dict
(kvs, *[, infer_missing])from_json
(s, *[, parse_float, parse_int, ...])Get entries as a sorted list."
Get the first entry in this plot.
Get the last entry in this plot.
Assume points is an ordered dict.
schema
(*[, infer_missing, only, exclude, ...])to_dict
([encode_json])to_json
(*[, skipkeys, ensure_ascii, ...])Attributes
Name of this plot
What kind of a plot we are drawing
One of Plotly colour names https://community.plotly.com/t/plotly-colours-list/11730/2
Points of this plot.
Standard is linear.
If this plot is overlayed on top of a detached technical indicator, this is the name of the overlay it should be attached to.
Optional indicator to determine the size of the indicator.
What is the recording time for this plot.
The trading pair this plot is for.
How do we render label for this plot
Height hint for the rendering.
- colour: Optional[str]#
One of Plotly colour names https://community.plotly.com/t/plotly-colours-list/11730/2
- points: Dict[int, float]#
Points of this plot.
TODO: Because we cannot use datetime.datetime directly as a key in JSON, we use UNIX timestamp here to keep our state easily serialisable.
Also note that entries may not be in order - you might need to sort the output yourself.
- plot_shape: Optional[PlotShape]#
Standard is linear. Alternative is horizontal-vertical which can be used for stop loss line. See https://plotly.com/python/line-charts/?_ga=2.83222870.1162358725.1672302619-1029023258.1667666588#interpolation-with-line-plots
- detached_overlay_name: Optional[str]#
If this plot is overlayed on top of a detached technical indicator, this is the name of the overlay it should be attached to.
- indicator_size: Optional[float]#
Optional indicator to determine the size of the indicator.
For a line, this is the width of the line.
For a marker, this is the size of the marker.
- recording_time: RecordingTime#
What is the recording time for this plot.
Are we adjusted for look ahead bias or not.
- pair: Optional[TradingPairIdentifier]#
The trading pair this plot is for.
Plots are not necessarily restricted to a single trading pair, so this is optional.
- height: Optional[int]#
Height hint for the rendering.
Currently not supported. See
Visualisation.plot_indicator()
for comments.
- __init__(name, kind, colour=None, points=<factory>, plot_shape=PlotShape.linear, detached_overlay_name=None, indicator_size=None, recording_time=RecordingTime.decision_making_time, pair=None, label=None, height=None)#
- Parameters:
name (str) –
kind (PlotKind) –
recording_time (RecordingTime) –
pair (Optional[TradingPairIdentifier]) –
- Return type:
None