fidelity: snapshot push needs WF account UUID, not logical id
/api/v1/snapshots/import lookups the account by Wealthfolio's own
UUID; passing our provider-side logical id ('fidelity-workplace-pension')
returns 400 'Database operation failed: Record not found'. Resolve
via sink.ensure_account() which the pipeline already runs idempotently,
then pass the returned UUID into push_manual_snapshots().
This commit is contained in:
parent
cb159e17d9
commit
c9c0310733
1 changed files with 7 additions and 4 deletions
|
|
@ -440,9 +440,6 @@ def fidelity_ingest(
|
||||||
async def _run() -> None:
|
async def _run() -> None:
|
||||||
from datetime import date as _date_t
|
from datetime import date as _date_t
|
||||||
|
|
||||||
from broker_sync.providers.fidelity_planviewer import (
|
|
||||||
ACCOUNT_ID as FID_ACCOUNT_ID,
|
|
||||||
)
|
|
||||||
from broker_sync.providers.fidelity_planviewer import (
|
from broker_sync.providers.fidelity_planviewer import (
|
||||||
fidelity_holdings_to_snapshot,
|
fidelity_holdings_to_snapshot,
|
||||||
)
|
)
|
||||||
|
|
@ -478,8 +475,14 @@ def fidelity_ingest(
|
||||||
as_of=_date_t.today(),
|
as_of=_date_t.today(),
|
||||||
)
|
)
|
||||||
if snapshot is not None:
|
if snapshot is not None:
|
||||||
|
# /api/v1/snapshots/import wants WF's own account UUID,
|
||||||
|
# not our logical provider id — look it up via the same
|
||||||
|
# match the pipeline used (provider+providerAccountId).
|
||||||
|
wf_account_id = await sink.ensure_account(
|
||||||
|
provider.accounts()[0],
|
||||||
|
)
|
||||||
push_result = await sink.push_manual_snapshots(
|
push_result = await sink.push_manual_snapshots(
|
||||||
account_id=FID_ACCOUNT_ID, snapshots=[snapshot],
|
account_id=wf_account_id, snapshots=[snapshot],
|
||||||
)
|
)
|
||||||
snapshot_imported = int(push_result.get("snapshotsImported", 0))
|
snapshot_imported = int(push_result.get("snapshotsImported", 0))
|
||||||
finally:
|
finally:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue