Documentation ¶
Index ¶
- Constants
- Variables
- func CheckTxSanity(tx *Tx) error
- func PrintRenderTable(tableModel *RenderTable, writer io.Writer)
- func SplitTxsBySecurity(txs []*Tx) map[string][]*Tx
- func SuperficialLossPercent(idx int, txs []*Tx, shareBalanceAfterSell uint32) float64
- type ColParser
- type Currency
- type LegacyOptions
- type PortfolioSecurityStatus
- type RenderTable
- type Tx
- type TxAction
- type TxDelta
Constants ¶
View Source
const (
CsvDateFormatDefault string = "2006-01-02"
)
Variables ¶
View Source
var ColNames []string
View Source
var CsvDateFormat string = CsvDateFormatDefault
View Source
var ONE_DAY_DUR = mustParseDuration("24h")
Functions ¶
func CheckTxSanity ¶
func PrintRenderTable ¶
func PrintRenderTable(tableModel *RenderTable, writer io.Writer)
func SplitTxsBySecurity ¶
func SuperficialLossPercent ¶
Calculation of partial superficial losses where Superficial loss = (min(#sold, totalAquired, endBalance) / #sold) x (Total Loss) This function returns the left hand side of this formula, on the condition that the loss is actually superficial.
Types ¶
type LegacyOptions ¶
func NewLegacyOptions ¶
func NewLegacyOptions() LegacyOptions
type PortfolioSecurityStatus ¶
func NewEmptyPortfolioSecurityStatus ¶
func NewEmptyPortfolioSecurityStatus(security string) *PortfolioSecurityStatus
func (*PortfolioSecurityStatus) PerShareAcb ¶
func (s *PortfolioSecurityStatus) PerShareAcb() float64
type RenderTable ¶
func RenderTxTableModel ¶
func RenderTxTableModel(deltas []*TxDelta, renderFullDollarValues bool) *RenderTable
type Tx ¶
type Tx struct { Security string Date time.Time Action TxAction Commission float64 TxCurrency Currency TxCurrToLocalExchangeRate float64 CommissionCurrency Currency CommissionCurrToLocalExchangeRate float64 Memo string // The absolute order in which the Tx was read from file or entered. // Used as a tiebreak in sorting. ReadIndex uint32 }
func ParseTxCsv ¶
type TxDelta ¶
type TxDelta struct { Tx *Tx PreStatus *PortfolioSecurityStatus PostStatus *PortfolioSecurityStatus CapitalGain float64 SuperficialLoss float64 }
func AddTx ¶
func AddTx(idx int, txs []*Tx, preTxStatus *PortfolioSecurityStatus, legacyOptions LegacyOptions) (*TxDelta, error)
func TxsToDeltaList ¶
func TxsToDeltaList(txs []*Tx, initialStatus *PortfolioSecurityStatus, legacyOptions LegacyOptions) ([]*TxDelta, error)
func (*TxDelta) SuperficialLossPercent ¶
Click to show internal directories.
Click to hide internal directories.