group date
cicd / ci (push) Successful in 1m51s
Details
cicd / ci (push) Successful in 1m51s
Details
parent
774de58bf7
commit
7a790fa31e
|
|
@ -15,5 +15,6 @@ type Config struct {
|
||||||
Normalize bool
|
Normalize bool
|
||||||
USDOnly bool
|
USDOnly bool
|
||||||
}
|
}
|
||||||
Compact bool
|
Compact bool
|
||||||
|
GroupDate string
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ func Main() {
|
||||||
fs.BoolVar(&config.Query.NoExchanging, "no-exchanging", true, "omit currency exchanges")
|
fs.BoolVar(&config.Query.NoExchanging, "no-exchanging", true, "omit currency exchanges")
|
||||||
fs.StringVar(&config.BPI, "bpi", "", "path to bpi")
|
fs.StringVar(&config.BPI, "bpi", "", "path to bpi")
|
||||||
fs.StringVar(&config.CPI, "cpi", "", "path to cpi")
|
fs.StringVar(&config.CPI, "cpi", "", "path to cpi")
|
||||||
|
fs.StringVar(&config.GroupDate, "group-date", "^....-..-..", "date grouping")
|
||||||
fs.IntVar(&config.CPIYear, "cpiy", 0, "use cpi to convert usd to this year's value")
|
fs.IntVar(&config.CPIYear, "cpiy", 0, "use cpi to convert usd to this year's value")
|
||||||
if err := fs.Parse(os.Args[1:]); err != nil {
|
if err := fs.Parse(os.Args[1:]); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|
@ -136,15 +137,15 @@ func Main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch cmd[:3] {
|
switch cmd[:3] {
|
||||||
case "bal":
|
case "bal": // balances
|
||||||
balances := deltas.Balances().
|
balances := deltas.Group(ledger.GroupDate(config.GroupDate)).Balances().
|
||||||
WithBPIs(bpis).
|
WithBPIs(bpis).
|
||||||
KindaLike(q).
|
KindaLike(q).
|
||||||
KindaGroup(group).
|
KindaGroup(group).
|
||||||
Nonzero().
|
Nonzero().
|
||||||
Normalize(cpiNormalizer, "9")
|
Normalize(cpiNormalizer, "9")
|
||||||
FPrintBalances(w, "", balances, nil, config.Query.USDOnly, config.Query.Normalize, time.Now().Format("2006-01-02"), false, maxAccW)
|
FPrintBalances(w, "", balances, nil, config.Query.USDOnly, config.Query.Normalize, time.Now().Format("2006-01-02"), false, maxAccW)
|
||||||
case "gra":
|
case "gra": // graph
|
||||||
dateGrouping := "^[0-9]{4}-[0-9]{2}"
|
dateGrouping := "^[0-9]{4}-[0-9]{2}"
|
||||||
if period := config.Query.Period; !period.Empty() {
|
if period := config.Query.Period; !period.Empty() {
|
||||||
day := time.Hour * 24
|
day := time.Hour * 24
|
||||||
|
|
@ -225,7 +226,8 @@ func Main() {
|
||||||
options = append(options, asciigraph.SeriesColors(seriesColors...))
|
options = append(options, asciigraph.SeriesColors(seriesColors...))
|
||||||
}
|
}
|
||||||
fmt.Println(asciigraph.PlotMany(points, options...))
|
fmt.Println(asciigraph.PlotMany(points, options...))
|
||||||
case "rec":
|
case "rec": // reconcile via teller // DEAD
|
||||||
|
panic("dead and bad")
|
||||||
byDate := map[string]ledger.Deltas{}
|
byDate := map[string]ledger.Deltas{}
|
||||||
for _, delta := range deltas {
|
for _, delta := range deltas {
|
||||||
delta := delta
|
delta := delta
|
||||||
|
|
@ -285,7 +287,8 @@ func Main() {
|
||||||
fmt.Printf("[%s] %s $%7.2f %s%s (%s)\n", msg, transaction.Date, transaction.Amount, prefix, transaction.Details.CounterParty.Name, transaction.Description)
|
fmt.Printf("[%s] %s $%7.2f %s%s (%s)\n", msg, transaction.Date, transaction.Amount, prefix, transaction.Details.CounterParty.Name, transaction.Description)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "reg":
|
case "reg": // reg
|
||||||
|
deltas = deltas.Group(ledger.GroupDate(config.GroupDate))
|
||||||
transactions := deltas.Transactions()
|
transactions := deltas.Transactions()
|
||||||
cumulative := make(ledger.Balances)
|
cumulative := make(ledger.Balances)
|
||||||
for _, transaction := range transactions {
|
for _, transaction := range transactions {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue