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.1.tar.gz (16.8 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.1-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tigerstar-0.1.1.tar.gz
  • Upload date:
  • Size: 16.8 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.1.tar.gz
Algorithm Hash digest
SHA256 098377a28b7ca1df83b271fb7d103dd3078835f7cebc05a7daf007613411daba
MD5 0fb004f661c4cc18b691a7e590e1e39b
BLAKE2b-256 a3388f19b753bbfdb3c722f691cb8835f6acb2354e5c5ec80ccfc864cd96cef3

See more details on using hashes here.

Provenance

The following attestation bundles were made for tigerstar-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: tigerstar-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 19.7 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1a2b28d8d68ac8917df2ac623cb2f2c8f72d8a9d58434a3cbfccd954f12f33e7
MD5 92d52b67ff4aaeec6b793089b2f511d1
BLAKE2b-256 7c2a3f91e5c8c69154be43177934a6aaaf4764a42bc504941afa9271eaf0b624

See more details on using hashes here.

Provenance

The following attestation bundles were made for tigerstar-0.1.1-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