Add tests and refactor for Simplefin holdings import and processing

- Introduced tests for importer post-import logic and `SimplefinHoldingsApplyJob`.
- Refactored `ProviderImportAdapter` to improve holding resolution strategy.
- Added handling of investment and crypto holdings in importer with debounce logic for job enqueuing.
- Updated rake task to use `SimplefinHoldingsApplyJob` for holding materialization.
This commit is contained in:
Josh Waldrep
2025-11-22 14:41:21 -05:00
parent 3fe9768d72
commit 195dd18a52
7 changed files with 253 additions and 17 deletions

View File

@@ -124,9 +124,9 @@ namespace :sure do
if dry_run
puts({ dry_run: true, sfa_id: sfa.id, account_id: account.id, name: sfa.name, would_process: count }.to_json)
else
SimplefinAccount::Investments::HoldingsProcessor.new(sfa).process
SimplefinHoldingsApplyJob.perform_later(sfa.id)
total_holdings_written += count
puts({ ok: true, sfa_id: sfa.id, account_id: account.id, name: sfa.name, processed: count }.to_json)
puts({ ok: true, sfa_id: sfa.id, account_id: account.id, name: sfa.name, enqueued: true, estimated_holdings: count }.to_json)
end
sleep(sleep_ms / 1000.0) if sleep_ms.positive?