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
|
||||
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.StringVar(&config.BPI, "bpi", "", "path to bpi")
|
||||
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")
|
||||
if err := fs.Parse(os.Args[1:]); err != nil {
|
||||
panic(err)
|
||||
|
|
@ -136,15 +137,15 @@ func Main() {
|
|||
}
|
||||
|
||||
switch cmd[:3] {
|
||||
case "bal":
|
||||
balances := deltas.Balances().
|
||||
case "bal": // balances
|
||||
balances := deltas.Group(ledger.GroupDate(config.GroupDate)).Balances().
|
||||
WithBPIs(bpis).
|
||||
KindaLike(q).
|
||||
KindaGroup(group).
|
||||
Nonzero().
|
||||
Normalize(cpiNormalizer, "9")
|
||||
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}"
|
||||
if period := config.Query.Period; !period.Empty() {
|
||||
day := time.Hour * 24
|
||||
|
|
@ -225,7 +226,8 @@ func Main() {
|
|||
options = append(options, asciigraph.SeriesColors(seriesColors...))
|
||||
}
|
||||
fmt.Println(asciigraph.PlotMany(points, options...))
|
||||
case "rec":
|
||||
case "rec": // reconcile via teller // DEAD
|
||||
panic("dead and bad")
|
||||
byDate := map[string]ledger.Deltas{}
|
||||
for _, delta := range deltas {
|
||||
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)
|
||||
}
|
||||
}
|
||||
case "reg":
|
||||
case "reg": // reg
|
||||
deltas = deltas.Group(ledger.GroupDate(config.GroupDate))
|
||||
transactions := deltas.Transactions()
|
||||
cumulative := make(ledger.Balances)
|
||||
for _, transaction := range transactions {
|
||||
|
|
|
|||
Loading…
Reference in New Issue