Plot#
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)#
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
One of Plotly colour names https://community.plotly.com/t/plotly-colours-list/11730/2
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.
The trading pair this plot is for.
Standard is linear.
What is the recording time for this plot.
Name of this plot
What kind of a plot we are drawing
Points of this plot.
- colour: Optional[str] = None#
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] = 'linear'#
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] = None#
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] = None#
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 = 'decision_making_time'#
What is the recording time for this plot.
Are we adjusted for look ahead bias or not.
- pair: Optional[TradingPairIdentifier] = None#
The trading pair this plot is for.
Plots are not necessarily restricted to a single trading pair, so this is optional.
- __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)#