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.
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.

Functions§

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.
expand_pads
Expand a ledger by replacing pad directives with synthetic transactions.
interpolate
Interpolate missing amounts in a transaction.
is_balanced
Check if a transaction is balanced within tolerance.
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.