Documentation
¶
Index ¶
- func RegisterScheduleParser(name string, parser ScheduleParser)
- type Account
- type ManualAdjustment
- type Portfolio
- func (p Portfolio) Chart(recs []ProjectionRecord) chart.Chart
- func (p *Portfolio) NewAccount(name string) *Account
- func (p *Portfolio) NewManualAdjustment(acc *Account, t time.Time, balance float32)
- func (p *Portfolio) NewTransaction(from, to *Account, desc string, s Schedule, start, stop *time.Time, ...) *Transaction
- func (p *Portfolio) Project(years int) []ProjectionRecord
- func (p *Portfolio) Stats() PortfolioStats
- func (p *Portfolio) TotalBalance() float32
- type PortfolioStats
- type ProjectionRecord
- type RetirementPlan
- type Schedule
- type ScheduleParser
- type Transaction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterScheduleParser ¶
func RegisterScheduleParser(name string, parser ScheduleParser)
RegisterScheduleParser registers a schedule parser
Types ¶
type Account ¶
type Account struct { Name string Portfolio *Portfolio Balance float32 AnnualInterestRate float32 // contains filtered or unexported fields }
Account is a named account with a balance. An account may also have an annual interest rate which is applied monthly.
type ManualAdjustment ¶
type ManualAdjustment struct { Portfolio *Portfolio Account *Account Time time.Time Balance float32 // contains filtered or unexported fields }
ManualAdjustment is a single manual adjustment made on an account.
type Portfolio ¶
type Portfolio struct { Accounts []*Account Transactions []*Transaction ManualAdjustments []*ManualAdjustment RetirementPlan *RetirementPlan Debug bool }
Portfolio represents a person's financial portfolio.
func (Portfolio) Chart ¶
func (p Portfolio) Chart(recs []ProjectionRecord) chart.Chart
Chart generates a chart for the projection.
func (*Portfolio) NewAccount ¶
NewAccount adds a new account to the portfolio.
func (*Portfolio) NewManualAdjustment ¶
NewManualAdjustment adds a new manual adjustment to the portfolio. It should be used to set the initial balance for an account or to log significant intended changes in the value of an account.
func (*Portfolio) NewTransaction ¶
func (p *Portfolio) NewTransaction(from, to *Account, desc string, s Schedule, start, stop *time.Time, amt float32) *Transaction
NewTransaction adds a new transaction to the portfolio.
func (*Portfolio) Project ¶
func (p *Portfolio) Project(years int) []ProjectionRecord
Project a portfolio's balances for a period of time.
func (*Portfolio) Stats ¶
func (p *Portfolio) Stats() PortfolioStats
Stats gets stats for a portfolio.
func (*Portfolio) TotalBalance ¶
TotalBalance gets the current total balance for all accounts.
type PortfolioStats ¶
type PortfolioStats struct { AverageMonthlyExpenses float32 AverageMonthlyIncome float32 AverageMonthlyGrowth float32 }
PortfolioStats is a collection of stats about the portfolio.
func (PortfolioStats) String ¶
func (s PortfolioStats) String() string
type ProjectionRecord ¶
ProjectionRecord is a record in a projection.
type RetirementPlan ¶
type RetirementPlan struct { DeathDate time.Time YearlyExpenses float32 // contains filtered or unexported fields }
RetirementPlan is a plan to retire.
func (*RetirementPlan) BalanceNeeded ¶
func (p *RetirementPlan) BalanceNeeded(t time.Time) float32
BalanceNeeded is the balance needed to retire at a given date.
func (*RetirementPlan) RetireDate ¶
func (p *RetirementPlan) RetireDate() (time.Time, bool)
RetireDate gets the found retirement date.
type Schedule ¶
Schedule determines the next time for a transaction to be applied, based on the last time it was applied. YearlyFactor should return the average number of times the schedule will be applied in a year (eg. a weekly schedule is applied 52 times in a year)
type ScheduleParser ¶
ScheduleParser parses a schedule
func GetScheduleParser ¶
func GetScheduleParser(name string) (ScheduleParser, bool)
GetScheduleParser gets a schedule parser
type Transaction ¶
type Transaction struct { Description string Portfolio *Portfolio Schedule Schedule FromAccount *Account ToAccount *Account Amount float32 Start *time.Time Stop *time.Time }
Transaction is a transaction from one account to another. It may have a schedule to repeat the transaction on some interval. If FromAccount or ToAccount is nil, this transaction represents money in/out of the portfolio (payments, income, etc.). Otherwise it is a transfer between two accounts in the portfolio.