Skip to main content

Crate rustledger_booking

Crate rustledger_booking 

Source
Expand description

Beancount booking engine with interpolation.

This crate provides:

  • Transaction interpolation (filling in missing amounts)
  • Transaction balancing verification
  • Tolerance calculation

§Interpolation

When a transaction has exactly one posting per currency without an amount, that amount can be calculated to make the transaction balance.

use rustledger_booking::interpolate;

// Transaction with one missing amount
// 2024-01-15 * "Groceries"
//   Expenses:Food  50.00 USD
//   Assets:Cash               <- amount inferred as -50.00 USD

Structs§

BookedTransaction
Result of booking a single transaction.
BookingEngine
Booking engine that tracks inventory across transactions.
CapitalGain
A capital gain or loss from a lot sale.
InterpolationResult
Result of interpolation.
LedgerBookResult
Outcome of booking an entire ledger in one shot — see book.
PadError
Error during pad processing.
PadResult
Result of processing pad directives.

Enums§

BookingError
Errors that can occur during booking.
InterpolationError
Errors that can occur during interpolation.

Constants§

SYNTH_PAD_NARRATION_PREFIX
Prefix of the narration carried by every synth pad transaction produced by this crate (the format string used inside the private create_padding_transaction constructor).

Functions§

book
Book and interpolate every transaction in a ledger in one shot.
book_transactions
Book and interpolate a list of transactions.
calculate_residual
Calculate the residual (imbalance) of a transaction.
calculate_residual_precise
Calculate the residual of a transaction using arbitrary-precision arithmetic.
calculate_tolerance
Calculate the tolerance for a set of amounts.
interpolate
Interpolate missing amounts in a transaction.
is_balanced
Check if a transaction is balanced within tolerance.
is_synthesized_pad
Returns true iff txn is a pad-synth transaction produced by this crate.
merge_with_padding
Merge original directives with padding transactions, maintaining date order.
normalize_prices
Normalize total prices (@@) to per-unit prices (@) on a transaction.
process_pads
Process pad directives and generate synthetic transactions.