Documentation ¶
Index ¶
- Variables
- type Account
- type AccountType
- type Accounts
- type Accrual
- type Assertion
- type Builder
- func (b *Builder) AddAccrual(t Accrual)
- func (b *Builder) AddAssertion(a Assertion)
- func (b *Builder) AddClosing(close Close)
- func (b *Builder) AddOpening(o Open)
- func (b *Builder) AddPrice(p Price)
- func (b *Builder) AddTransaction(t Transaction)
- func (b *Builder) AddValue(a Value)
- func (b *Builder) Build() Ledger
- type Close
- type Commodities
- type Commodity
- type Context
- func (c Context) EquityAccount() *Account
- func (c Context) GetAccount(name string) (*Account, error)
- func (c Context) GetCommodity(name string) (*Commodity, error)
- func (c Context) RetainedEarningsAccount() *Account
- func (c Context) TBDAccount() *Account
- func (c Context) ValuationAccount() *Account
- func (c Context) ValuationAccountFor(a *Account) (*Account, error)
- type Day
- type Directive
- type Filter
- type Finalizer
- type Include
- type Initializer
- type Ledger
- type Lot
- type Open
- type Posting
- type Price
- type Process
- type Processor
- type Range
- type Tag
- type Transaction
- type Value
Constants ¶
This section is empty.
Variables ¶
var AccountTypes = []AccountType{ASSETS, LIABILITIES, EQUITY, INCOME, EXPENSES}
AccountTypes is an array with the ordered accont types.
Functions ¶
This section is empty.
Types ¶
type Account ¶ added in v0.0.13
type Account struct {
// contains filtered or unexported fields
}
Account represents an account which can be used in bookings.
func (Account) Type ¶ added in v0.0.13
func (a Account) Type() AccountType
Type returns the account type.
type AccountType ¶ added in v0.0.13
type AccountType int
AccountType is the type of an account.
const ( // ASSETS represents an asset account. ASSETS AccountType = iota // LIABILITIES represents a liability account. LIABILITIES // EQUITY represents an equity account. EQUITY // INCOME represents an income account. INCOME // EXPENSES represents an expenses account. EXPENSES )
func (AccountType) String ¶ added in v0.0.13
func (t AccountType) String() string
type Accounts ¶ added in v0.0.13
type Accounts struct {
// contains filtered or unexported fields
}
Accounts is a thread-safe collection of accounts.
func NewAccounts ¶ added in v0.0.13
func NewAccounts() *Accounts
NewAccounts creates a new thread-safe collection of accounts.
type Accrual ¶ added in v0.0.7
type Accrual struct { Range Period date.Period T0, T1 time.Time Account *Account Transaction Transaction }
Accrual represents an accrual.
func (Accrual) Expand ¶ added in v0.0.7
func (a Accrual) Expand() []Transaction
Expand expands an accrual transaction.
type Assertion ¶ added in v0.0.7
type Assertion struct { Range Date time.Time Account *Account Amount decimal.Decimal Commodity *Commodity }
Assertion represents a balance assertion.
type Builder ¶
type Builder struct { Context Context // contains filtered or unexported fields }
Builder maps dates to days
func (*Builder) AddAccrual ¶ added in v0.0.13
AddAccrual adds an accrual directive.
func (*Builder) AddAssertion ¶
AddAssertion adds an assertion directive.
func (*Builder) AddClosing ¶
AddClosing adds a close directive.
func (*Builder) AddOpening ¶
AddOpening adds an open directive.
func (*Builder) AddTransaction ¶
func (b *Builder) AddTransaction(t Transaction)
AddTransaction adds a transaction directive.
type Commodities ¶ added in v0.0.13
type Commodities struct {
// contains filtered or unexported fields
}
Commodities is a thread-safe collection of commodities.
func NewCommodities ¶ added in v0.0.13
func NewCommodities() *Commodities
NewCommodities creates a new thread-safe collection of commodities.
type Commodity ¶ added in v0.0.13
type Commodity struct {
// contains filtered or unexported fields
}
Commodity represents a currency or security.
func (Commodity) MarshalJSON ¶ added in v0.0.13
MarshalJSON marshals a commodity to JSON.
type Context ¶ added in v0.0.13
type Context struct {
// contains filtered or unexported fields
}
Context has context for this ledger, namely a collection of referenced accounts and
func NewContext ¶ added in v0.0.13
func NewContext() Context
NewContext creates a new, empty context.
func (Context) EquityAccount ¶ added in v0.0.13
EquityAccount is the equity account used for trades
func (Context) GetAccount ¶ added in v0.0.13
GetAccount returns an account.
func (Context) GetCommodity ¶ added in v0.0.13
GetCommodity returns a commodity.
func (Context) RetainedEarningsAccount ¶ added in v0.0.13
RetainedEarningsAccount returns the account for automatic valuation bookings.
func (Context) TBDAccount ¶ added in v0.0.13
TBDAccount returns the TBD account.
func (Context) ValuationAccount ¶ added in v0.0.13
ValuationAccount returns the account for automatic valuation bookings.
type Day ¶ added in v0.0.7
type Day struct { Date time.Time Prices []Price Assertions []Assertion Values []Value Openings []Open Transactions []Transaction Closings []Close }
Day groups all commands for a given date.
type Directive ¶ added in v0.0.8
type Directive interface {
Position() Range
}
Directive is an element in a journal with a position.
type Filter ¶ added in v0.0.8
Filter represents a filter creating a
func (Filter) MatchAccount ¶ added in v0.0.11
MatchAccount returns whether this filterthe given Account.
func (Filter) MatchCommodity ¶ added in v0.0.11
MatchCommodity returns whether this filter matches the given Commodity.
type Finalizer ¶ added in v0.0.13
type Finalizer interface {
Finalize() error
}
Finalizer gets called after all days have been processed.
type Initializer ¶ added in v0.0.13
Initializer gets called before processing.
type Ledger ¶
Ledger is a
func FromDirectives ¶ added in v0.0.8
FromDirectives reads directives from the given channel and builds a Ledger if successful.
type Posting ¶ added in v0.0.7
type Posting struct {
Amount, Value decimal.Decimal
Credit, Debit *Account
Commodity *Commodity
Lot *Lot
}
Posting represents a posting.
type Price ¶ added in v0.0.7
type Price struct { Range Date time.Time Commodity *Commodity Target *Commodity Price decimal.Decimal }
Price represents a price command.
type Processor ¶ added in v0.0.13
type Processor struct {
Steps []Process
}
Processor processes a ledger.
type Transaction ¶ added in v0.0.7
Transaction represents a transaction.