broker-sync/broker_sync
Viktor Barzin 1d23bf6ed7 sinks: switch Wealthfolio import to JSON body (not multipart CSV)
/api/v1/activities/import expects Content-Type: application/json with body
{"activities": [ActivityImport, ...]} where ActivityImport is camelCase:
{date, symbol, activityType, quantity?, unitPrice?, currency, fee?, amount?,
comment?, accountId?, ...}. Source: crates/core/src/activities/activities_model.rs

Live run failure was HTTP 415 Unsupported Media Type because we were uploading
a CSV in multipart/form-data; that endpoint is JSON-only.

Also handle two response shapes on import — older builds return a list, current
build returns {activities: [...]}.

Test plan:
  poetry run pytest -q   →  70 passed
  poetry run mypy        →  clean
  poetry run ruff check  →  clean
2026-04-17 20:34:12 +00:00
..
providers Wire T212 pagination, retries, and click<8.2 pin 2026-04-17 19:45:23 +00:00
sinks sinks: switch Wealthfolio import to JSON body (not multipart CSV) 2026-04-17 20:34:12 +00:00
__init__.py Initial scaffold + canonical Activity model 2026-04-17 19:16:11 +00:00
cli.py Disable typer rich tracebacks to avoid secret leak in logs 2026-04-17 20:22:30 +00:00
dedup.py Add SyncRecordStore for authoritative dedup 2026-04-17 19:17:12 +00:00
fx.py Add FxCache and convert_to_gbp core 2026-04-17 19:18:41 +00:00
fx_ecb.py Add ECB FX fetcher + cache population 2026-04-17 19:32:23 +00:00
models.py Add SyncRecordStore for authoritative dedup 2026-04-17 19:17:12 +00:00
normaliser.py Add Provider protocol and normaliser 2026-04-17 19:20:12 +00:00
pipeline.py Add sync pipeline + trading212 CLI subcommand 2026-04-17 19:45:43 +00:00