Skip to content

Conversation

@robcohen
Copy link

Summary

Adds a new simplefin fetch command that fetches all accounts with their transactions and saves each account to a separate JSON file.

Features

  • Fetches all accounts in a single session, then retrieves transactions for each
  • Outputs one JSON file per account (useful for tools like beangulp that expect one file per account)
  • Organizes files hierarchically: <institution>/<account-name>/<account-id>_<date>.json
  • Preserves history with timestamped filenames
  • Handles duplicate account names correctly (same folder, unique filenames)

Usage

simplefin fetch --output-dir ./simplefin-data --lookback-days 30

Creates:

simplefin-data/
  www.chase.com/
    Chase-Checking/
      ACT-abc123_2025-01-15.json
  www.bankofamerica.com/
    Savings/
      ACT-def456_2025-01-15.json

Use Case

This is particularly useful for integration with beangulp importers, which expect one file per account. The hierarchical structure is human-navigable while the account-id in filenames ensures uniqueness.

Changes

  • src/simplefin/cli/__init__.py: Add fetch command
  • tests/test_cli.py: Add 6 tests for the new command
  • README.md: Add documentation for the new command

Test Plan

  • All 6 new tests pass
  • Tested manually with real SimpleFIN account (44 accounts)
  • Verified directory structure and JSON content

Adds a new `simplefin fetch` command that:
- Fetches all accounts with their transactions
- Outputs one JSON file per account
- Organizes files hierarchically: <institution>/<account-name>/<account-id>_<date>.json

This structure is useful for integration with tools like beangulp that
expect one file per account. The hierarchical layout is human-navigable
and the timestamped filenames preserve history.

Usage:
    simplefin fetch --output-dir /path/to/output --lookback-days 30
- Add test_cli.py with 6 tests covering:
  - Directory structure creation
  - File naming convention
  - JSON content (account metadata + transactions)
  - Duplicate account name handling
  - Required options validation

- Update README.md with fetch command documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant