@@ -23,7 +23,7 @@ func Main() {
|
||||
|
||||
fs := flag.NewFlagSet(os.Args[0], flag.ContinueOnError)
|
||||
fs.Var(&config.Files, "f", "paths to files")
|
||||
fs.Var(&config.Query.Period, "period", "period")
|
||||
fs.Var(&config.Query.Period, "period", "period can be YYYY, YYYY-mm, YYYY-mm-dd, x..y")
|
||||
fs.StringVar(&config.Query.Sort, "S", "", "sort ie date")
|
||||
fs.BoolVar(&config.Query.NoRounding, "no-rounding", false, "no rounding")
|
||||
fs.BoolVar(&config.Compact, "c", false, "reg entries oneline")
|
||||
@@ -139,7 +139,22 @@ func Main() {
|
||||
Normalize(cpiNormalizer, "9")
|
||||
FPrintBalances(w, "", balances, nil, config.Query.USDOnly, config.Query.Normalize, time.Now().Format("2006-01-02"), false, maxAccW)
|
||||
case "gra":
|
||||
deltas = deltas.Group(ledger.GroupDate("^[0-9]{4}-[0-9]{2}"))
|
||||
dateGrouping := "^[0-9]{4}-[0-9]{2}"
|
||||
if period := config.Query.Period; !period.Empty() {
|
||||
day := time.Hour * 24
|
||||
year := day * 365
|
||||
r := period.Stop.Sub(period.Start)
|
||||
if r > 10*year {
|
||||
dateGrouping = "^[0-9]{4}"
|
||||
} else if r > 5*year {
|
||||
} else if r > year {
|
||||
dateGrouping = "^[0-9]{4}-[0-9]{2}-[0-9]"
|
||||
} else {
|
||||
dateGrouping = "^[0-9]{4}-[0-9]{2}-[0-9]{2}"
|
||||
}
|
||||
}
|
||||
deltas = deltas.Group(ledger.GroupDate(dateGrouping))
|
||||
|
||||
transactions := deltas.Transactions()
|
||||
cumulative := make(ledger.Balances)
|
||||
data := map[string][]float64{}
|
||||
@@ -185,23 +200,9 @@ func Main() {
|
||||
for _, k := range labels {
|
||||
points = append(points, data[k])
|
||||
}
|
||||
|
||||
pointsMax := func() float64 {
|
||||
var max float64
|
||||
for _, vs := range points {
|
||||
for _, v := range vs {
|
||||
if max < v {
|
||||
max = v
|
||||
}
|
||||
}
|
||||
}
|
||||
return max
|
||||
}
|
||||
for pointsMax() > 100 {
|
||||
for i := range points {
|
||||
for j := range points[i] {
|
||||
points[i][j] /= 10.0
|
||||
}
|
||||
for i := range points {
|
||||
for j := range points[i] {
|
||||
points[i][j] /= 1000.0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user