Skip to main content

Double-entry ledger engine with pluggable storage backends

Project description

TigerStar

A double-entry ledger engine with pluggable storage backends.

Features

  • Double-entry bookkeeping — every transfer debits one account and credits another
  • Two-phase transfers — reserve funds (pending), then post or void
  • Linked transfers — atomic chains that all succeed or all fail
  • Balance constraints — prevent overdrafts with account flags
  • Multi-currency — separate ledgers per currency with configurable precision
  • Financial reporting — trial balance, balance sheet, general ledger
  • Storage adapters — swap between Firestore and PostgreSQL without changing application code
  • Concurrent-safe — row-level locking (Postgres) or optimistic transactions (Firestore)

Install

pip install tigerstar[postgres]    # PostgreSQL only
pip install tigerstar[firestore]   # Firestore only
pip install tigerstar[all]         # both backends

Quick Start

With Firestore

from tigerstar import TigerStar, FirestoreStorage

storage = FirestoreStorage(credentials_path="path/to/firebase-adminsdk.json")
engine = TigerStar(storage=storage)

With PostgreSQL

from tigerstar import TigerStar, PostgresStorage

storage = PostgresStorage(dsn="postgresql://user:pass@localhost:5432/dbname")
storage.migrate()
engine = TigerStar(storage=storage)

Create a ledger and move money

from tigerstar import Ledger, Account, AccountType, AccountFlags, Transfer, TransferCode

ledger = Ledger(currency="TZS", precision=0, max_transfer_amount=10_000_000)
engine.create_ledger(ledger)

cash = Account(ledger_id=ledger.id, code=AccountType.ASSET)
user = Account(
    ledger_id=ledger.id,
    code=AccountType.LIABILITY,
    flags=AccountFlags(debits_must_not_exceed_credits=True),
)
engine.create_accounts([cash, user])

engine.create_transfers([
    Transfer(
        debit_account_id=cash.id,
        credit_account_id=user.id,
        ledger_id=ledger.id,
        amount=50000,
        code=TransferCode.PAYMENT,
    ),
])

Storage Adapters

Adapter Database Best For
FirestoreStorage Google Cloud Firestore Serverless, zero-ops, auto-scaling
PostgresStorage PostgreSQL Financial-grade ACID, SQL flexibility, cost control

Both adapters implement the same interface — swap one for the other with zero application changes. See docs/adapters.md for connection pooling, migrations, and writing custom adapters.

Documentation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tigerstar-0.1.0.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tigerstar-0.1.0-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file tigerstar-0.1.0.tar.gz.

File metadata

  • Download URL: tigerstar-0.1.0.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tigerstar-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e1df80407547978b4b070d9268ab251155bb1b831991a61616e9d78e75114fd5
MD5 f6b303d17574e65156790af9a9b94bd4
BLAKE2b-256 87597ce6a6da46aba6a6bf52967b11f001cc464ef0c2b41a6fab110b1824b145

See more details on using hashes here.

Provenance

The following attestation bundles were made for tigerstar-0.1.0.tar.gz:

Publisher: publish.yml on erickweyunga/tigerstar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tigerstar-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tigerstar-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tigerstar-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f3536dfced53a72d8f7bebe83e04fbe7a16331311f03ad8ba780253a3f42d1c7
MD5 7343c5c511391658cc1aaf2001f26063
BLAKE2b-256 b579b1b99c615915bc33f9c2e475059e10d74d0a80540336bdcaa328452d9f57

See more details on using hashes here.

Provenance

The following attestation bundles were made for tigerstar-0.1.0-py3-none-any.whl:

Publisher: publish.yml on erickweyunga/tigerstar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page