Six questions every connector answers

2 months ago

You have looked at your money in an app that was not your bank. Securo is both halves of that: the app you look at, and the piece in the middle that goes and gets your money from your bank. Securo runs on a computer you own.

Ask about this presentation

Chapters

  1. 0:00Securo · the app and the piece in the middle
  2. 0:12Money arrives from a file, or from a live connection
  3. 0:26Brazil, Europe and the United States connect three different ways
  4. 0:51Six questions every connector answers
  5. 1:272,217 lines that never check which connector
  6. 2:17A new connector is one small file and one key
  7. 2:47The country you bank in is a setting
Show transcript
  1. You have looked at your money in an app that was not your bank. Securo is both halves of that: the app you look at, and the piece in the middle that goes and gets your money from your bank. Securo runs on a computer you own.

    Slide text
    your accounts, in three currencies
    what you spent, sorted into categories

    Securo

    your accounts, your budgets and your goals, and it can fetch from banks in Brazil, Europe and the United States
    Python AGPL-3.0 Docker v0.15.0
    docs/screenshot.png · securo-finance/securo @ v0.15.0
  2. Everything lands on one calendar. Your bank already lets you download a file of your statements, and Securo reads that file. Or you set up a live connection and Securo pulls your transactions in by itself. That second one is optional.

    Slide text
    the transaction calendar, one month of days with a running balance on each and a selected day panel
    every account on one calendar
    the file your bank already gives you
    OFX · QIF · CAMT · CSV
    sorted by rules you write
    a live connection
    optional
    README.md L48 · L61
  3. Securo can fetch from three places, and it talks to each one through a small piece of itself called a connector. These three do not work alike at all. For Brazilian banks, a little picker opens inside the page and you choose your bank in there. For European banks, Securo sends you out to your own bank’s website to log in, and then your bank sends you back. For banks in the United States, Securo has no login screen at all. You paste in one string you got somewhere else, and that string carries its own permission.

    Slide text
    KNOWN_PROVIDERS = [
    {
    …
    "display_name": "Pluggy",
    "description":
    "Open finance provider for Brazilian banks",
    "flow_type": "widget",
    …
    },
    {
    …
    "display_name": "Pluggy",
    "description":
    "Open finance provider for Brazilian banks",
    "flow_type": "widget",
    …
    },
    {
    …
    "display_name": "Enable Banking",
    "description":
    "European banks via PSD2 open banking",
    "flow_type": "oauth",
    …
    },
    {
    …
    "display_name": "Enable Banking",
    "description":
    "European banks via PSD2 open banking",
    "flow_type": "oauth",
    …
    },
    {
    …
    "display_name": "SimpleFIN",
    "description":
    "US and international banks via SimpleFIN Bridge",
    "flow_type": "token",
    …
    },
    {
    …
    "display_name": "SimpleFIN",
    "description":
    "US and international banks via SimpleFIN Bridge",
    "flow_type": "token",
    …
    },
    ]
    a dialog with a setup token field and a paste prompt
    the token paste screen
    providers/__init__.py L19-44 · docs/pr-332-simplefin-reconnect/
  4. Here is the part worth knowing. Securo wrote down what a bank connector has to answer, and the list is six things long. What are you called. Where do I send this person to log in. What came back when they did. Which accounts exist. Which transactions exist. And is my permission still good. So those three very different ways in are three small files, and each one answers the same six questions. Everything a connector might also do, like listing banks or looking up what is in an investment account, already has a working answer written into the list itself. So a thin new connector is a small file.

    Slide text
    name what are you called
    get_oauth_url where do I send you to log in
    handle_oauth_callback what came back when you did
    get_accounts which accounts exist
    get_transactions which transactions exist
    refresh_credentials is my permission still good
    pluggy.py
    773
    enable_banking.py
    657
    simplefin.py
    569
    lines
    list_institutions
    trigger_refresh
    get_holdings
    get_bills
    get_institution_logo
    these already have answers written
    providers/base.py L256-394
  5. Look at what that buys. Every time Securo goes and fetches from a bank, that work runs through one file, and the file is two thousand two hundred and seventeen lines long. It looks the connector up by name, once, and from then on it only asks the six questions. So the count of name checks inside that file is zero. Two places in the whole project check a connection by name, and both do one job. Banks in the United States report a credit card debt with the opposite plus or minus sign, so Securo flips that sign once, as soon as the number arrives. The project’s own comment says why: so everything further in never has to know. One connector’s name does show up in one more place. That connector hands back its own category names, so every transaction carries a field named after that connector. The code that reads that field never asks which connector filled it in, only whether the field is empty.

    Slide text
    2,217
    lines in the file every fetch runs through
    0
    checks for which connection this is
    L1664 provider = get_provider(connection.provider)
    …
    L1675 credentials = await provider.refresh_credentials( connection.credentials)
    …
    L1714 accounts_data = await provider.get_accounts(credentials)
    …
    L1837 transactions_data = await provider.get_transactions(
    2
    places in the whole project that check a connection by name
    account_service.py L40 · L359
    “Flip SimpleFIN card balances to match so those sites stay provider-agnostic.”
    if not enabled or not pluggy_category:
    the one place a connector’s name is on the shared shape, and the code reads whether it is filled in
    services/connection_service.py · services/account_service.py L34-40, L359
  6. Adding a country means writing one more of those small files. When Securo starts up, it runs three checks. Is there a Brazilian key. Is there a European key. Is the United States one switched on. A connector whose key is missing is simply not there, and the connect screen you get is built from what each connector says about itself. So a fourth one that says it works like the European way in needs no new screen. You copy the project down and run one command, and it comes up in your browser.

    Slide text
    plus its three lines in providers/__init__.py
    def _auto_register_providers() -> None:
    …
    if settings.pluggy_client_id and
    settings.pluggy_client_secret:
    from app.providers.pluggy import
    PluggyProvider
    register_provider("pluggy", PluggyProvider)
    if settings.pluggy_client_id and
    settings.pluggy_client_secret:
    from app.providers.pluggy import
    PluggyProvider
    register_provider("pluggy", PluggyProvider)
    eb_has_key = bool(
    settings.enable_banking_private_key
    or settings.enable_banking_private_key_file
    )
    if settings.enable_banking_app_id and eb_has_key:
    from app.providers.enable_banking import
    EnableBankingProvider
    register_provider("enable_banking",
    EnableBankingProvider)
    eb_has_key = bool(
    settings.enable_banking_private_key
    or settings.enable_banking_private_key_file
    )
    if settings.enable_banking_app_id and eb_has_key:
    from app.providers.enable_banking import
    EnableBankingProvider
    register_provider("enable_banking",
    EnableBankingProvider)
    if settings.simplefin_enabled:
    from app.providers.simplefin import
    SimpleFinProvider
    register_provider("simplefin", SimpleFinProvider)
    if settings.simplefin_enabled:
    from app.providers.simplefin import
    SimpleFinProvider
    register_provider("simplefin", SimpleFinProvider)
    git clone https://github.com/securo-finance/securo.git && cd securo
    docker compose up --build
    port 3000
    Python
    AGPL-3.0
    v0.15.0
    what each connector says about itself · flow_type · requires_institution_select
    providers/__init__.py L77-98 · README.md L34-38
  7. One list of six questions carries three countries’ banking systems into the same accounts and transactions. Somebody who wants a fourth country writes down the same six answers. That is securo finance slash securo, on GitHub. New repo tomorrow.

    Slide text
    github.com/securo-finance/securo
    Python · AGPL-3.0 · v0.15.0

What happened in AI today, in your inbox

One short email each evening. Read it and you’re caught up.

Built with ❤️ in New York