contango.trading.analysis.data.graph_runner
contango.trading.analysis.data.graph_runner
GraphRunner
GraphRunner(specs: list[GraphSpec] = DEFAULT_GRAPH_SPECS, template: Template | None = DARK_GRAY_TEMPLATE)
Manages a set of graph specs, instantiating them once the experiment DataFrame is available.
Initializes GraphRunner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
specs
|
list[GraphSpec]
|
A list of specs for each graph type. |
DEFAULT_GRAPH_SPECS
|
template
|
Template | None
|
The plotly template for all graphs to follow. |
DARK_GRAY_TEMPLATE
|
Source code in src\contango\trading\analysis\data\graph_runner.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
graphs
property
graphs: list[GraphType[Any]]
The currently active graph instances (empty until build_all has run
at least once, since some configs depend on the data).
add_graph
add_graph(name: str, config: Union[GraphConfig, GraphConfigFactory]) -> None
Registers a graph spec to be instantiated on the next build_all.
Source code in src\contango\trading\analysis\data\graph_runner.py
124 125 126 127 128 129 130 | |
build_all
build_all(experiments: list[GraphingExperiment]) -> dict[str, go.Figure]
Resolves every spec's config against the data, instantiates the graphs, and builds all of their figures.
Source code in src\contango\trading\analysis\data\graph_runner.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
remove_by_name
remove_by_name(name: str) -> None
Removes all graphs with the same name.
Source code in src\contango\trading\analysis\data\graph_runner.py
139 140 141 142 143 144 | |
remove_graph
remove_graph(graph: GraphType[Any]) -> None
Removes all graphs by instance.
Source code in src\contango\trading\analysis\data\graph_runner.py
132 133 134 135 136 137 | |
GraphSpec
dataclass
GraphSpec(name: str, config: Union[GraphConfig, GraphConfigFactory])
A named graph type paired with its config — either a concrete config, or a factory that builds one once the experiment DataFrame is available.