summaryrefslogtreecommitdiff
path: root/bips
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2021-05-22 06:02:56 -0400
committerBen Sima <ben@bsima.me>2021-05-22 06:03:11 -0400
commit622f1dcb284952df4619917a825d292793920acd (patch)
tree4e50fc6625f4182e56fd4acc2df7c3af28c9f524 /bips
parent2f71ad0c66be309adb84d09137aa016d99876e24 (diff)
add bips script
Diffstat (limited to 'bips')
-rwxr-xr-xbips13
1 files changed, 13 insertions, 0 deletions
diff --git a/bips b/bips
new file mode 100755
index 0000000..7df76cd
--- /dev/null
+++ b/bips
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+networth=$(hledger bal ^as ^li --value=now,USD --output-format=csv \
+ | tail -n 1 \
+ | tr -d [totalUSD,\"]
+)
+bp=$(bc -l <<< "$networth * 0.0001")
+if [[ $1 == "--from" ]]
+then
+ printf "%0.f USD" $(bc -l <<< "$bp * $2")
+else
+ printf "%.0f bips" $(bc -l <<< "$1/$bp")
+fi
+