model

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	UUID         string
	Name         string
	Currency     string
	Note         string
	Retired      bool
	Transactions []AccountTransaction
}

Account represents a cash/deposit account.

type AccountTransaction

type AccountTransaction struct {
	UUID        string
	Type        string
	Date        time.Time
	Amount      int64 // integer minor units
	Currency    string
	Note        string
	SecurityRef string // raw reference attribute (resolved to Security pointer)
	Security    *Security
	Units       []TxUnit
}

AccountTransaction represents a single transaction within an account.

type Assignment

type Assignment struct {
	SecurityRef string
	Security    *Security
	Weight      int
}

Assignment links a security to a classification with a weight.

type AttributeType

type AttributeType struct {
	ID   string
	Name string
	Type string
}

AttributeType defines a custom attribute type for securities or accounts.

type Bookmark

type Bookmark struct {
	Label string
	URL   string
}

Bookmark represents a saved view/filter configuration.

type Classification

type Classification struct {
	ID          string
	Name        string
	Color       string
	Weight      int
	Children    []Classification
	Assignments []Assignment
}

Classification is a node in the taxonomy tree.

type Client

type Client struct {
	Version      int
	BaseCurrency string
	Securities   []*Security
	Accounts     []*Account
	Portfolios   []*Portfolio
	Taxonomies   []*Taxonomy
	Settings     *Settings
}

Client is the root struct representing the Portfolio Performance data file.

type Holding

type Holding struct {
	Security    *Security
	NetShares   Shares
	LatestPrice int64 // 0 if unknown
	Currency    string
	Value       int64 // 0 if unknown; minor units
}

Holding represents a net share position in a portfolio for a single security.

func ComputeHoldings

func ComputeHoldings(portfolio *Portfolio) []Holding

ComputeHoldings aggregates net share positions from a portfolio's transactions. It returns one Holding per security that appears in the portfolio. Securities with net shares ≤ 0 are included; callers filter as needed.

type Money

type Money struct {
	Amount   int64
	Currency string
}

Money represents a monetary value stored as integer minor units (e.g., 100 = €1.00).

func (Money) Value

func (m Money) Value() float64

Value returns the money amount as a float64 decimal value.

type Portfolio

type Portfolio struct {
	UUID                string
	Name                string
	ReferenceAccount    *Account
	ReferenceAccountRef string // raw reference string, resolved to ReferenceAccount
	Transactions        []PortfolioTransaction
}

Portfolio represents a securities portfolio (depot).

type PortfolioTransaction

type PortfolioTransaction struct {
	UUID        string
	Type        string
	Date        time.Time
	Shares      Shares // integer ×10^8
	Amount      int64  // integer minor units
	Currency    string
	Note        string
	SecurityRef string // raw reference attribute (resolved to Security pointer)
	Security    *Security
	Units       []TxUnit
}

PortfolioTransaction represents a buy/sell or transfer within a portfolio.

type Security

type Security struct {
	UUID      string
	Name      string
	Currency  string
	ISIN      string
	Ticker    string
	Feed      string
	Retired   bool
	UpdatedAt time.Time
	Prices    []SecurityPrice
	Events    []SecurityEvent
}

Security represents a financial security (stock, ETF, bond, etc.).

type SecurityEvent

type SecurityEvent struct {
	Type    string
	Date    time.Time
	Amount  int64
	Details string
}

SecurityEvent represents a corporate action or dividend event.

type SecurityPrice

type SecurityPrice struct {
	Date  time.Time
	Value int64 // integer minor units
}

SecurityPrice represents a price data point for a security.

type Settings

type Settings struct {
	Bookmarks      []Bookmark
	AttributeTypes []AttributeType
}

Settings holds application settings from the portfolio file.

type Shares

type Shares int64

Shares represents a share quantity stored as int64 multiples of 10^8. e.g., 50000000000 = 500 shares.

func (Shares) Value

func (s Shares) Value() float64

Value returns the shares as a float64 decimal value.

type Taxonomy

type Taxonomy struct {
	ID   string
	Name string
	Root Classification
}

Taxonomy represents a classification taxonomy (e.g., asset allocation, industry).

type TxUnit

type TxUnit struct {
	Type     string
	Amount   int64
	Currency string
	Shares   Shares
}

TxUnit represents a sub-unit of a transaction (e.g., fees, taxes).

Jump to

Keyboard shortcuts

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