Documentation ¶
Index ¶
- Constants
- Variables
- func CashFlowTypeIsCredit(CashFlowType uint) bool
- func CashFlowTypeIsDebit(CashFlowType uint) bool
- func SecurityBasisTypeIsAverage(basisTypeID uint) bool
- func SecurityBasisTypeIsValid(SecurityBasisTypeID uint) bool
- func SecurityTypeIsValid(SecurityTypeID uint) bool
- func TradeTypeIsBuy(TradeTypeID uint) bool
- func TradeTypeIsDistribution(TradeTypeID uint) bool
- func TradeTypeIsDividend(TradeTypeID uint) bool
- func TradeTypeIsReinvest(TradeTypeID uint) bool
- func TradeTypeIsSell(TradeTypeID uint) bool
- func TradeTypeIsSharesIn(TradeTypeID uint) bool
- func TradeTypeIsSharesOut(TradeTypeID uint) bool
- func TradeTypeIsSplit(TradeTypeID uint) bool
- func TradeTypeIsValid(TradeTypeID uint) bool
- func TradeTypeToCashFlowType(TradeTypeID uint) uint
- type Account
- func (a *Account) AddToBalance(fAmount float64)
- func (a *Account) ClearBooleans()
- func (a *Account) Create(session *Session) error
- func (Account) Currency(value decimal.Decimal) string
- func (a *Account) Delete(session *Session) error
- func (*Account) Find(ID uint) *Account
- func (a *Account) Get(session *Session, preload bool) *Account
- func (a *Account) GetRouting() string
- func (a *Account) GetSecurity(session *Session, company *Company) (*Security, error)
- func (a *Account) GetSecurityBySymbol(session *Session, symbol string) (*Security, error)
- func (a Account) HasAverageDailyBalance() bool
- func (a *Account) HaveAccessPermission(session *Session) bool
- func (a *Account) Init() *Account
- func (a *Account) IsInvestment() bool
- func (account *Account) ListImports(session *Session, limit int) []Import
- func (account *Account) ListScheduled(session *Session, canRecordOnly bool) []CashFlow
- func (a *Account) ListSecurities(session *Session, openPositions bool) []Security
- func (a Account) PortfolioTotalReturn() decimal.Decimal
- func (a *Account) Print()
- func (a *Account) PrintAll()
- func (a *Account) SetAverageDailyBalance(session *Session)
- func (a *Account) SupportsDownload(requireID bool) bool
- func (a *Account) TotalPortfolio(securities []Security)
- func (a *Account) Update() error
- type AccountType
- type CashFlow
- func (c *CashFlow) CanSplit() bool
- func (c *CashFlow) Count(account *Account) int64
- func (c *CashFlow) Create(session *Session) error
- func (CashFlow) Currency(value decimal.Decimal) string
- func (c *CashFlow) Delete(session *Session) error
- func (*CashFlow) Find(ID uint) *CashFlow
- func (c *CashFlow) Get(session *Session, edit bool) *CashFlow
- func (c CashFlow) GetTransnum() string
- func (c *CashFlow) HasSplits() bool
- func (c *CashFlow) HaveAccessPermission(session *Session) bool
- func (c *CashFlow) IsCredit() bool
- func (c *CashFlow) IsDebit() bool
- func (c *CashFlow) IsScheduled() bool
- func (c *CashFlow) IsScheduledEnterable(allowFutureNoRepeat bool) bool
- func (c *CashFlow) IsScheduledParent() bool
- func (c CashFlow) IsSellTrade() bool
- func (c *CashFlow) IsTrade() bool
- func (*CashFlow) List(db *gorm.DB, account *Account) []CashFlow
- func (*CashFlow) ListByDate(db *gorm.DB, account *Account, date *time.Time) []CashFlow
- func (*CashFlow) ListMerge(db *gorm.DB, account *Account, other []CashFlow) []CashFlow
- func (*CashFlow) ListMergeByDate(db *gorm.DB, account *Account, other []CashFlow, date *time.Time) []CashFlow
- func (c *CashFlow) ListSplit(db *gorm.DB) ([]CashFlow, string)
- func (c *CashFlow) ParentID() uint
- func (c *CashFlow) Preload(db *gorm.DB)
- func (c *CashFlow) PreloadRepeat(db *gorm.DB)
- func (c *CashFlow) Print()
- func (c *CashFlow) PrintAll()
- func (c *CashFlow) Put(session *Session, request map[string]interface{}) error
- func (c *CashFlow) RepeatParentID() uint
- func (c CashFlow) ShowTradeLinks() bool
- func (c *CashFlow) SplitCount() uint
- func (c *CashFlow) Update() error
- type CashFlowType
- type Category
- type CategoryType
- type Company
- func (c *Company) Create(isUpdate bool) *Company
- func (*Company) Find(ID uint) *Company
- func (*Company) FindBySymbol(symbol string) *Company
- func (c *Company) Get() *Company
- func (c *Company) GetBySymbol() []Company
- func (c *Company) GetFiling(fType string, date time.Time) edgar.Filing
- func (c *Company) GetFilingDate(f FilingData) string
- func (c *Company) GetFilingDates(fType string) []time.Time
- func (c *Company) GetFilingItem(f FilingData, item string) float64
- func (c *Company) GetFilingItemNames(viewName string) []string
- func (c *Company) GetFilingItemString(f FilingData, item string) string
- func (c Company) GetName() string
- func (c *Company) HasFilings() bool
- func (c Company) NumFilings(fType string) int
- func (c *Company) Print()
- func (c *Company) Update() bool
- type CurrencyType
- type FilingData
- type HttpFile
- type Import
- func (im *Import) CountImported(session *Session)
- func (im *Import) FetchOFX(session *Session) error
- func (im *Import) Get(session *Session) *Import
- func (i *Import) HaveAccessPermission(session *Session) bool
- func (im *Import) ImportFile(session *Session, importFile HttpFile) error
- func (im *Import) ImportFromOFX(session *Session, resp *ofxgo.Response, after *time.Time) error
- func (im *Import) ImportFromQFX(session *Session, importFile HttpFile) error
- func (im *Import) ImportFromQIF(session *Session, importFile HttpFile) error
- func (im *Import) ListImported(session *Session) []CashFlow
- type Institution
- type Model
- type Payee
- func (p Payee) CategoryName() string
- func (p *Payee) ClearBooleans()
- func (p *Payee) Create(session *Session) error
- func (p *Payee) Delete(session *Session) error
- func (*Payee) Find(ID uint) *Payee
- func (p *Payee) Get(session *Session) *Payee
- func (p *Payee) GetDuplicates() []Payee
- func (p *Payee) HaveAccessPermission(session *Session) bool
- func (p *Payee) InUse() bool
- func (*Payee) List(session *Session, account *Account) []Payee
- func (p *Payee) ListCashFlows(account *Account) []CashFlow
- func (p *Payee) Merge(toMerge *Payee, account *Account) error
- func (p *Payee) Print()
- func (p *Payee) SetCategory(account *Account, categoryID uint, toAll bool) error
- func (p *Payee) Update() error
- func (p Payee) UseByAccount(a *Account) uint
- func (p Payee) UseCount() uint
- type RepeatInterval
- func (r *RepeatInterval) Create(db *gorm.DB, c *CashFlow) error
- func (*RepeatInterval) Find(ID uint) *RepeatInterval
- func (r RepeatInterval) GetRate() string
- func (r RepeatInterval) GetRepeatsLeft() string
- func (r RepeatInterval) HasRepeatsLeft() bool
- func (r *RepeatInterval) Preload(db *gorm.DB)
- func (r *RepeatInterval) Print()
- func (r *RepeatInterval) SetRepeatsLeft(repeats string)
- func (r *RepeatInterval) Update() error
- type RepeatIntervalType
- type Security
- func (s Security) BasisPrice() decimal.Decimal
- func (s *Security) ChangeAccount(session *Session, name string) *Account
- func (s *Security) ChartsEnabled() bool
- func (s *Security) Create(session *Session) error
- func (Security) Currency(value decimal.Decimal) string
- func (s *Security) Delete(session *Session) error
- func (*Security) Find(ID uint) *Security
- func (s *Security) Get(session *Session) *Security
- func (s *Security) GetChartData(days int) string
- func (s *Security) GetChartDataByte(days int) []byte
- func (s *Security) GetChartOptions() string
- func (s *Security) GetChartOptionsByte() []byte
- func (s *Security) HasFilings() bool
- func (s *Security) HaveAccessPermission(session *Session) bool
- func (s *Security) LatestTradeBy(db *gorm.DB, tradeType uint) *Trade
- func (s *Security) List(session *Session, openPositions bool) []Security
- func (s *Security) ListTrades() []Trade
- func (s *Security) ListTradesBy(tradeType uint, openOnly bool) []Trade
- func (s Security) Price() decimal.Decimal
- func (s *Security) Print()
- func (s *Security) PrintAll()
- func (s Security) TotalReturn() decimal.Decimal
- func (s *Security) UnrealizedGain() decimal.Decimal
- func (s Security) UnrealizedReturn() decimal.Decimal
- func (s *Security) Update() error
- type SecurityBasisType
- type SecurityChart
- type SecurityChartAxisOptions
- type SecurityChartDataSet
- type SecurityChartOptions
- type SecurityChartScaleOptions
- type SecurityChartTickOptions
- type SecurityQuote
- type SecurityQuoteCache
- type SecurityType
- type SecurityValue
- type Session
- type TaxCategory
- type TaxConstant
- type TaxEntry
- func (te *TaxEntry) Create(session *Session) error
- func (TaxEntry) Currency(value decimal.Decimal) string
- func (te *TaxEntry) Delete(session *Session) error
- func (te *TaxEntry) Get(session *Session) *TaxEntry
- func (te *TaxEntry) HaveAccessPermission(session *Session) bool
- func (*TaxEntry) List(session *Session, year int) []TaxEntry
- func (te *TaxEntry) Update() error
- type TaxFilingStatus
- type TaxItem
- func (item *TaxItem) Get(db *gorm.DB) *TaxItem
- func (item *TaxItem) GetByName(db *gorm.DB, name string) *TaxItem
- func (*TaxItem) List(db *gorm.DB) []TaxItem
- func (it *TaxItem) ListTaxCashFlows(session *Session, year int) ([]CashFlow, decimal.Decimal)
- func (item *TaxItem) Sum(db *gorm.DB, r *TaxReturn, name string) decimal.Decimal
- type TaxRegion
- type TaxReturn
- func (t *TaxReturn) Create(session *Session) error
- func (TaxReturn) Currency(value decimal.Decimal) string
- func (r *TaxReturn) Delete(session *Session) error
- func (t TaxReturn) FilingStatusLabel() string
- func (r *TaxReturn) Get(session *Session) *TaxReturn
- func (r *TaxReturn) HaveAccessPermission(session *Session) bool
- func (*TaxReturn) List(session *Session, year int) []TaxReturn
- func (r *TaxReturn) Recalculate(session *Session) error
- type TaxType
- type TaxYear
- type Trade
- func (t *Trade) Count(account *Account) int64
- func (t *Trade) Create(session *Session) error
- func (Trade) Currency(value decimal.Decimal) string
- func (t *Trade) Delete(session *Session) error
- func (*Trade) Find(ID uint) *Trade
- func (t *Trade) Get(session *Session) *Trade
- func (t Trade) GetBasis() string
- func (t *Trade) HaveAccessPermission(session *Session) bool
- func (t *Trade) IsAverageCost() bool
- func (t *Trade) IsBuy() bool
- func (t *Trade) IsCredit() bool
- func (t *Trade) IsReinvest() bool
- func (t *Trade) IsSell() bool
- func (t *Trade) IsSharesIn() bool
- func (t *Trade) IsSharesOut() bool
- func (t *Trade) IsSplit() bool
- func (*Trade) List(db *gorm.DB, account *Account) []Trade
- func (t *Trade) ListByType(session *Session, tradeType uint, daysHeld uint) ([]Trade, [2]decimal.Decimal)
- func (t *Trade) ListByTypeTotal(session *Session, tradeType uint, daysHeld uint) [2]decimal.Decimal
- func (t *Trade) ListCashFlowByType(session *Session, tradeType uint) ([]CashFlow, decimal.Decimal)
- func (t *Trade) ListCashFlows(db *gorm.DB, account *Account) []CashFlow
- func (t *Trade) ListGains() ([]TradeGain, []decimal.Decimal)
- func (t *Trade) ListImportedCashFlows(im *Import) []CashFlow
- func (t *Trade) Print()
- func (t *Trade) PrintAll()
- func (t *Trade) Save() error
- func (t *Trade) SharesRemaining() decimal.Decimal
- func (t *Trade) Update() error
- func (t *Trade) UpdateAdjustedShares(fShares float64)
- func (t Trade) ViewIsSell() bool
- func (t *Trade) WasReinvest() bool
- type TradeGain
- type TradeType
- type User
- func (u *User) Authenticate(password string) bool
- func (u *User) Cache() *UserCache
- func (u *User) Create(password [2]string) error
- func (u *User) Delete(session *Session) error
- func (u *User) Get(session *Session) *User
- func (u *User) GetByLogin(login string) *User
- func (u *User) HaveAccessPermission(session *Session) *User
- func (u *User) ListTaxCategory(db *gorm.DB, year int, taxCat *TaxCategory) ([]CashFlow, decimal.Decimal)
- func (u *User) ListTaxCategoryTotal(db *gorm.DB, year int, taxCat *TaxCategory) decimal.Decimal
- func (u *User) NewSession() *Session
- type UserCache
- type UserSettings
Constants ¶
const ( AccountTypeUndefined uint = iota AccountTypeCash AccountTypeDeposit AccountTypeCreditCard AccountTypeInvestment AccountTypeHealthCare AccountTypeLoan AccountTypeAsset AccountTypeCrypto )
const ( UndefinedType uint = iota Debit Credit DebitTransfer CreditTransfer )
const ( FilingTypeUndefined string = "" FilingTypeAnnual = "10-K" FilingTypeQuarterly = "10-Q" )
const ( BalanceSheet string = "Balance Sheet" IncomeStatement = "Income Statement" CashFlowStatement = "CashFlow Statement" ConsolidatedStatements = "Consolidated Financials" )
const ( Cash uint = iota Investments CurrentAssets Goodwill Intangibles Assets ShortTermDebt UnearnedRevenue CurrentLiabilities LongTermDebt Liabilities RetainedEarnings Equity Revenue CostOfRevenue GrossProfit OperatingExpense OperatingIncome Interest NetIncome OperatingCashFlow CapEx DividendPaid )
const ( UndefinedSecurityBasisType uint = iota BasisFIFO BasisAverage )
const ( UndefinedSecurityType uint = iota Stock MutualFund Bond BondFund MoneyMarket Currency ForeignStock ForeignStockFund ForeignBond ForeignBondFund // skip 2 OtherStock = iota + 2 OtherFunds Commodities PreciousMetal RealEstate Other Options Cryptocurrency )
const ( FilingStatusUndefined uint = iota Single MarriedJointly MarriedSeparately HeadOfHousehold )
const ( TaxTypeUndefined uint = iota TaxTypeIncome TaxTypeIncomeCapitalGain TaxTypeDeductionsForAGI TaxTypeDeductionFromAGI TaxTypeItemizedDeduction TaxTypeTax TaxTypeCredits TaxTypePayments )
const ( UndefinedTradeType uint = iota Buy Sell // below are not Trades, but CashFlow Credits Dividend Distribution // below are effectively Buy types, but no CashFlow Debit ReinvestedDividend ReinvestedDistribution // below only for moving Shares between accounts, careful some 401k // exported data will incorrectly encode ReinvestedDividend as SharesIn // trade.Shares is split ratio (specified negative for reverse split) Split )
const (
DefaultCashFlowLimit = 200
)
Variables ¶
var ConsolidatedFilingItemKeys = []string{
"Cash",
"Investments",
"Current Assets",
"Goodwill",
"Intangibles",
"Assets",
"Short-Term Debt",
"Unearned Revenue",
"Current Liabilities",
"Long-Term Debt",
"Liabilities",
"Retained Earnings",
"Equity",
"Basic Shares",
"Diluted Shares",
"Revenue",
"Cost Of Revenue",
"Gross Profit",
"Operating Expense",
"Operating Income",
"Interest",
"Net Income",
"Operating CashFlow",
"CapEx",
"Dividend Paid",
}
order of below must match above for map keys to be correct
var ConsolidatedFilingItemMap = map[string]func(edgar.Filing) (float64, error){ ConsolidatedFilingItemKeys[Cash]: edgar.Filing.Cash, ConsolidatedFilingItemKeys[Investments]: edgar.Filing.Securities, ConsolidatedFilingItemKeys[CurrentAssets]: edgar.Filing.CurrentAssets, ConsolidatedFilingItemKeys[Goodwill]: edgar.Filing.Goodwill, ConsolidatedFilingItemKeys[Intangibles]: edgar.Filing.Intangibles, ConsolidatedFilingItemKeys[Assets]: edgar.Filing.Assets, ConsolidatedFilingItemKeys[ShortTermDebt]: edgar.Filing.ShortTermDebt, ConsolidatedFilingItemKeys[UnearnedRevenue]: edgar.Filing.DeferredRevenue, ConsolidatedFilingItemKeys[CurrentLiabilities]: edgar.Filing.CurrentLiabilities, ConsolidatedFilingItemKeys[LongTermDebt]: edgar.Filing.LongTermDebt, ConsolidatedFilingItemKeys[Liabilities]: edgar.Filing.Liabilities, ConsolidatedFilingItemKeys[RetainedEarnings]: edgar.Filing.RetainedEarnings, ConsolidatedFilingItemKeys[Equity]: edgar.Filing.TotalEquity, ConsolidatedFilingItemKeys[BasicShares]: edgar.Filing.ShareCount, ConsolidatedFilingItemKeys[DilutedShares]: edgar.Filing.WAShares, ConsolidatedFilingItemKeys[Revenue]: edgar.Filing.Revenue, ConsolidatedFilingItemKeys[CostOfRevenue]: edgar.Filing.CostOfRevenue, ConsolidatedFilingItemKeys[GrossProfit]: edgar.Filing.GrossMargin, ConsolidatedFilingItemKeys[OperatingExpense]: edgar.Filing.OperatingExpense, ConsolidatedFilingItemKeys[OperatingIncome]: edgar.Filing.OperatingIncome, ConsolidatedFilingItemKeys[Interest]: edgar.Filing.Interest, ConsolidatedFilingItemKeys[NetIncome]: edgar.Filing.NetIncome, ConsolidatedFilingItemKeys[OperatingCashFlow]: edgar.Filing.OperatingCashFlow, ConsolidatedFilingItemKeys[CapEx]: edgar.Filing.CapitalExpenditure, ConsolidatedFilingItemKeys[DividendPaid]: edgar.Filing.Dividend, }
var FilingStatusLabels = [5]string{"", "S", "MFJ", "MFS", "HH"}
var FlipAutomaticTaxEntries = [9]bool{false, false, false, false, false, true, false, true, true}
for ItemizedDeduction, Credits, Payments: entry.Amount will be set from Debit CashFlows, but we expected TaxEntry to have Positive Amount
var Months = [14]string{"",
"Jan ",
"Feb ",
"Mar ",
"Apr ",
"May ",
"Jun ",
"Jul ",
"Aug ",
"Sep ",
"Oct ",
"Nov ",
"Dec "}
var SecurityBasisName = [3]string{"", "FIFO", "Average"}
var SecurityTypeHasFilings = [21]bool{false, true}
var TaxTypeNames = [9]string{"", "Income", "Income Capital Gain",
"Deductions for AGI", "Deductions from AGI",
"Itemized Deductions", "Tax", "Tax Credits",
"Tax Payments"}
var TradeTypeCashFlowsQuery string = "trade_type_id <= 6"
var TradeTypeQueries = [9]string{"",
"trade_type_id = 1 OR trade_type_id = 5 OR trade_type_id = 6",
"trade_type_id = 2",
"trade_type_id = 3 OR trade_type_id = 5",
"trade_type_id = 4 OR trade_type_id = 6",
"",
"",
"trade_type_id = 7",
"trade_type_id = 8"}
SQL query string for all Buy, Sell types for Trades
var TradeTypeQueryDesc = [9]string{"",
"",
"Shares Sold",
"Dividend",
"Distribution",
"",
"",
"",
""}
Functions ¶
func CashFlowTypeIsCredit ¶
func CashFlowTypeIsDebit ¶
func SecurityTypeIsValid ¶
func TradeTypeIsBuy ¶
func TradeTypeIsDistribution ¶
func TradeTypeIsDividend ¶
func TradeTypeIsReinvest ¶
func TradeTypeIsSell ¶
func TradeTypeIsSharesIn ¶
func TradeTypeIsSharesOut ¶
func TradeTypeIsSplit ¶
func TradeTypeIsValid ¶
func TradeTypeToCashFlowType ¶
Types ¶
type Account ¶
type Account struct { gorm.Model UserID uint `gorm:"not null"` AccountTypeID uint `form:"account.account_type_id"` CurrencyTypeID uint `form:"account.currency_type_id"` InstitutionID uint `form:"account.institution_id"` AverageBalance decimal.Decimal `gorm:"-:all"` Balance decimal.Decimal CashBalance decimal.Decimal Portfolio SecurityValue `gorm:"-:all"` Routing int `form:"account.Routing"` OfxIndex uint `form:"account.OfxIndex"` ClientUID string `form:"account.ClientUID"` Name string `form:"account.Name"` Number string `form:"account.Number"` HasScheduled bool Hidden bool `form:"account.Hidden"` Taxable bool `form:"account.Taxable"` Verified bool `gorm:"-:all"` Session *Session `gorm:"-:all"` AccountType AccountType CurrencyType CurrencyType Institution Institution User User CashFlows []CashFlow Securities []Security }
func GetAccountByName ¶
func ListAccounts ¶
func (*Account) AddToBalance ¶
func (*Account) ClearBooleans ¶
func (a *Account) ClearBooleans()
for Bind() and setting from input/checkboxes */
func (*Account) Find ¶
Find() for use with rails/ruby like REPL console (gomacro); controllers should not expose this as are no access controls
func (*Account) GetRouting ¶
func (*Account) GetSecurity ¶
This will find a Company that must match both Company.Name and Company.Symbol. If such Company doesn't exist, one is created.
func (*Account) GetSecurityBySymbol ¶
This version will find a Company that matches Company.Symbol regardless of Company.Name. If no such Company, one is created with Company.Name = "".
func (Account) HasAverageDailyBalance ¶
func (*Account) HaveAccessPermission ¶
func (*Account) IsInvestment ¶
func (*Account) ListImports ¶
func (*Account) ListScheduled ¶
func (*Account) ListSecurities ¶
Account access already verified by caller
func (Account) PortfolioTotalReturn ¶
func (*Account) SetAverageDailyBalance ¶
func (*Account) SupportsDownload ¶
func (*Account) TotalPortfolio ¶
type AccountType ¶
func (AccountType) GetAltText ¶
func (a AccountType) GetAltText() string
func (AccountType) GetIconPath ¶
func (a AccountType) GetIconPath() string
func (*AccountType) List ¶
func (*AccountType) List(db *gorm.DB) []AccountType
type CashFlow ¶
type CashFlow struct { gorm.Model CashFlowTypeID uint `form:"cash_flow_type_id" gorm:"-:all"` AccountID uint `gorm:"not null"` TaxYear int `form:"tax_year"` Date time.Time Amount decimal.Decimal `gorm:"not null"` Balance decimal.Decimal `gorm:"-:all"` PayeeID uint `gorm:"not null"` // also serves as Pair.AccountID (Transfers) CategoryID uint `form:"category_id"` // also serves as Pair.ID (Transfers) PairID uint `gorm:"-:all"` ImportID uint RepeatIntervalID uint SplitFrom uint Split bool Transfer bool CategoryName string `gorm:"-:all"` Memo string `form:"memo"` PayeeName string `form:"payee_name" gorm:"-:all"` Transnum string `form:"transnum"` Type string `gorm:"default:NULL"` Account Account Category Category Payee Payee RepeatInterval RepeatInterval // contains filtered or unexported fields }
func NewSplitCashFlow ¶
Used with CreateSplitCashFlow. Controller calls to get common CashFlow fields first, and before Bind (which can/will override other fields).
func (*CashFlow) Find ¶
Find() for use with rails/ruby like REPL console (gomacro); controllers should not expose this as are no access controls
func (CashFlow) GetTransnum ¶
func (*CashFlow) HaveAccessPermission ¶
c.Account must be preloaded
func (*CashFlow) IsScheduled ¶
func (*CashFlow) IsScheduledEnterable ¶
func (*CashFlow) IsScheduledParent ¶
func (CashFlow) IsSellTrade ¶
func (*CashFlow) ListByDate ¶
func (*CashFlow) ListMergeByDate ¶
func (*CashFlow) ListMergeByDate(db *gorm.DB, account *Account, other []CashFlow, date *time.Time) []CashFlow
Account access already verified by caller
func (*CashFlow) PreloadRepeat ¶
func (*CashFlow) RepeatParentID ¶
get ScheduledCashFlow.ID that is assocated with object
func (CashFlow) ShowTradeLinks ¶
func (*CashFlow) SplitCount ¶
type CashFlowType ¶
func (*CashFlowType) List ¶
func (*CashFlowType) List(db *gorm.DB) []CashFlowType
type Category ¶
type Category struct { Model UserID uint CategoryTypeID uint `form:"category.category_type_id"` Name string `form:"category.Name"` OmitFromPie bool CategoryType CategoryType User User }
func CategoryGetByName ¶
func (*Category) IsInterest ¶
func (*Category) IsInterestIncome ¶
func (*Category) IsMortgageInterest ¶
type CategoryType ¶
func (*CategoryType) List ¶
func (*CategoryType) List(db *gorm.DB) []CategoryType
type Company ¶
type Company struct { Model Name string `form:"company.Name"` Symbol string `form:"company.Symbol"` // UserID only used from Security.Update UserID uint `gorm:"-:all"` // contains filtered or unexported fields }
func (*Company) Create ¶
Query if Company already exists and return. If non-existent, create one. But if this is an Update, first try to update the calling object Company first if only attached to one Security. XXX Possibly should disallow multiple Companies for same Symbol. Or in future have defined set of fixed Companies if ever consider to add support for financial statements.
func (*Company) Find ¶
Find() for use with rails/ruby like REPL console (gomacro); controllers should not expose this as are no access controls
func (*Company) FindBySymbol ¶
func (*Company) GetBySymbol ¶
Query if Companies already exists and return them. XXX Possibly should disallow multiple Companies for same Symbol.
func (*Company) GetFiling ¶
Note to caller:
convert floats to string with: strconv.FormatFloat(f.item(), 'f', -1, 64)
func (*Company) GetFilingDate ¶
func (c *Company) GetFilingDate(f FilingData) string
func (*Company) GetFilingItem ¶
func (c *Company) GetFilingItem(f FilingData, item string) float64
func (*Company) GetFilingItemNames ¶
func (*Company) GetFilingItemString ¶
func (c *Company) GetFilingItemString(f FilingData, item string) string
func (*Company) HasFilings ¶
func (Company) NumFilings ¶
type CurrencyType ¶
func (*CurrencyType) List ¶
func (*CurrencyType) List(db *gorm.DB) []CurrencyType
type FilingData ¶
type Import ¶
type Import struct { Model AccountID uint `gorm:"not null"` CashFlowCount uint `gorm:"-:all"` TradeCount uint `gorm:"-:all"` Username string `gorm:"-:all" form:"import.Username"` Password string `gorm:"-:all" form:"import.Password"` CreatedOn time.Time Account Account }
func (*Import) CountImported ¶
func (*Import) HaveAccessPermission ¶
i.Account must be preloaded
func (*Import) ImportFile ¶
func (*Import) ImportFromOFX ¶
func (*Import) ImportFromQFX ¶
func (*Import) ImportFromQIF ¶
func (*Import) ListImported ¶
type Institution ¶
type Institution struct { Model AppVer uint FiId uint AppId string FiOrg string FiUrl string Name string }
func (*Institution) List ¶
func (*Institution) List() []Institution
type Payee ¶
type Payee struct { Model UserID uint `gorm:"not null"` CategoryID uint `form:"payee.category_id"` Name string `form:"payee.Name"` Address string `form:"payee.Address"` SkipOnImport bool `form:"payee.SkipOnImport"` Verified bool `gorm:"-:all"` User User Category Category }
func (Payee) CategoryName ¶
func (*Payee) ClearBooleans ¶
func (p *Payee) ClearBooleans()
for Bind() and setting from input/checkboxes */
func (*Payee) Find ¶
Find() for use with rails/ruby like REPL console (gomacro); controllers should not expose this as are no access controls
func (*Payee) GetDuplicates ¶
func (*Payee) HaveAccessPermission ¶
func (*Payee) ListCashFlows ¶
func (*Payee) SetCategory ¶
func (Payee) UseByAccount ¶
type RepeatInterval ¶
type RepeatInterval struct { Model CashFlowID uint Rate decimal.Decimal RepeatIntervalTypeID uint `form:"repeat_interval_type_id"` RepeatsLeft uint `form:"repeats" gorm:"default:NULL"` RepeatsLeftPtr *uint `gorm:"-:all"` StartDay int RepeatIntervalType RepeatIntervalType }
func (*RepeatInterval) Find ¶
func (*RepeatInterval) Find(ID uint) *RepeatInterval
Find() for use with rails/ruby like REPL console (gomacro); controllers should not expose this as are no access controls
func (RepeatInterval) GetRate ¶
func (r RepeatInterval) GetRate() string
func (RepeatInterval) GetRepeatsLeft ¶
func (r RepeatInterval) GetRepeatsLeft() string
func (RepeatInterval) HasRepeatsLeft ¶
func (r RepeatInterval) HasRepeatsLeft() bool
func (*RepeatInterval) Preload ¶
func (r *RepeatInterval) Preload(db *gorm.DB)
func (*RepeatInterval) Print ¶
func (r *RepeatInterval) Print()
func (*RepeatInterval) SetRepeatsLeft ¶
func (r *RepeatInterval) SetRepeatsLeft(repeats string)
func (*RepeatInterval) Update ¶
func (r *RepeatInterval) Update() error
type RepeatIntervalType ¶
func (*RepeatIntervalType) List ¶
func (*RepeatIntervalType) List(db *gorm.DB) []RepeatIntervalType
type Security ¶
type Security struct { Model CompanyID uint `gorm:"not null"` SecurityBasisTypeID uint `form:"security_basis_type_id"` SecurityTypeID uint `form:"security_type_id"` AccountID uint `gorm:"not null"` ImportName string `form:"security.ImportName"` BasisFromTrades decimal.Decimal `gorm:"-:all"` SecurityValue Account Account Company Company SecurityType SecurityType // contains filtered or unexported fields }
func (Security) BasisPrice ¶
func (*Security) ChangeAccount ¶
func (*Security) ChartsEnabled ¶
func (*Security) Find ¶
Find() for use with rails/ruby like REPL console (gomacro); controllers should not expose this as are no access controls
func (*Security) GetChartData ¶
func (*Security) GetChartDataByte ¶
func (*Security) GetChartOptions ¶
func (*Security) GetChartOptionsByte ¶
func (*Security) HasFilings ¶
func (*Security) HaveAccessPermission ¶
s.Account must be preloaded
func (*Security) LatestTradeBy ¶
Find only most recent Trade for Security
func (*Security) ListTrades ¶
func (*Security) ListTradesBy ¶
Find Trades for Security Security access already verified by caller
func (Security) TotalReturn ¶
func (*Security) UnrealizedGain ¶
func (Security) UnrealizedReturn ¶
type SecurityBasisType ¶
func (*SecurityBasisType) List ¶
func (*SecurityBasisType) List(db *gorm.DB) []SecurityBasisType
type SecurityChart ¶
type SecurityChart struct { Labels []string `json:"labels"` Datasets []*SecurityChartDataSet `json:"datasets"` }
type SecurityChartAxisOptions ¶
type SecurityChartAxisOptions struct {
Ticks SecurityChartTickOptions `json:"ticks"`
}
type SecurityChartDataSet ¶
type SecurityChartOptions ¶
type SecurityChartOptions struct {
Scales SecurityChartScaleOptions `json:"scales"`
}
type SecurityChartScaleOptions ¶
type SecurityChartScaleOptions struct { }
type SecurityChartTickOptions ¶
type SecurityChartTickOptions struct { }
type SecurityQuote ¶
type SecurityQuoteCache ¶
type SecurityQuoteCache struct {
Quotes map[string]SecurityQuote
}
func GetQuoteCache ¶
func GetQuoteCache() *SecurityQuoteCache
func (*SecurityQuoteCache) Get ¶
func (sqc *SecurityQuoteCache) Get(symbol string) SecurityQuote
type SecurityType ¶
func (*SecurityType) List ¶
func (*SecurityType) List(db *gorm.DB) []SecurityType
type SecurityValue ¶
type Session ¶
func (*Session) CloseSession ¶
func (session *Session) CloseSession()
type TaxCategory ¶
type TaxCategory struct { Model TaxItemID uint `form:"tax_category.tax_item_id"` CategoryID uint `form:"tax_category.category_id"` TradeTypeID uint `form:"tax_category.trade_type_id"` TaxItem TaxItem }
func (*TaxCategory) List ¶
func (tc *TaxCategory) List(db *gorm.DB, taxType uint) []TaxCategory
type TaxConstant ¶
type TaxConstant struct { Model TaxTableMax int32 CapgainRate decimal.Decimal TaxL1Rate decimal.Decimal TaxL2Rate decimal.Decimal TaxL3Rate decimal.Decimal TaxL4Rate decimal.Decimal TaxL5Rate decimal.Decimal TaxL6Rate decimal.Decimal TaxL7Rate decimal.Decimal }
func (*TaxConstant) Get ¶
func (c *TaxConstant) Get(db *gorm.DB) *TaxConstant
type TaxEntry ¶
type TaxEntry struct { Model Year time.Time DateYear int `form:"year" gorm:"-:all"` TaxItemID uint `form:"tax_item_id"` TaxRegionID uint `form:"tax_region_id"` TaxTypeID uint `form:"tax_type_id"` TaxCategoryID uint `gorm:"-:all"` UserID uint Amount decimal.Decimal `gorm:"not null"` Memo string `form:"memo"` TaxItem TaxItem TaxRegion TaxRegion TaxType TaxType User User }
db.Table("taxes")
func (*TaxEntry) HaveAccessPermission ¶
type TaxFilingStatus ¶
func (*TaxFilingStatus) List ¶
func (*TaxFilingStatus) List(db *gorm.DB) []TaxFilingStatus
type TaxItem ¶
type TaxItem struct { Model TaxTypeID uint `form:"tax_item.tax_type_id"` //TaxCategoryID uint `form:"tax_item.tax_category_id" Name string `form:"tax_item.Name"` Type string TaxType TaxType }
func (*TaxItem) ListTaxCashFlows ¶
type TaxReturn ¶
type TaxReturn struct { Model FilingStatus uint `form:"tax_filing_status"` TaxRegionID uint `form:"tax_region_id"` UserID uint Year int `form:"year"` Exemptions int32 `form:"exemptions"` Income decimal.Decimal AgiIncome decimal.Decimal TaxableIncome decimal.Decimal ForAGI decimal.Decimal FromAGI decimal.Decimal StandardDeduction decimal.Decimal ItemizedDeduction decimal.Decimal Exemption decimal.Decimal Credits decimal.Decimal Payments decimal.Decimal BaseTax decimal.Decimal OtherTax decimal.Decimal OwedTax decimal.Decimal UnpaidTax decimal.Decimal LongCapgainIncome decimal.Decimal Session *Session `gorm:"-:all"` TaxRegion TaxRegion User User }
db.Table("tax_users")
func (TaxReturn) FilingStatusLabel ¶
cannot get GORM to read this table using Preload, this is faster to just compute and avoid DB lookup
func (*TaxReturn) HaveAccessPermission ¶
func (*TaxReturn) Recalculate ¶
type TaxType ¶
func (*TaxType) ListTaxCashFlows ¶
type TaxYear ¶
type TaxYear struct { Model Year int ExemptionAmount int32 SaltMaximum int32 StandardDeductionS int32 StandardDeductionMFJ int32 StandardDeductionMFS int32 StandardDeductionHH int32 TaxIncomeL1S int32 TaxIncomeL1MFJ int32 TaxIncomeL1MFS int32 TaxIncomeL1HH int32 TaxIncomeL2S int32 TaxIncomeL2MFJ int32 TaxIncomeL2MFS int32 TaxIncomeL2HH int32 TaxIncomeL3S int32 TaxIncomeL3MFJ int32 TaxIncomeL3MFS int32 TaxIncomeL3HH int32 TaxIncomeL4S int32 TaxIncomeL4MFJ int32 TaxIncomeL4MFS int32 TaxIncomeL4HH int32 TaxIncomeL5S int32 TaxIncomeL5MFJ int32 TaxIncomeL5MFS int32 TaxIncomeL5HH int32 TaxIncomeL6S int32 TaxIncomeL6MFJ int32 TaxIncomeL6MFS int32 TaxIncomeL6HH int32 TaxL1Rate decimal.Decimal TaxL2Rate decimal.Decimal TaxL3Rate decimal.Decimal TaxL4Rate decimal.Decimal TaxL5Rate decimal.Decimal TaxL6Rate decimal.Decimal TaxL7Rate decimal.Decimal }
type Trade ¶
type Trade struct { gorm.Model TradeTypeID uint `form:"trade_type_id"` AccountID uint `gorm:"not null"` SecurityID uint `gorm:"not null"` ImportID uint Symbol string `form:"Symbol" gorm:"-:all"` Date time.Time TaxYear int `form:"tax_year"` Amount decimal.Decimal `gorm:"not null"` Price decimal.Decimal AdjustedShares decimal.Decimal // Basis is accumulated (used) basis from Sells (starts at 0) // for Buys: remaining Basis is: Amount - Basis // (for AVGB, we still increment Buy specific (FIFO basis) in // the buy.Basis; for actual used (average) basis, this is in // the associated TradeGain.) // for Sells: the Gain (Loss) then is: Amount - Basis Basis decimal.Decimal BasisPS decimal.Decimal `gorm:"-:all"` Gain decimal.Decimal `gorm:"-:all"` GainPS decimal.Decimal `gorm:"-:all"` Closed bool TradeType TradeType Account Account Security Security TradeGains []TradeGain `gorm:"foreignKey:SellID"` // contains filtered or unexported fields }
func (*Trade) Find ¶
Find() for use with rails/ruby like REPL console (gomacro); controllers should not expose this as are no access controls
func (*Trade) HaveAccessPermission ¶
t.Account must be preloaded
func (*Trade) IsAverageCost ¶
func (*Trade) IsReinvest ¶
func (*Trade) IsSharesIn ¶
func (*Trade) IsSharesOut ¶
func (*Trade) List ¶
Account Trades, Account access already verified by caller For Security Trades, use security.ListTrades
func (*Trade) ListByType ¶
func (t *Trade) ListByType(session *Session, tradeType uint, daysHeld uint) ([]Trade, [2]decimal.Decimal)
Filtered Account or User Trades for just single Year (t.Date.Year)
func (*Trade) ListByTypeTotal ¶
func (*Trade) ListCashFlowByType ¶
Usage is interested in Trade Gains (Taxable), so here in returned CashFlows, we switch cf.Amount with the trade.Gain.
func (*Trade) ListCashFlows ¶
func (*Trade) ListImportedCashFlows ¶
func (*Trade) SharesRemaining ¶
func (*Trade) UpdateAdjustedShares ¶
func (Trade) ViewIsSell ¶
func (*Trade) WasReinvest ¶
type TradeGain ¶
type TradeGain struct { Model SellID uint BuyID uint DaysHeld int32 Basis decimal.Decimal BasisFIFO decimal.Decimal BasisPS decimal.Decimal `gorm:"-:all"` Amount decimal.Decimal `gorm:"-:all"` Gain decimal.Decimal `gorm:"-:all"` GainPS decimal.Decimal `gorm:"-:all"` BuyDate time.Time `gorm:"-:all"` }
func (*TradeGain) Find ¶
Find() for use with rails/ruby like REPL console (gomacro); controllers should not expose this as are no access controls
func (*TradeGain) FindForSale ¶
type User ¶
type User struct { gorm.Model Login string `form:"user.Login"` Email string `form:"user.Email"` PasswordDigest string CashflowLimit int Session *Session `gorm:"-:all"` UserSettings UserSettings Accounts []Account Payees []Payee }