balance

package
v0.0.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Balance

type Balance struct {
	Date             time.Time
	Amounts, Values  map[CommodityAccount]decimal.Decimal
	Account          map[*accounts.Account]bool
	Valuation        *commodities.Commodity
	NormalizedPrices prices.NormalizedPrices
}

Balance represents a balance for accounts at the given date.

func Diffs

func Diffs(bals []*Balance) []*Balance

Diffs creates the difference balances for the given slice of balances. The returned slice is one element smaller than the input slice. The balances are mutated.

func New

func New(valuation *commodities.Commodity) *Balance

New creates a new balance.

func (*Balance) Copy

func (b *Balance) Copy() *Balance

Copy deeply copies the balance

func (*Balance) Minus

func (b *Balance) Minus(bo *Balance)

Minus mutably subtracts the given balance from the receiver.

func (*Balance) Update

func (b *Balance) Update(day *ledger.Day, np prices.NormalizedPrices, close bool) error

Update updates the balance with the given Day

type Builder added in v0.0.8

type Builder struct {
	From, To    *time.Time
	Period      *date.Period
	Last        int
	Valuation   *commodities.Commodity
	Close, Diff bool
}

Builder builds a sequence of balances.

func (Builder) Build added in v0.0.8

func (b Builder) Build(l ledger.Ledger) ([]*Balance, error)

Build builds a sequence of balances.

type CommodityAccount added in v0.0.7

type CommodityAccount struct {
	Account   *accounts.Account
	Commodity *commodities.Commodity
}

CommodityAccount represents a position.

func (CommodityAccount) Less added in v0.0.7

Less establishes a partial ordering of commodity accounts.

type Error added in v0.0.6

type Error struct {
	// contains filtered or unexported fields
}

Error is an error.

func (Error) Error added in v0.0.6

func (be Error) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL