Fin# (Financial Sharp) v0.1.0
Browse Table of Contents (6 chapters)
Getting Started (2)
Language Specification (2)
Compiler & Standard Library (1)
Diagnostics & Proofs (1)
Master Symbol Index
3 min read Module: raggiesoft.finsharp F1: IDH_FIN_TRANSACTIONS (0x3004)

Ledgers, Accounts, Atomic Transactions & Z-SOX-302 Proofs

In 1494, Franciscan mathematician Luca Pacioli formalized double-entry bookkeeping around a single conservation equation:

Assets + Expenses = Liabilities + Equity + Revenue

Every valid state transition in a closed accounting system preserves that equality because the sum of debits in every journal entry equals the sum of credits (∑ Debits ≡ ∑ Credits). Fin# promotes Pacioli's 530-year-old equation directly into its grammar.

Declaring a Closed ledger

A ledger block establishes a closed chart of accounts, its functional reporting currency, and its audit-attestation profile (Z_SOX_302 or custom policy tags):

ledger CampusAccessibilityFund [currency: USD, audit_standard: Z_SOX_302] {
    account GrantCashChecking   : Account<Asset, USD>;
    account EquipmentReceivable : Account<Asset, USD>;
    account AdaptiveGearExpense : Account<Expense, USD>;
    account VendorPayable       : Account<Liability, USD>;
    account DonorNetAssets      : Account<Equity, USD>;
    account WorkshopRevenue     : Account<Revenue, USD>;
}

Boundary Ingress: opening_balance(...)

How does money enter a closed ledger when migrating an existing business or opening a fiscal year? Even at the boundary, capital never appears one-sided—opening_balance requires an explicit Asset/Liability pair balanced against an Equity (or Opening Balance Equity) account:

opening_balance(
    debit:  GrantCashChecking,
    credit: DonorNetAssets,
    amount: 25_000.00_USD,
    memo:   "FY2016 Opening Endowment Balance"
);

Atomic transaction Blocks

Every transaction block compiles to:

  1. A compile-time symbolic conservation check (FIN0002 + FIN0005), AND
  2. A runtime all-or-nothing atomic commit record with deterministic SHA-256 hash chaining (Z-SOX-302).

debit and credit Flow Arrows

Notice the directional visual symmetry of Fin#'s posting arrows:

transaction InvoiceAndPayRampSupplier [audit: Z_SOX_302, date: "2015-09-14"] {
    // Leg 1: Accrue vendor invoice ($1,800.00)
    let invoiceObligation : Capital<USD> = credit VendorPayable -> 1_800.00_USD;
    debit AdaptiveGearExpense <- invoiceObligation;

    // Leg 2: Settle half ($900.00) immediately from checking
    let cashDisbursement : Capital<USD> = credit GrantCashChecking -> 900.00_USD;
    debit VendorPayable <- cashDisbursement;
}

In InvoiceAndPayRampSupplier, finsc verifies:

Multi-Currency FX Settlement Bridges (fx.convert)

During the Summer 2015 Singapore arc of The Eleventh Child, household expenses in Singapore Dollars (SGD) had to reconcile cleanly against USD accounts without breaking single-currency conservation (FIN0004).

In Fin#, fx.convert routes cross-currency transfers through dual-currency FX clearing accounts so both the USD sub-ledger AND the SGD sub-ledger remain 100% independently balanced:

transaction ReimburseSingaporeTransitCard [audit: Z_SOX_302, date: "2015-07-18"] {
    let quote = fx.quote<USD, SGD>(1.3685_0000, "2015-07-18T09:00:00Z", "MAS-Spot-Ref");

    let usdOutflow : Capital<USD> = credit UsdTravelChecking -> 100.00_USD;

    // Credits SgdFxClearing in SGD and debits UsdFxClearing in USD atomically:
    let (sgdProceeds, fxReceipt) = fx.convert(usdOutflow, quote, FxClearingBridge);

    debit SgdTransitCardAsset <- sgdProceeds; // Exact 136.85_SGD!
    audit.attach(fxReceipt);
}
Indexed API Calls & Symbols on This Page (5):