I start with either ofxget 
<https://ofxtools.readthedocs.io/en/latest/client.html> or this simplefin 
shell script to download transactions. Simplefin couldn't be easier - pull 
access 
token url <https://beta-bridge.simplefin.org/info/developers> out of 
keyring (secret-tool), *curl* it, *jq* the json for human readability, 
*echo* the file because I'll forget where I left it.

#!/bin/bash
start_date="$(date -d '2 weeks ago' +%s)"
# secret-tool store --label "SimpleFIN" service SimpleFIN application 
Beancount
url="$(secret-tool lookup service SimpleFIN application Beancount)"
curl --silent "$url/accounts?start-date=$start_date" | jq > 
~/Downloads/simplefin.json
echo ~/Downloads/simplefin.json

I get 2 weeks of context because I'm usually behind schedule and it feeds 
context for my out-of-place/reverse deduplication routine. Then this is the 
business end of my beangulp script. *simplefin* takes a dict of anything 
might be in the export, and my simple "decorator 
<https://github.com/pwalkr/beancount-utils/blob/main/beancount_utils/decorator.py>"
 
categorization class:

import beangulp
import beancount_utils.importers as ix
from beancount_utils.decorator import Decorator
decorator = Decorator.from_yaml('lib/decorations.yml')
ingest = beangulp.Ingest(
    importers=[
        ix.simplefin.Importer({
            "ACT-abc123": "Assets:Liquid:Wealthfront:Cash",
            "ACT-def456": "Liabilities:Credit:Chase",
        }, decorate=decorator.decorate),
    ]
)
ingest()

For automatic categorization, the decorator has been working really well 
for me. "decorations" are just objects with regular expressions to match 
*payee*s. If it matches, tags/narration/add'l accounts, etc are added to 
the transaction. I do this after deduplication 
<https://github.com/pwalkr/beancount-utils/blob/54c118f4a4d6a706691fa3442db523b5253e3287/beancount_utils/importers/simplefin.py#L62>
 
so manually changing target account doesn't interfere. I need to expand it 
for per-importer/account-specific matches. Simple config, quick to amend:

- payee: Walmart
  re: WALMART|WM SUPERCENTER|WAL-MART
  narration: Groceries
  target_account: 'Expenses:Food:Groceries'

- payee: Wells Fargo
  re: WF HOME MTG-AUTO PAY
  narration: Mortgage payment
  tags: [Autopay]

Paul

On Thursday, January 9, 2025 at 10:29:27 PM UTC-5 [email protected] 
wrote:

I've been experimenting with SimpleFin for a few weeks. I have one script 
which runs each morning and downloads the data for all my accounts, saving 
it directly in the JSON format returned by SimpleFin. I have a separate 
importer that uses a configuration file to define the different accounts. 
It's just a list of organization, SimpleFin account ID and Beancount 
account name. I have 6 institutions connected covering over 20 accounts.

But I'm not using this in production yet as I'm trying to write the 
equivalent of Red S's smart importer to predict the category account.
On Thursday, January 9, 2025 at 6:49:58 PM UTC-5 Brian Lalor wrote:

I’m interested in this, as well; I’ve signed up for a SimpleFIN account but 
haven’t actually used it in anger, yet. 

Do you have a sample config showing how your importer’s used? I’d like to 
copy some of your work. :-)

What’s your workflow? A separate script that downloads from SimpleFIN and 
dumps the JSON into an imports directory?

I also wish beangulp weren’t so tied to individual files; it makes writing 
an importer that works with non-file sources awkward, at best, and I think 
that’s reflected in the singular account restriction, as well…

— 
Brian Lalor (he/him)
[email protected]

On Jan 9, 2025, at 10:28 AM, Paul Walker <[email protected]> wrote:

Hey all,

I'm curious what importer tricks anyone has for statements with multiple 
accounts. Aggregators like SimpleFIN <https://beta-bridge.simplefin.org/> 
(recently discovered, a great stand-in for banks dropping ofx~
ofxtools/ofxget <https://ofxtools.readthedocs.io/en/latest/> support) pull 
many unrelated accounts into one export file. The beangulp-required account 
function makes this seem antipattern ("which account?"). This also applies 
to some PDFs (like Fidelity which groups all retirement/non-retirement into 
a pair of PDFs), but I imagine many of those at least share a common 
base/parent account.

My current solution is to input a dict of all expected accounts 
<https://github.com/pwalkr/beancount-utils/blob/54c118f4a4d6a706691fa3442db523b5253e3287/beancount_utils/importers/simplefin.py#L37>,
 
but again is awkward for the self.account 
<https://github.com/pwalkr/beancount-utils/blob/54c118f4a4d6a706691fa3442db523b5253e3287/beancount_utils/importers/simplefin.py#L28>
 
function (I don't actually use "archive" workflow) and is making me update 
my out_of_place deduplicator 
<https://github.com/pwalkr/beancount-utils/blob/54c118f4a4d6a706691fa3442db523b5253e3287/beancount_utils/deduplicate.py#L6>
 
which catches manually-created expenses on the wrong credit/debit card. It 
just doesn't isolate context and messes with the overall extract.

The alternative I've considered is to avoid multiple-account statements. 
SimpleFIN can get individual accounts 
<https://www.simplefin.org/protocol.html#get-accounts>, I believe that's in 
the ofx spec too. So then I'd just get account-specific extracts and 
initialize an importer for each. But then I remembered the likely more 
common but more difficult to split multi-account PDFs and thought to share 
and see if the community had other ideas.

Paul 

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an 
email to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/beancount/cd8f42de-dc67-446b-985b-cdcdc79b25f0n%40googlegroups.com
 
<https://groups.google.com/d/msgid/beancount/cd8f42de-dc67-446b-985b-cdcdc79b25f0n%40googlegroups.com?utm_medium=email&utm_source=footer>
.


-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/beancount/4f1eff91-8847-4f52-8180-8fc7780837f4n%40googlegroups.com.

Reply via email to