Add SnapTrade brokerage integration with full trade history support

Merged
LU
10mo ago
+4417-25

Overview

Adds SnapTrade as a new provider for investment accounts. SnapTrade connects to 25+ major brokerages (Fidelity, Vanguard, Schwab, Robinhood, etc.) and provides full trade history, up to 5 years, with activity labels and cost basis - filling the investment data gap that SimpleFIN cannot provide.

Key Features

  • BYOK model: Users configure their own SnapTrade API credentials (free tier = 5 connections)
  • Full activity labels: Buy, Sell, Dividend, Reinvestment, Contribution, Withdrawal, etc.
  • Cost basis support: Per-position cost basis from brokerages
  • Per-account sync start date: Users can choose how far back to import transactions during setup
  • Async activity fetching: Background job handles SnapTrade's delay in fetching historical data from brokerages

Implementation

  • New models: SnaptradeItem (credentials), SnaptradeAccount (per-account data)
  • Processors for holdings and activities with proper security resolution
  • Connection portal flow with OAuth-like redirect to SnapTrade
  • Setup accounts modal for selecting which brokerage accounts to link
  • Provider adapter registered for linking existing accounts

Files

  • 3 migrations (snaptrade tables, activities_fetch_pending flag, sync_start_date)
  • ~20 new files (models, controllers, views, locales)
  • Modified shared files to include SnapTrade alongside other providers
snap-accounts snap-robin-holdings snap-robintest snap-setup

Summary by CodeRabbit

  • New Features

    • Full SnapTrade integration: connect brokerages, register users, link accounts, setup flows, view SnapTrade items with sync status, summaries, and account actions.
    • Background syncing & processing: robust fetches, retries, per-account syncs, trades/holdings/activities ingestion, and cleanup jobs.
    • UI/UX: trades shown with loading states; dialogs can opt out of closing on outside clicks; adaptive quantity formatting.
  • Tests

    • Extensive unit and integration tests for SnapTrade models, processors, and controllers.
  • Chores

    • Added dependency, migrations, locales, parameter filtering, fixtures, and route/config updates.

✏️ Tip: You can customize this high-level summary in your review settings.