MCPcopy
hub / github.com/ananthakumaran/paisa / GetCurrentNetworth

Function GetCurrentNetworth

internal/server/networth.go:34–40  ·  view source on GitHub ↗
(db *gorm.DB)

Source from the content-addressed store, hash-verified

32}
33
34func GetCurrentNetworth(db *gorm.DB) gin.H {
35 postings := query.Init(db).Like("Assets:%", "Income:CapitalGains:%", "Liabilities:%").UntilToday().All()
36 postings = service.PopulateMarketPrice(db, postings)
37 networth := computeNetworth(db, postings)
38 xirr := service.XIRR(db, postings)
39 return gin.H{"networth": networth, "xirr": xirr}
40}
41
42func computeNetworth(db *gorm.DB, postings []posting.Posting) Networth {
43 var networth Networth

Callers 1

GetDashboardFunction · 0.85

Calls 7

InitFunction · 0.92
PopulateMarketPriceFunction · 0.92
XIRRFunction · 0.92
computeNetworthFunction · 0.85
AllMethod · 0.80
UntilTodayMethod · 0.80
LikeMethod · 0.80

Tested by

no test coverage detected