This commit is contained in:
Bel LaPointe
2023-10-25 09:38:29 -06:00
parent 76f6cf1016
commit 49a77c5424
4 changed files with 36 additions and 43 deletions

View File

@@ -1,41 +1,4 @@
#! /bin/bash
cd "$(dirname "$(realpath "$BASH_SOURCE")")"
go run . \
-json \
-group-date ^20..-.. \
-group-name '^[^:]*:[^:]*' \
-like-name '(AssetAccount|Debts|Stock|Retirement)' \
-foo reg \
"$@" ./macro.d/* \
| jq -c '.[] | {label: .name, x: .delta.Date, y: .balance[(.delta.Currency)], z: .delta.Currency}' \
| grep '"z":"\$"' \
| python3 -c '
# line chart
import matplotlib.pyplot as plt
import json
from sys import stdin
fig = plt.figure()
plot = fig.add_subplot()
label_z_x_y = {}
for line in stdin.readlines():
if not line:
continue
d = json.loads(line)
if not d["label"] in label_z_x_y:
label_z_x_y[d["label"]] = {}
if not d["z"] in label_z_x_y[d["label"]]:
label_z_x_y[d["label"]][d["z"]] = {}
label_z_x_y[d["label"]][d["z"]][d["x"]] = d["y"]
for label in label_z_x_y:
for z in label_z_x_y[label]:
xs = sorted([i for i in label_z_x_y[label][z].keys()])
ys = [label_z_x_y[label][z][x] for x in xs]
plot.plot(xs, ys, label=f"{label} ({z})")
plot.legend()
plt.show()
'
go run . -http=:8080 -foo reg -like-after 1023-08 -group-date ^....-.. -group-name '^[^:]*:[^:]*' -like-name '(AssetAccount|Stock|Retirement)' macro.d/*