require 'bean_sprout/struct_from_hash_mixin'
require 'bean_sprout/struct_archive_mixin'

module BeanSprout
  class Account < Struct.new(:currency, :other_data)
    include StructFromHashMixin
    include StructArchiveMixin

    def initialize *fields
      super *fields
      @entries = []
      @balances = [0]
    end

    def append_entry entry
      @entries.push entry
      @balances.push balance + entry.accurate_amount
    end

    def entries
      @entries.clone
    end

    def balance
      @balances.last
    end
  end
end

require 'bean_sprout/struct_from_hash_mixin'
require 'bean_sprout/struct_archive_mixin'

module BeanSprout
  class Account < Struct.new(:currency, :other_data)
    include StructFromHashMixin
    include StructArchiveMixin

    class BalanceHolder < Struct.new(:value)
    end

    def initialize *fields
      super *fields
      @entries = []
      @balance = BalanceHolder.new(0)
    end

    def append_entry entry
      @entries.push entry
      @balance.value += entry.accurate_amount
    end

    def entries
      @entries.clone
    end

    def balance
      @balance.value
    end
  end
end

Use balance holder instead of holding all balances.
Use balance holder instead of holding all balances.
