Beancount.Schemas.Posting (beancount_ex v0.6.0)

Copy Markdown View Source

Persisted transaction posting (embedded schema).

Storage-layer counterpart of Beancount.Directives.Posting. Embedded inside Beancount.Schemas.Transaction via embeds_many/3; it has no table of its own and no file_order (ordering follows the enclosing transaction).

Fields

  • account - account the posting affects, e.g. "Assets:Bank".
  • amount - posting quantity as Decimal.t(), or nil for an elided leg.
  • currency - commodity of amount, or nil when elided.
  • cost - embedded Beancount.Schemas.CostSpec for lot cost, or nil.
  • price - price annotation map (@/@@), or nil.
  • flag - optional per-posting flag, e.g. "!".
  • metadata - arbitrary key/value map.

Example

%Beancount.Schemas.Posting{
  account: "Assets:Stocks",
  amount: Decimal.new("10"),
  currency: "AAPL",
  cost: %Beancount.Schemas.CostSpec{per_amount: Decimal.new("150"), per_currency: "USD"},
  price: nil,
  flag: nil,
  metadata: %{}
}

Summary

Types

t()

@type t() :: %Beancount.Schemas.Posting{
  account: term(),
  amount: term(),
  cost: term(),
  currency: term(),
  flag: term(),
  id: term(),
  metadata: term(),
  price: term()
}