# `Beancount.Schemas.Posting`
[🔗](https://github.com/thanos/beancount_ex/blob/v0.6.0/lib/beancount/schemas/posting.ex#L1)

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: %{}
    }

# `t`

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

---

*Consult [api-reference.md](api-reference.md) for complete listing*
