beancount
    Preparing search index...

    Class Posting

    Represents a single posting (account movement) within a transaction. Each posting records an amount moving to/from an account.

    Index

    Constructors

    Properties

    account: string

    The account name for this posting

    amount?: string

    The amount as a string (may be omitted for auto-calculated postings)

    comment?: string

    Optional comment for this posting

    cost?: string

    Optional cost specification (e.g., for currency conversions)

    currency?: string

    The currency code for the amount

    flag?: string

    Optional posting flag (e.g., '*' for cleared)

    priceAmount?: string

    Amount for the price annotation

    priceCurrency?: string

    Currency for the price annotation

    Accessors

    • get price(): string | undefined

      Gets the formatted price string combining amount, currency, cost, and price annotation.

      Returns string | undefined

      The formatted price string, or undefined if no price components exist

    Methods

    • Converts this posting to a formatted string with aligned currency column. Adds padding before the price to align at the specified column.

      Parameters

      • formatOptions: FormatOptions = defaultFormatOptions

        Formatting options including currency column position

      Returns string

      The formatted string representation of this posting

    • Converts this posting to a string representation. Delegates to toFormattedString with zero currency column alignment.

      Returns string

      The string representation of this posting

    • Parses a posting line string into a Posting instance. Expected format: [Flag] Account [Amount Currency] [{Cost}] [@ PriceAmount PriceCurrency] [; Comment]

      Parameters

      • unparsedline: string

        The posting line string to parse

      Returns Posting

      A new Posting instance

      If the posting line cannot be parsed