server

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2023 License: AGPL-3.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const DATE_FORMAT string = "02 Jan 2006"

Variables

Functions

func Build added in v0.4.9

func Build(db *gorm.DB, enableCompression bool) *gin.Engine

func ClearPriceProviderCache added in v0.5.1

func ClearPriceProviderCache(db *gorm.DB, code string) gin.H

func DeleteBackups added in v0.3.2

func DeleteBackups(file LedgerFile) gin.H

func GetAccountGain added in v0.4.0

func GetAccountGain(db *gorm.DB, account string) gin.H

func GetAllocation

func GetAllocation(db *gorm.DB) gin.H

func GetBudget added in v0.4.8

func GetBudget(db *gorm.DB) gin.H

func GetCapitalGains added in v0.2.6

func GetCapitalGains(db *gorm.DB) gin.H

func GetCashFlow added in v0.4.2

func GetCashFlow(db *gorm.DB) gin.H

func GetCurrentBudget added in v0.4.8

func GetCurrentBudget(db *gorm.DB) gin.H

func GetCurrentExpense added in v0.4.5

func GetCurrentExpense(db *gorm.DB) map[string][]posting.Posting

func GetCurrentNetworth added in v0.4.5

func GetCurrentNetworth(db *gorm.DB) gin.H

func GetDashboard added in v0.4.5

func GetDashboard(db *gorm.DB) gin.H

func GetDiagnosis added in v0.2.3

func GetDiagnosis(db *gorm.DB) gin.H

func GetExpense added in v0.2.0

func GetExpense(db *gorm.DB) gin.H

func GetFile added in v0.3.2

func GetFile(file LedgerFile) gin.H

func GetFiles added in v0.3.1

func GetFiles(db *gorm.DB) gin.H

func GetGain

func GetGain(db *gorm.DB) gin.H

func GetHarvest added in v0.2.2

func GetHarvest(db *gorm.DB) gin.H

func GetIncome added in v0.1.3

func GetIncome(db *gorm.DB) gin.H

func GetInvestment

func GetInvestment(db *gorm.DB) gin.H

func GetLatestTransactions added in v0.4.5

func GetLatestTransactions(db *gorm.DB) []transaction.Transaction

func GetLedger

func GetLedger(db *gorm.DB) gin.H

func GetLogs added in v0.5.1

func GetLogs() gin.H

func GetNetworth added in v0.4.5

func GetNetworth(db *gorm.DB) gin.H

func GetPortfolioAllocation added in v0.3.0

func GetPortfolioAllocation(db *gorm.DB) gin.H

func GetPriceAutoCompletions added in v0.5.1

func GetPriceAutoCompletions(db *gorm.DB, request AutoCompleteRequest) gin.H

func GetPriceProviders added in v0.5.1

func GetPriceProviders(db *gorm.DB) gin.H

func GetPrices added in v0.2.2

func GetPrices(db *gorm.DB) gin.H

func GetRecurringTransactions added in v0.4.3

func GetRecurringTransactions(db *gorm.DB) gin.H

func GetScheduleAL added in v0.2.5

func GetScheduleAL(db *gorm.DB) gin.H

func GetTransactions added in v0.2.9

func GetTransactions(db *gorm.DB) gin.H

func Listen

func Listen(db *gorm.DB, port int)

func Logger added in v0.5.1

func Logger(logger logrus.FieldLogger) gin.HandlerFunc

func SaveFile added in v0.3.1

func SaveFile(db *gorm.DB, file LedgerFile) gin.H

func Sync added in v0.2.8

func Sync(db *gorm.DB, request SyncRequest) gin.H

func ValidateFile added in v0.3.1

func ValidateFile(file LedgerFile) gin.H

Types

type AccountBudget added in v0.4.8

type AccountBudget struct {
	Account   string            `json:"account"`
	Forecast  decimal.Decimal   `json:"forecast"`
	Actual    decimal.Decimal   `json:"actual"`
	Rollover  decimal.Decimal   `json:"rollover"`
	Available decimal.Decimal   `json:"available"`
	Date      time.Time         `json:"date"`
	Expenses  []posting.Posting `json:"expenses"`
}

type AccountGain added in v0.4.0

type AccountGain struct {
	Account          string            `json:"account"`
	NetworthTimeline []Networth        `json:"networthTimeline"`
	XIRR             decimal.Decimal   `json:"xirr"`
	Postings         []posting.Posting `json:"postings"`
}

type Aggregate

type Aggregate struct {
	Date         time.Time       `json:"date"`
	Account      string          `json:"account"`
	Amount       decimal.Decimal `json:"amount"`
	MarketAmount decimal.Decimal `json:"market_amount"`
}

type AllocationTarget added in v0.1.3

type AllocationTarget struct {
	Name       string               `json:"name"`
	Target     decimal.Decimal      `json:"target"`
	Current    decimal.Decimal      `json:"current"`
	Aggregates map[string]Aggregate `json:"aggregates"`
}

type AllocationTargetConfig added in v0.1.3

type AllocationTargetConfig struct {
	Name     string
	Target   decimal.Decimal
	Accounts []string
}

type AutoCompleteRequest added in v0.5.1

type AutoCompleteRequest struct {
	Provider string            `json:"provider"`
	Field    string            `json:"field"`
	Filters  map[string]string `json:"filters"`
}

type Budget added in v0.4.8

type Budget struct {
	Date               time.Time       `json:"date"`
	Accounts           []AccountBudget `json:"accounts"`
	AvailableThisMonth decimal.Decimal `json:"availableThisMonth"`
	EndOfMonthBalance  decimal.Decimal `json:"endOfMonthBalance"`
	Forecast           decimal.Decimal `json:"forecast"`
}

type CapitalGain added in v0.2.2

type CapitalGain struct {
	Account     string                   `json:"account"`
	TaxCategory string                   `json:"tax_category"`
	FY          map[string]FYCapitalGain `json:"fy"`
}

type CashFlow added in v0.4.2

type CashFlow struct {
	Date        time.Time       `json:"date"`
	Income      decimal.Decimal `json:"income"`
	Expenses    decimal.Decimal `json:"expenses"`
	Liabilities decimal.Decimal `json:"liabilities"`
	Investment  decimal.Decimal `json:"investment"`
	Tax         decimal.Decimal `json:"tax"`
	Checking    decimal.Decimal `json:"checking"`
	Balance     decimal.Decimal `json:"balance"`
}

func GetCurrentCashFlow added in v0.4.5

func GetCurrentCashFlow(db *gorm.DB) []CashFlow

func (CashFlow) GroupDate added in v0.4.5

func (c CashFlow) GroupDate() time.Time

type CommodityBreakdown added in v0.3.0

type CommodityBreakdown struct {
	ParentCommodityID string          `json:"parent_commodity_id"`
	CommodityName     string          `json:"commodity_name"`
	SecurityName      string          `json:"security_name"`
	SecurityRating    string          `json:"security_rating"`
	SecurityIndustry  string          `json:"security_industry"`
	Percentage        decimal.Decimal `json:"percentage"`
	SecurityID        string          `json:"security_id"`
	SecurityType      string          `json:"security_type"`
	Amount            decimal.Decimal `json:"amount"`
}

type FYCapitalGain added in v0.2.2

type FYCapitalGain struct {
	Units         decimal.Decimal `json:"units"`
	PurchasePrice decimal.Decimal `json:"purchase_price"`
	SellPrice     decimal.Decimal `json:"sell_price"`
	Tax           taxation.Tax    `json:"tax"`
	PostingPairs  []PostingPair   `json:"posting_pairs"`
}

type Gain

type Gain struct {
	Account  string            `json:"account"`
	Networth Networth          `json:"networth"`
	XIRR     decimal.Decimal   `json:"xirr"`
	Postings []posting.Posting `json:"postings"`
}

type Graph added in v0.3.2

type Graph struct {
	Nodes []Node `json:"nodes"`
	Links []Link `json:"links"`
}

type HarvestBreakdown added in v0.2.2

type HarvestBreakdown struct {
	Units             decimal.Decimal `json:"units"`
	PurchaseDate      time.Time       `json:"purchase_date"`
	PurchasePrice     decimal.Decimal `json:"purchase_price"`
	CurrentPrice      decimal.Decimal `json:"current_price"`
	PurchaseUnitPrice decimal.Decimal `json:"purchase_unit_price"`
	Tax               taxation.Tax    `json:"tax"`
}

type Harvestable added in v0.2.2

type Harvestable struct {
	Account               string             `json:"account"`
	TaxCategory           string             `json:"tax_category"`
	TotalUnits            decimal.Decimal    `json:"total_units"`
	HarvestableUnits      decimal.Decimal    `json:"harvestable_units"`
	UnrealizedGain        decimal.Decimal    `json:"unrealized_gain"`
	TaxableUnrealizedGain decimal.Decimal    `json:"taxable_unrealized_gain"`
	HarvestBreakdown      []HarvestBreakdown `json:"harvest_breakdown"`
	CurrentUnitPrice      decimal.Decimal    `json:"current_unit_price"`
	CurrentUnitDate       time.Time          `json:"current_unit_date"`
}

type Income added in v0.1.3

type Income struct {
	Date     time.Time         `json:"date"`
	Postings []posting.Posting `json:"postings"`
}

type IncomeYearlyCard added in v0.3.4

type IncomeYearlyCard struct {
	StartDate   time.Time         `json:"start_date"`
	EndDate     time.Time         `json:"end_date"`
	Postings    []posting.Posting `json:"postings"`
	GrossIncome decimal.Decimal   `json:"gross_income"`
	NetTax      decimal.Decimal   `json:"net_tax"`
	NetIncome   decimal.Decimal   `json:"net_income"`
}

type InvestmentYearlyCard added in v0.3.4

type InvestmentYearlyCard struct {
	StartDate         time.Time         `json:"start_date"`
	EndDate           time.Time         `json:"end_date"`
	Postings          []posting.Posting `json:"postings"`
	GrossSalaryIncome decimal.Decimal   `json:"gross_salary_income"`
	GrossOtherIncome  decimal.Decimal   `json:"gross_other_income"`
	NetTax            decimal.Decimal   `json:"net_tax"`
	NetIncome         decimal.Decimal   `json:"net_income"`
	NetInvestment     decimal.Decimal   `json:"net_investment"`
	NetExpense        decimal.Decimal   `json:"net_expense"`
	SavingsRate       decimal.Decimal   `json:"savings_rate"`
}

type Issue added in v0.2.3

type Issue struct {
	Level       Level  `json:"level"`
	Summary     string `json:"summary"`
	Description string `json:"description"`
	Details     string `json:"details"`
}

type LedgerFile added in v0.3.1

type LedgerFile struct {
	Name      string   `json:"name"`
	Content   string   `json:"content"`
	Versions  []string `json:"versions"`
	Operation string   `json:"operation"`
}

type Level added in v0.2.3

type Level string
const (
	WARN  Level = "warning"
	ERROR Level = "danger"
)
type Link struct {
	Source uint            `json:"source"`
	Target uint            `json:"target"`
	Value  decimal.Decimal `json:"value"`
}

type Networth added in v0.4.5

type Networth struct {
	Date                time.Time       `json:"date"`
	InvestmentAmount    decimal.Decimal `json:"investmentAmount"`
	WithdrawalAmount    decimal.Decimal `json:"withdrawalAmount"`
	GainAmount          decimal.Decimal `json:"gainAmount"`
	BalanceAmount       decimal.Decimal `json:"balanceAmount"`
	NetInvestmentAmount decimal.Decimal `json:"netInvestmentAmount"`
}

type Node added in v0.3.2

type Node struct {
	ID   uint   `json:"id"`
	Name string `json:"name"`
}

type Pair added in v0.3.2

type Pair struct {
	Source uint `json:"source"`
	Target uint `json:"target"`
}

type PortfolioAggregate added in v0.3.0

type PortfolioAggregate struct {
	Group      string               `json:"group"`
	SubGroup   string               `json:"sub_group"`
	ID         string               `json:"id"`
	Percentage decimal.Decimal      `json:"percentage"`
	Amount     decimal.Decimal      `json:"amount"`
	Breakdowns []CommodityBreakdown `json:"breakdowns"`
}

type PortfolioAllocationGroups added in v0.4.0

type PortfolioAllocationGroups struct {
	Commomdities        []string             `json:"commodities"`
	NameAndSecurityType []PortfolioAggregate `json:"name_and_security_type"`
	SecurityType        []PortfolioAggregate `json:"security_type"`
	Rating              []PortfolioAggregate `json:"rating"`
	Industry            []PortfolioAggregate `json:"industry"`
}

func GetAccountPortfolioAllocation added in v0.4.0

func GetAccountPortfolioAllocation(db *gorm.DB, account string) PortfolioAllocationGroups

type PortfolioDimension added in v0.3.0

type PortfolioDimension struct {
	Group      string
	GroupFn    func(CommodityBreakdown) string
	SubGroup   string
	SubGroupFn func(CommodityBreakdown) string
	FilterFn   func(CommodityBreakdown, int) bool
}

type PostingPair added in v0.2.6

type PostingPair struct {
	Purchase posting.Posting `json:"purchase"`
	Sell     posting.Posting `json:"sell"`
	Tax      taxation.Tax    `json:"tax"`
}

type Rule added in v0.2.3

type Rule struct {
	Issue     Issue
	Predicate func(db *gorm.DB) []error
}

type ScheduleAL added in v0.3.4

type ScheduleAL struct {
	Entries []ScheduleALEntry `json:"entries"`
	Date    time.Time         `json:"date"`
}

type ScheduleALEntry added in v0.2.5

type ScheduleALEntry struct {
	Section ScheduleALSection `json:"section"`
	Amount  decimal.Decimal   `json:"amount"`
}

type ScheduleALSection added in v0.2.5

type ScheduleALSection struct {
	Code    string `json:"code"`
	Section string `json:"section"`
	Details string `json:"details"`
}

type SyncRequest added in v0.3.0

type SyncRequest struct {
	Journal    bool `json:"journal"`
	Prices     bool `json:"prices"`
	Portfolios bool `json:"portfolios"`
}

type Tax added in v0.1.3

type Tax struct {
	StartDate time.Time         `json:"start_date"`
	EndDate   time.Time         `json:"end_date"`
	Postings  []posting.Posting `json:"postings"`
}

type TransactionSequence added in v0.4.3

type TransactionSequence struct {
	Transactions             []transaction.Transaction `json:"transactions"`
	Key                      TransactionSequenceKey    `json:"key"`
	Interval                 int                       `json:"interval"`
	DaysSinceLastTransaction int                       `json:"days_since_last_transaction"`
}

func ComputeRecurringTransactions added in v0.4.5

func ComputeRecurringTransactions(postings []posting.Posting) []TransactionSequence

type TransactionSequenceKey added in v0.4.3

type TransactionSequenceKey struct {
	TagRecurring string `json:"tagRecurring"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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