fix(pricing): correct relative hedge payoff calculations

This commit is contained in:
Bu5hm4nn
2026-03-25 19:27:26 +01:00
parent 5217304624
commit bfb6c71be3
6 changed files with 241 additions and 50 deletions

View File

@@ -22,12 +22,13 @@ logger = logging.getLogger(__name__)
def _cost_benefit_options(metrics: dict) -> dict:
return {
"tooltip": {"trigger": "axis"},
"grid": {"left": 64, "right": 24, "top": 24, "bottom": 48},
"xAxis": {
"type": "category",
"data": [f"${point['price']:.0f}" for point in metrics["scenario_series"]],
"name": "GLD spot",
"name": "Collateral spot",
},
"yAxis": {"type": "value", "name": "Net benefit / oz"},
"yAxis": {"type": "value", "name": "Net hedge benefit / oz"},
"series": [
{
"type": "bar",
@@ -35,6 +36,11 @@ def _cost_benefit_options(metrics: dict) -> dict:
"itemStyle": {
"color": "#0ea5e9",
},
"markLine": {
"symbol": "none",
"lineStyle": {"color": "#94a3b8", "type": "dashed"},
"data": [{"yAxis": 0}],
},
}
],
}
@@ -49,12 +55,14 @@ def _waterfall_options(metrics: dict) -> dict:
return {
"tooltip": {"trigger": "axis", "axisPointer": {"type": "shadow"}},
"grid": {"left": 80, "right": 24, "top": 24, "bottom": 48},
"xAxis": {"type": "category", "data": [label for label, _ in steps]},
"yAxis": {"type": "value", "name": "USD"},
"series": [
{
"type": "bar",
"data": values,
"label": {"show": True, "position": "top", "formatter": "{c}"},
},
],
}