rename Asset to Assets

This commit is contained in:
Anantha Kumaran 2022-08-19 18:20:00 +05:30
parent 8f730d41bb
commit 1154fd5ead
10 changed files with 34 additions and 34 deletions

View File

@ -48,11 +48,11 @@ allocation_targets:
- name: Debt
target: 40
accounts:
- Asset:Debt:*
- Assets:Debt:*
- name: Equity
target: 60
accounts:
- Asset:Equity:*
- Assets:Equity:*
commodities:
- name: NIFTY
type: mutualfund
@ -102,7 +102,7 @@ func emitSalary(file *os.File, start time.Time) {
_, err := file.WriteString(fmt.Sprintf(`
%s Salary
Income:Salary:%s
Asset:Debt:EPF %s INR
Assets:Debt:EPF %s INR
Tax %s INR
Checking %s INR
`, start.Format("2006/01/02"), company, formatFloat(salary*0.12), formatFloat(salary*0.20), formatFloat(salary*0.68)))
@ -114,7 +114,7 @@ func emitSalary(file *os.File, start time.Time) {
_, err = file.WriteString(fmt.Sprintf(`
%s EPF Interest
Income:Interest:EPF
Asset:Debt:EPF %s INR
Assets:Debt:EPF %s INR
`, start.Format("2006/01/02"), formatFloat(salary*0.12*((float64(start.Year())-START_YEAR)*12)*0.075)))
if err != nil {
@ -133,7 +133,7 @@ func emitEquityMutualFund(file *os.File, start time.Time, pricesTree map[string]
pc := utils.BTreeDescendFirstLessOrEqual(pricesTree["NIFTY"], price.Price{Date: start})
_, err := file.WriteString(fmt.Sprintf(`
%s Mutual Fund Nifty
Asset:Equity:NIFTY %s NIFTY @ %s INR
Assets:Equity:NIFTY %s NIFTY @ %s INR
Checking
`, start.Format("2006/01/02"), formatFloat(10000/pc.Value*multiplier), formatFloat(pc.Value)))
if err != nil {
@ -143,7 +143,7 @@ func emitEquityMutualFund(file *os.File, start time.Time, pricesTree map[string]
pc = utils.BTreeDescendFirstLessOrEqual(pricesTree["NIFTY_JR"], price.Price{Date: start})
_, err = file.WriteString(fmt.Sprintf(`
%s Mutual Fund Nifty Next 50
Asset:Equity:NIFTY_JR %s NIFTY_JR @ %s INR
Assets:Equity:NIFTY_JR %s NIFTY_JR @ %s INR
Checking
`, start.Format("2006/01/02"), formatFloat(10000/pc.Value*multiplier), formatFloat(pc.Value)))
if err != nil {
@ -160,7 +160,7 @@ func emitDebtMutualFund(file *os.File, start time.Time, pricesTree map[string]*b
pc := utils.BTreeDescendFirstLessOrEqual(pricesTree["ABCBF"], price.Price{Date: start})
_, err := file.WriteString(fmt.Sprintf(`
%s Mutual Fund Birla Corporate Fund
Asset:Debt:ABCBF %s ABCBF @ %s INR
Assets:Debt:ABCBF %s ABCBF @ %s INR
Checking
`, start.Format("2006/01/02"), formatFloat(10000/pc.Value*multiplier), formatFloat(pc.Value)))
if err != nil {

View File

@ -4,11 +4,11 @@ Even though **ledger** doesn't have any Account naming convention,
**paisa** makes lot of assumptions and expects you to follow the same
naming convention.
### Asset
### Assets
All your assets should go under `Asset:`. The level of granularity is
All your assets should go under `Assets:`. The level of granularity is
up to you. The recommended convention is to use
`Asset:{instrument_type}:{instrument_name}`. The instrument type may
`Assets:{instrument_type}:{instrument_name}`. The instrument type may
be `Cash`, `Equity`, `Debt`, etc. The instrument name may be the name of
the fund, stock, etc

View File

@ -11,9 +11,9 @@ allocation_targets:
- name: Debt
target: 40
accounts:
- Asset:Debt:*
- Assets:Debt:*
- name: Equity
target: 60
accounts:
- Asset:Equity:*
- Assets:Equity:*
```

View File

@ -6,17 +6,17 @@ tracked as a commodity. Few example transactions can be found below.
```go
2019/02/18 NPS
Asset:Equity:NPS:SBI:E 15.9378 NPS_SBI_E @ 23.5289 INR
Assets:Equity:NPS:SBI:E 15.9378 NPS_SBI_E @ 23.5289 INR
;// account name units commodity purchase price
;// name per unit
Checking
2019/02/21 NPS
Asset:Equity:NPS:SBI:E 1557.2175 NPS_SBI_E @ 23.8406 INR
Assets:Equity:NPS:SBI:E 1557.2175 NPS_SBI_E @ 23.8406 INR
Checking
2020/06/25 Gold
Asset:Gold 40 GOLD @ 4650 INR
Assets:Gold 40 GOLD @ 4650 INR
Checking
```

View File

@ -57,23 +57,23 @@ we could represent it as follows
2022/01/01 Salary
Income:Salary:Acme -100,000 INR
Checking 88,000 INR
Asset:Debt:EPF 12,000 INR
Assets:Debt:EPF 12,000 INR
2022/02/01 Salary
Income:Salary:Acme -100,000 INR
Checking 88,000 INR
Asset:Debt:EPF 12,000 INR
Assets:Debt:EPF 12,000 INR
2022/03/01 Salary
Income:Salary:Acme -100,000 INR
Checking 88,000 INR
Asset:Debt:EPF 12,000 INR
Assets:Debt:EPF 12,000 INR
```
```shell
ledger -f personal.ledger balance Asset Checking
36,000 INR Asset:Debt:EPF
ledger -f personal.ledger balance Assets Checking
36,000 INR Assets:Debt:EPF
264,000 INR Checking
--------------------
300,000 INR
@ -89,18 +89,18 @@ month.
```go
2018/01/01 Investment
Checking -20,000 INR
Asset:Equity:NIFTY 148.0865 NIFTY @ 67.5281 INR
Asset:Equity:NIFTY_JR 358.6659 NIFTY_JR @ 27.8811 INR
Assets:Equity:NIFTY 148.0865 NIFTY @ 67.5281 INR
Assets:Equity:NIFTY_JR 358.6659 NIFTY_JR @ 27.8811 INR
2018/02/01 Investment
Checking -20,000 INR
Asset:Equity:NIFTY 140.2870 NIFTY @ 71.2824 INR
Asset:Equity:NIFTY_JR 363.2242 NIFTY_JR @ 27.5312 INR
Assets:Equity:NIFTY 140.2870 NIFTY @ 71.2824 INR
Assets:Equity:NIFTY_JR 363.2242 NIFTY_JR @ 27.5312 INR
2018/03/01 Investment
Checking -20,000 INR
Asset:Equity:NIFTY 147.5908 NIFTY @ 67.7549 INR
Asset:Equity:NIFTY_JR 378.4323 NIFTY_JR @ 26.4248 INR
Assets:Equity:NIFTY 147.5908 NIFTY @ 67.7549 INR
Assets:Equity:NIFTY_JR 378.4323 NIFTY_JR @ 26.4248 INR
```
Let's consider `148.0865 NIFTY @ 67.5281 INR`. Here NIFTY is the name
@ -108,8 +108,8 @@ of the commodity and we have bought 148.0865 units at 67.5281 INR per
unit.
```
ledger -f personal.ledger balance Asset --market
94,615 INR Asset
ledger -f personal.ledger balance Assets --market
94,615 INR Assets
36,000 INR Debt:EPF
58,615 INR Equity
29,539 INR NIFTY
@ -126,7 +126,7 @@ regular intervals. We can treat it as just another transaction.
```go
2022/03/31 EPF Interest
Income:Interest:EPF -15,000 INR
Asset:Debt:EPF 15,000 INR
Assets:Debt:EPF 15,000 INR
```
## Config

View File

@ -37,7 +37,7 @@ type AllocationTarget struct {
func GetAllocation(db *gorm.DB) gin.H {
var postings []posting.Posting
result := db.Where("account like ?", "Asset:%").Order("date ASC").Find(&postings)
result := db.Where("account like ?", "Assets:%").Order("date ASC").Find(&postings)
if result.Error != nil {
log.Fatal(result.Error)
}

View File

@ -18,7 +18,7 @@ type Gain struct {
func GetGain(db *gorm.DB) gin.H {
var postings []posting.Posting
result := db.Where("account like ?", "Asset:%").Order("date ASC").Find(&postings)
result := db.Where("account like ?", "Assets:%").Order("date ASC").Find(&postings)
if result.Error != nil {
log.Fatal(result.Error)
}

View File

@ -28,7 +28,7 @@ func GetInvestment(db *gorm.DB) gin.H {
var postings []posting.Posting
var incomes []posting.Posting
var taxes []posting.Posting
result := db.Where("account like ? order by date asc", "Asset:%").Find(&postings)
result := db.Where("account like ? order by date asc", "Assets:%").Find(&postings)
if result.Error != nil {
log.Fatal(result.Error)
}

View File

@ -30,7 +30,7 @@ func GetLedger(db *gorm.DB) gin.H {
}
postings = service.PopulateMarketPrice(db, postings)
breakdowns := computeBreakdown(db, lo.Filter(postings, func(p posting.Posting, _ int) bool { return strings.HasPrefix(p.Account, "Asset:") }))
breakdowns := computeBreakdown(db, lo.Filter(postings, func(p posting.Posting, _ int) bool { return strings.HasPrefix(p.Account, "Assets:") }))
return gin.H{"postings": postings, "breakdowns": breakdowns}
}

View File

@ -21,7 +21,7 @@ type Overview struct {
func GetOverview(db *gorm.DB) gin.H {
var postings []posting.Posting
result := db.Where("account like ?", "Asset:%").Order("date ASC").Find(&postings)
result := db.Where("account like ?", "Assets:%").Order("date ASC").Find(&postings)
if result.Error != nil {
log.Fatal(result.Error)
}