Visualisation#

tradeexecutor.state.visualisation.Visualisation class.

class Visualisation[source]#

Bases: object

This object is returned from the strategy execution cycle. It allows you to plot values, add debug messages, etc. It is not used in any trading, but can help and visualize trade backtesting and execution.

__init__(messages=<factory>, plots=<factory>)#
Parameters
Return type

None

Methods

__init__([messages, plots])

add_message(timestamp, content)

Write a debug message.

from_dict(kvs, *[, infer_missing])

from_json(s, *[, parse_float, parse_int, ...])

plot_indicator(timestamp, name, kind, value)

Add a value to the output data and diagram.

schema(*[, infer_missing, only, exclude, ...])

to_dict([encode_json])

to_json(*[, skipkeys, ensure_ascii, ...])

Attributes

messages

Messages for each strategy cycle.

plots

Name -> Plot value mappings

messages: Dict[int, List[str]]#

Messages for each strategy cycle.

TODO: Because we cannot use datetime.datetime directly as a key in JSON, we use UNIX timestamp here to keep our state easily serialisable.

plots: Dict[str, Plot]#

Name -> Plot value mappings

add_message(timestamp, content)[source]#

Write a debug message.

  • Each message is associated to a different timepoint.

Parameters
  • timestamp (datetime) – The current strategy cycle timestamp

  • content (str) – The contents of the message

plot_indicator(timestamp, name, kind, value, colour=None)[source]#

Add a value to the output data and diagram.

Plots are stored by their name.

Parameters
__init__(messages=<factory>, plots=<factory>)#
Parameters
Return type

None