diff --git a/README.md b/README.md index ffd66a4..cdde5dd 100644 --- a/README.md +++ b/README.md @@ -25,66 +25,151 @@ Examples below leverage the SimpleFIN Bridge Demo Access URL of `https://demo:de #### Get accounts - ❯ simplefin accounts - SimpleFIN Accounts - ┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓ - ┃ Institution ┃ Account ┃ Balance ┃ Account ID ┃ - ┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩ - │ SimpleFIN Demo │ SimpleFIN Savings │ 114125.50 │ Demo Savings │ - │ SimpleFIN Demo │ SimpleFIN Checking │ 24302.22 │ Demo Checking │ - └────────────────┴────────────────────┴───────────┴───────────────┘ +`simplefin accounts [--format FORMAT]` + + +``` +❯ simplefin accounts + SimpleFIN Accounts +┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓ +┃ Institution ┃ Account ┃ Balance ┃ Account ID ┃ +┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩ +│ SimpleFIN Demo │ SimpleFIN Savings │ 115525.50 │ Demo Savings │ +│ SimpleFIN Demo │ SimpleFIN Checking │ 26134.42 │ Demo Checking │ +└────────────────┴────────────────────┴───────────┴───────────────┘ +``` + + +##### JSON output + + +``` +❯ simplefin accounts --format json +[ + { + "org": { + "domain": "beta-bridge.simplefin.org", + "sfin-url": "https://beta-bridge.simplefin.org/simplefin", + "name": "SimpleFIN Demo", + "url": "https://beta-bridge.simplefin.org", + "id": "simplefin.demoorg" + }, + "id": "Demo Savings", + "name": "SimpleFIN Savings", + "currency": "USD", + "balance": "115525.50", + "available-balance": "115525.50", + "balance-date": 1738368000, + "transactions": [], + "holdings": [] + }, + { + "org": { + "domain": "beta-bridge.simplefin.org", + "sfin-url": "https://beta-bridge.simplefin.org/simplefin", + "name": "SimpleFIN Demo", + "url": "https://beta-bridge.simplefin.org", + "id": "simplefin.demoorg" + }, + "id": "Demo Checking", + "name": "SimpleFIN Checking", + "currency": "USD", + "balance": "26134.42", + "available-balance": "26134.42", + "balance-date": 1738368000, + "transactions": [], + "holdings": [] + } +] +``` + #### Get transactions for an account `simplefin transactions ACCOUNT_ID [--format FORMAT] [--lookback-days INTEGER]` - ❯ simplefin transactions "Demo Savings" - Transactions for Demo Savings - ┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━┓ - ┃ Date ┃ Payee ┃ Amount ┃ - ┡━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━┩ - │ 10 Jan 2025 │ John's Fishin Shack │ -50.00 │ - │ 10 Jan 2025 │ Grocery store │ -90.00 │ - │ 11 Jan 2025 │ John's Fishin Shack │ -55.50 │ - │ 11 Jan 2025 │ Grocery store │ -85.50 │ - └─────────────┴─────────────────────┴────────┘ + +``` +❯ simplefin transactions "Demo Savings" + Transactions for Demo Savings +┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┓ +┃ Date ┃ Payee ┃ Amount ┃ +┡━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━┩ +│ 01 Feb 2025 │ You │ 1960.00 │ +│ 01 Feb 2025 │ John's Fishin Shack │ -05.50 │ +│ 01 Feb 2025 │ Grocery store │ -135.50 │ +└─────────────┴─────────────────────┴─────────┘ +``` + ##### JSON output We convert the posted and transacted_at, if provided, values into ISO strings. - ❯ simplefin transactions "Demo Savings" --format json - [ - { - "id": "1736496000", - "posted": "2025-01-10T08:00:00+00:00", - "amount": "-50.00", - "description": "Fishing bait", - "payee": "John's Fishin Shack", - "memo": "JOHNS FISHIN SHACK BAIT" - }, - { - "id": "1736524800", - "posted": "2025-01-10T16:00:00+00:00", - "amount": "-90.00", - "description": "Grocery store", - "payee": "Grocery store", - "memo": "LOCAL GROCER STORE #1133" - }, - { - "id": "1736582400", - "posted": "2025-01-11T08:00:00+00:00", - "amount": "-55.50", - "description": "Fishing bait", - "payee": "John's Fishin Shack", - "memo": "JOHNS FISHIN SHACK BAIT" - }, - { - "id": "1736611200", - "posted": "2025-01-11T16:00:00+00:00", - "amount": "-85.50", - "description": "Grocery store", - "payee": "Grocery store", - "memo": "LOCAL GROCER STORE #1133" - } - ] + +``` +❯ simplefin transactions "Demo Savings" --format json +[ + { + "id": "1738382400", + "posted": "2025-02-01T04:00:00+00:00", + "amount": "1960.00", + "description": "Pay day!", + "payee": "You", + "memo": "PAY DAY - FROM YER JOB" + }, + { + "id": "1738396800", + "posted": "2025-02-01T08:00:00+00:00", + "amount": "-05.50", + "description": "Fishing bait", + "payee": "John's Fishin Shack", + "memo": "JOHNS FISHIN SHACK BAIT" + }, + { + "id": "1738425600", + "posted": "2025-02-01T16:00:00+00:00", + "amount": "-135.50", + "description": "Grocery store", + "payee": "Grocery store", + "memo": "LOCAL GROCER STORE #1133" + } +] +``` + diff --git a/pyproject.toml b/pyproject.toml index 093cdb0..2d687e0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,6 +22,7 @@ build-backend = "hatchling.build" [dependency-groups] dev = [ + "cogapp>=3.4.1", "pytest>=8.3.4", "pytest-httpx>=0.35.0", "ruff>=0.9.0", @@ -32,4 +33,4 @@ source = "vcs" raw-options = { local_scheme = "no-local-version" } [tool.hatch.build.targets.wheel] -packages = ["src/simplefin"] \ No newline at end of file +packages = ["src/simplefin"] diff --git a/uv.lock b/uv.lock index d6201f8..3d01132 100644 --- a/uv.lock +++ b/uv.lock @@ -35,6 +35,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/7e/d4/7ebdbd03970677812aac39c869717059dbb71a4cfc033ca6e5221787892c/click-8.1.8-py3-none-any.whl", hash = "sha256:63c132bbbed01578a06712a2d1f497bb62d9c1c0d329b7903a866228027263b2", size = 98188 }, ] +[[package]] +name = "cogapp" +version = "3.4.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/b1/d7/9e40d9d957ab1042046b3f6959528f47f9c6e8cb0f2031a3ba69809ed6e9/cogapp-3.4.1.tar.gz", hash = "sha256:a806d5db9e318a1a2d3fce988008179168e7db13e5e55b19b79763f9bb9d2982", size = 53776 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/92/4e/bd3bd0641fb05ba3ab6e16ffb9132ef71ffdeb0392ce21ec6670ff66eaf6/cogapp-3.4.1-py3-none-any.whl", hash = "sha256:1daba7b6c8bb23b733c64833de7aa3a42476c05afba19cff937e1b522216859d", size = 27328 }, +] + [[package]] name = "colorama" version = "0.4.6" @@ -224,6 +233,7 @@ dependencies = [ [package.dev-dependencies] dev = [ + { name = "cogapp" }, { name = "pytest" }, { name = "pytest-httpx" }, { name = "ruff" }, @@ -238,6 +248,7 @@ requires-dist = [ [package.metadata.requires-dev] dev = [ + { name = "cogapp", specifier = ">=3.4.1" }, { name = "pytest", specifier = ">=8.3.4" }, { name = "pytest-httpx", specifier = ">=0.35.0" }, { name = "ruff", specifier = ">=0.9.0" },