MCPcopy Create free account
hub / github.com/Open-Quant/openquant / prepare_cluster_payload

Function prepare_cluster_payload

python/openquant/viz.py:111–123  ·  view source on GitHub ↗
(
    node_id: Sequence[str],
    parent_id: Sequence[str | None],
    height: Sequence[float] | None = None,
)

Source from the content-addressed store, hash-verified

109 return {
110 "chart": "grouped_bar",
111 "left": {"name": left_name, "labels": list(left_labels), "values": list(left_values)},
112 "right": {"name": right_name, "labels": list(right_labels), "values": list(right_values)},
113 }
114
115
116def prepare_drawdown_payload(
117 timestamps: Sequence[str], equity_curve: Sequence[float]
118) -> dict[str, Any]:
119 """Build a line-chart payload of an equity curve and its drawdown.
120
121 Drawdown is `equity / running_max(equity) - 1`, so it is 0 at each new high and
122 negative below it; it assumes a positive equity curve. Timestamps are parsed and
123 re-rendered with `str`, so a timestamp that fails to parse comes out as `"None"`.
124
125 Parameters
126 ----------

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected