balance

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2020 License: Apache-2.0 Imports: 9 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
	Positions              map[model.CommodityAccount]amount.Amount
	Account                map[*accounts.Account]bool
	Prices                 prices.Prices
	Valuations             []*commodities.Commodity
	NormalizedPrices       []prices.NormalizedPrices
	CloseIncomeAndExpenses bool
}

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(valuations []*commodities.Commodity) *Balance

New creates a new balance.

func (*Balance) Copy

func (b *Balance) Copy() *Balance

Copy deeply copies the balance

func (*Balance) GetPositions

func (b *Balance) GetPositions(valuation *int) map[model.CommodityAccount]decimal.Decimal

GetPositions returns the positions for the given valuation index. An index of nil returns the raw counts.

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(step *ledger.Step) error

Update updates the balance with the given step

Jump to

Keyboard shortcuts

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