Skip to content

"Vibe-Trading: Your Personal Trading Agent"

refactor(grounding): remove unused matrix column metadata

Haozhe Wu1e4b0a1d5113
diff --git a/agent/src/agent/grounding/figures.py b/agent/src/agent/grounding/figures.py
index 95eda7b4a..dda43eb05 100644
--- a/agent/src/agent/grounding/figures.py
+++ b/agent/src/agent/grounding/figures.py
@@ -206,8 +206,6 @@ class Figure:
column: str | None = None
date: str | None = None
symbol: str | None = None
- # Raw table header for matrix columns; not an OHLC role.
- table_column_label: str | None = None
scale: float = 1.0
# A currency mark or ISO code touches the digits ("$2050", "0.95 元").
currency: bool = False
@@ -231,7 +229,6 @@ class TableRow:
symbol_column: int | None
# Which table of the document the row belongs to, in document order.
table: int = 0
- headers: tuple[str, ...] = ()
@dataclass(frozen=True)
@@ -827,15 +824,7 @@ def table_rows(content: str) -> list[TableRow]:
if not cells or _is_separator_row(cells):
continue
rows.append(
- TableRow(
- line_index,
- tuple(cells),
- columns,
- date_column,
- symbol_column,
- table,
- tuple(headers),
- )
+ TableRow(line_index, tuple(cells), columns, date_column, symbol_column, table)
)
table += 1
return rows
@@ -1124,11 +1113,9 @@ def scan_figures(content: str, block: FiguresBlock) -> list[Figure]:
shape = "measured"
else:
shape = "bare"
- column = date_value = symbol_value = table_column_label = None
+ column = date_value = symbol_value = None
if row is not None and not structural:
column = row.columns.get(position)
- if position < len(row.headers):
- table_column_label = row.headers[position] or None
if row.date_column is not None and row.date_column < len(row.cells):
date_value = row.cells[row.date_column][0] or None
if row.symbol_column is not None and row.symbol_column < len(row.cells):
@@ -1150,7 +1137,6 @@ def scan_figures(content: str, block: FiguresBlock) -> list[Figure]:
column=column,
date=date_value,
symbol=symbol_value,
- table_column_label=table_column_label,
scale=1.0 if percent else magnitude_suffix(text, token.end)[0],
currency=currency,
digits=token.digits,
diff --git a/agent/tests/test_grounding_blank_corner_matrix.py b/agent/tests/test_grounding_blank_corner_matrix.py
index 78ef8eba0..fd63c8ef1 100644
--- a/agent/tests/test_grounding_blank_corner_matrix.py
+++ b/agent/tests/test_grounding_blank_corner_matrix.py
@@ -30,7 +30,7 @@ def _matrix(header: tuple[str, ...], rows: tuple[str, ...]) -> str:
)
-def test_complete_13_by_13_matrix_binds_both_axes() -> None:
+def test_complete_13_by_13_matrix_binds_every_cell_to_its_row_symbol() -> None:
names = tuple(f"STK{i}" for i in range(1, 14))
source = _matrix(names, names)
assert all(row.symbol_column == 0 for row in table_rows(source))
@@ -40,9 +40,11 @@ def test_complete_13_by_13_matrix_binds_both_axes() -> None:
if f.shape == "measured"
]
assert len(figures) == 169
- assert {(f.symbol, f.table_column_label) for f in figures} == {
- (row, column.lower()) for row in names for column in names
- }
+ assert [(f.symbol, f.value) for f in figures] == [
+ (row, 1.0 if row == column else 0.25)
+ for row in names
+ for column in names
+ ]
def test_incomplete_duplicate_and_mismatched_axes_stay_unscoped() -> None: