Add finance_mysql provider + CLI for historical backfill
finance.position (171 rows, 2020-06-07 to 2025-12-19) is the only source of InvestEngine + Schwab trade history pre-dating the broker-sync project. This provider reads it once and pushes every row into the correct WF account (.L tickers → IE ISA, others → Schwab). Dedup: external_id = 'finance-mysql:position:<PK>' — idempotent on re-run. Auth: aiomysql as MySQL root (user-authorized) against the standalone mysql:8.4 in-cluster service. New CLI: broker-sync finance-mysql-import New tests: 5 unit tests covering route, symbol normalise, BUY/SELL detection. poetry run pytest -q → 114 passed, 1 skipped poetry run mypy → clean (aiomysql shielded with type: ignore) poetry run ruff check → clean
This commit is contained in:
parent
74b2179c83
commit
a190875f63
6 changed files with 318 additions and 9 deletions
|
|
@ -243,11 +243,9 @@ class WealthfolioSink:
|
|||
err_msg = summary.get("errorMessage") or "no errorMessage"
|
||||
skipped = int(summary.get("skipped", 0))
|
||||
dupes = int(summary.get("duplicates", 0))
|
||||
raise ImportValidationError(
|
||||
f"Wealthfolio /import persisted {imported_n}/{total_n} "
|
||||
f"(skipped={skipped} duplicates={dupes}). "
|
||||
f"errorMessage: {err_msg}"
|
||||
)
|
||||
raise ImportValidationError(f"Wealthfolio /import persisted {imported_n}/{total_n} "
|
||||
f"(skipped={skipped} duplicates={dupes}). "
|
||||
f"errorMessage: {err_msg}")
|
||||
# Legacy silent-drop guard for no-summary responses.
|
||||
elif valid_rows and not got:
|
||||
first_warn = next(
|
||||
|
|
@ -257,6 +255,6 @@ class WealthfolioSink:
|
|||
raise ImportValidationError(
|
||||
f"Wealthfolio /import silently dropped all {len(valid_rows)} rows. "
|
||||
f"First checked row: {checked[0] if checked else 'none'}. "
|
||||
f"First warning: {first_warn}"
|
||||
)
|
||||
return got
|
||||
f"First warning: {first_warn}")
|
||||
assert isinstance(got, list)
|
||||
return [r for r in got if isinstance(r, dict)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue