Documentation ¶
Index ¶
- type AST
- func (ast *AST) AddAssertion(a *Assertion)
- func (ast *AST) AddClose(c *Close)
- func (ast *AST) AddOpen(o *Open)
- func (ast *AST) AddPrice(p *Price)
- func (ast *AST) AddTransaction(t *Transaction)
- func (ast *AST) AddValue(v *Value)
- func (ast *AST) Day(d time.Time) *Day
- func (ast *AST) Max() time.Time
- func (ast *AST) Min() time.Time
- func (ast *AST) SortedDays() []*Day
- type Accrual
- type Assertion
- type Close
- type Currency
- type Day
- type Directive
- type Include
- type Lot
- type Open
- type Performance
- type Period
- type Posting
- func NewPosting(crAccount, drAccount *journal.Account, commodity *journal.Commodity, ...) Posting
- func NewPostingWithTargets(crAccount, drAccount *journal.Account, commodity *journal.Commodity, ...) Posting
- func NewValuePosting(crAccount, drAccount *journal.Account, commodity *journal.Commodity, ...) Posting
- type Price
- type Range
- type Tag
- type Transaction
- func (t Transaction) Accrual() *Accrual
- func (t Transaction) Commodities() map[*journal.Commodity]bool
- func (t Transaction) Date() time.Time
- func (t Transaction) Description() string
- func (t *Transaction) FilterPostings(f journal.Filter) []Posting
- func (t *Transaction) Less(t2 *Transaction) bool
- func (t Transaction) Position() Range
- func (t Transaction) Postings() []Posting
- func (t Transaction) Tags() []Tag
- func (t Transaction) ToBuilder() TransactionBuilder
- type TransactionBuilder
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AST ¶
type AST struct { Context journal.Context Days map[time.Time]*Day // contains filtered or unexported fields }
AST represents an unprocessed abstract syntax tree.
func (*AST) AddAssertion ¶
AddAssertion adds an Assertion directive.
func (*AST) AddTransaction ¶
func (ast *AST) AddTransaction(t *Transaction)
AddTransaction adds an Transaction directive.
func (*AST) SortedDays ¶
SortedDays returns all days ordered by date.
type Accrual ¶
Accrual represents an accrual.
func (Accrual) Expand ¶
func (a Accrual) Expand(t *Transaction) []*Transaction
Expand expands an accrual transaction.
type Assertion ¶
type Assertion struct { Range Date time.Time Account *journal.Account Amount decimal.Decimal Commodity *journal.Commodity }
Assertion represents a balance assertion.
type Day ¶
type Day struct { Date time.Time Prices []*Price Assertions []*Assertion Values []*Value Openings []*Open Transactions []*Transaction Closings []*Close Amounts, Value amounts.Amounts Normalized journal.NormalizedPrices Performance *Performance }
Day groups all commands for a given date.
type Directive ¶
type Directive interface {
Position() Range
}
Directive is an element in a journal with a position.
type Performance ¶ added in v0.0.15
type Performance struct {
V0, V1, Inflow, Outflow, InternalInflow, InternalOutflow map[*journal.Commodity]float64
PortfolioInflow, PortfolioOutflow float64
}
Performance holds aggregate information used to compute portfolio performance.
type Period ¶ added in v0.0.16
type Period struct { Period date.Period Amounts, Values amounts.Amounts DeltaAmounts, DeltaValues amounts.Amounts PrevAmounts, PrevValues amounts.Amounts Days []*Day }
Period represents a period.
type Posting ¶
type Posting struct {
Amount, Value decimal.Decimal
Credit, Debit *journal.Account
Commodity *journal.Commodity
Targets []*journal.Commodity
Lot *Lot
}
Posting represents a posting.
func NewPosting ¶
func NewPosting(crAccount, drAccount *journal.Account, commodity *journal.Commodity, amt decimal.Decimal) Posting
NewPosting creates a new posting from the given parameters. If amount is negative, it will be inverted and the accounts reversed.
func NewPostingWithTargets ¶
func NewPostingWithTargets(crAccount, drAccount *journal.Account, commodity *journal.Commodity, amt decimal.Decimal, targets []*journal.Commodity) Posting
NewPostingWithTargets creates a new posting from the given parameters. If amount is negative, it will be inverted and the accounts reversed.
func NewValuePosting ¶ added in v0.0.15
func NewValuePosting(crAccount, drAccount *journal.Account, commodity *journal.Commodity, val decimal.Decimal, targets []*journal.Commodity) Posting
NewValuePosting creates a value adjustment posting.
type Price ¶
type Price struct { Range Date time.Time Commodity *journal.Commodity Target *journal.Commodity Price decimal.Decimal }
Price represents a price command.
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
Transaction represents a transaction.
func (Transaction) Accrual ¶ added in v0.0.15
func (t Transaction) Accrual() *Accrual
Accrual returns the accrual.
func (Transaction) Commodities ¶
func (t Transaction) Commodities() map[*journal.Commodity]bool
Commodities returns the commodities in this transaction.
func (Transaction) Description ¶
func (t Transaction) Description() string
Description returns the description.
func (*Transaction) FilterPostings ¶ added in v0.0.15
func (t *Transaction) FilterPostings(f journal.Filter) []Posting
FilterPostings returns a list of postings matching the supplied filter.
func (*Transaction) Less ¶
func (t *Transaction) Less(t2 *Transaction) bool
Less defines an order on transactions.
func (Transaction) Position ¶ added in v0.0.15
func (t Transaction) Position() Range
Position returns the source location.
func (Transaction) Postings ¶
func (t Transaction) Postings() []Posting
Postings returns the postings.
func (Transaction) ToBuilder ¶ added in v0.0.15
func (t Transaction) ToBuilder() TransactionBuilder
ToBuilder creates a new builder based on this transaction.
type TransactionBuilder ¶ added in v0.0.15
type TransactionBuilder struct { Range Range Date time.Time Description string Tags []Tag Postings []Posting Accrual *Accrual }
TransactionBuilder builds transactions.
func (TransactionBuilder) Build ¶ added in v0.0.15
func (tb TransactionBuilder) Build() *Transaction
Build builds a transactions.