Skip to content

Add professional financial statement formatter to finquick #76

Open

Description

@dckc

Problem

Financial data from GnuCash SQLite databases often needs to be presented in a professional, readable format with proper currency symbols, thousands separators, and column alignment. Currently, raw SQL output is difficult to read and share.

Proposed Solution

Add a new package packages/format-financial/ with a Python script that formats financial data tables with:

Key Features

  • Currency formatting: Automatic $ symbols and thousands separators ($1,234.56)
  • Perfect column alignment: Dynamic width calculation for clean tables
  • Dual output modes: Both plain text (terminal-friendly) and markdown table formats
  • Decimal precision: Uses Python's Decimal class to avoid floating-point errors
  • Testable design: I/O separated from formatting logic with comprehensive doctests

Usage Examples

# Plain text output (also valid markdown)
python3 format_financial.py database.sqlite view_name

# Pure markdown output  
python3 format_financial.py database.sqlite view_name --markdown

Sample Output

| as_of_date |      assets | liabilities |   net_worth | retained_earnings |      equity |    eq |
| ---------: | ----------: | ----------: | ----------: | ----------------: | ----------: | ----: |
| 2024-12-31 | $796,380.82 |       $0.00 | $796,380.82 |        $25,222.54 | $771,158.28 | $0.00 |
| 2025-06-30 | $811,111.21 |       $0.00 | $811,111.21 |        $36,153.82 | $774,957.39 | $0.00 |

Technical Implementation

Benefits

  • Professional financial reports suitable for sharing
  • Works with any SQLite view/table containing financial data
  • Eliminates manual formatting of GnuCash query results
  • Reusable across different finquick workflows
  • Well-tested and maintainable code

Activity

  1. dckc commented on Jul 22, 2025

    @dckc
    OwnerAuthor

    The code is already written in another repository:

    2025-07-22 02:22 cc17731 feat: format_financial.py - $ symbols, 000 separators, right align

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions