fix: anchor hedge contribution bars at zero
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from app.pages.common import strategy_metrics
|
||||
from app.pages.hedge import _waterfall_options
|
||||
|
||||
|
||||
def test_protective_put_atm_minus_20pct_improves_equity() -> None:
|
||||
@@ -18,3 +19,13 @@ def test_protective_put_atm_minus_20pct_improves_equity() -> None:
|
||||
("Hedge cost", -6_250.0),
|
||||
("Net equity", 58_750.0),
|
||||
]
|
||||
|
||||
|
||||
def test_hedge_waterfall_uses_zero_based_contribution_bars() -> None:
|
||||
options = _waterfall_options(strategy_metrics("protective_put_atm", -20))
|
||||
|
||||
assert len(options["series"]) == 1
|
||||
assert options["series"][0]["type"] == "bar"
|
||||
values = options["series"][0]["data"]
|
||||
assert values[2]["value"] == 38_000.0
|
||||
assert values[2]["itemStyle"]["color"] == "#22c55e"
|
||||
|
||||
Reference in New Issue
Block a user