diff options
Diffstat (limited to 'scripts')
-rw-r--r--[-rwxr-xr-x] | scripts/bal | 18 | ||||
-rwxr-xr-x | scripts/confirm.py | 40 | ||||
-rw-r--r--[-rwxr-xr-x] | scripts/entry | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | scripts/getquote | 6 | ||||
-rw-r--r--[-rwxr-xr-x] | scripts/mean | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | scripts/profit | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | scripts/reg | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | scripts/report | 8 | ||||
-rw-r--r--[-rwxr-xr-x] | scripts/spending | 0 | ||||
-rwxr-xr-x | scripts/test | 14 | ||||
-rw-r--r--[-rwxr-xr-x] | scripts/worth | 0 |
11 files changed, 20 insertions, 66 deletions
diff --git a/scripts/bal b/scripts/bal index ca79b8ad..7fdf54ca 100755..100644 --- a/scripts/bal +++ b/scripts/bal @@ -1,23 +1,27 @@ #!/bin/sh -switch="-c" -limit="-d /^Liabilities/?T<0:(T&AT>{\$100.00})" +switch="" +current="-c" +limit="-l \$50" +negonly="-N ^Liabilities" -if [ "$1" = "-C" -o "$1" = "-U" ]; then +if [ "$1" = "-C" -o "$1" = "-U" -o "$1" = "-P" ]; then switch="$1" shift elif [ "$1" = "-b" -o "$1" = "-e" ]; then - switch="$1 $2" + current="$1 $2" shift 2 fi accts="$@" if [ -z "$accts" ]; then accts="-Equity -Income -Expenses" - accts="$accts -^Retirement" - accts="$accts -Deposits" + if [ ! "$switch" = "-P" ]; then + accts="$accts -Savings -Retirement" + fi else limit="" + negonly="" fi -ledger $switch $limit -s -S "-AT" -V -Q balance $accts +ledger $current $limit $negonly -s $switch balance $accts diff --git a/scripts/confirm.py b/scripts/confirm.py deleted file mode 100755 index 1132ca0c..00000000 --- a/scripts/confirm.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/python - -# This script confirms what ledger tells you. - -import sys -import os -import re - -def clean(num): - return float(re.sub("(\s+|\$|,)","",num)) - -running_total = 0.0 -index = 1 -last_line = "" - -for line in os.popen("../ledger %s reg %s" % (sys.argv[1], sys.argv[2])): - value = clean(line[55:67]) - total = clean(line[68:]) - - running_total += value - if abs(running_total - total) > 0.001: - print "! discrepancy of %.2f (%.2f - %.2f) at line %d:" % \ - (running_total - total, running_total, total, index) - print line, - running_total = total - - index += 1 - last_line = line - -balance_total = 0.0 - -for line in os.popen("../ledger %s bal %s" % (sys.argv[1], sys.argv[2])): - balance_total = clean(line[:20]) - -if abs(balance_total - running_total) > 0.001: - print - print "! discrepancy of %.2f (%.2f - %.2f) between register and balance" % \ - (balance_total - running_total, balance_total, running_total) - print last_line, - print line, diff --git a/scripts/entry b/scripts/entry index 28daf8c8..28daf8c8 100755..100644 --- a/scripts/entry +++ b/scripts/entry diff --git a/scripts/getquote b/scripts/getquote index 8daf6633..cf8c8abd 100755..100644 --- a/scripts/getquote +++ b/scripts/getquote @@ -1,14 +1,16 @@ #!/usr/bin/perl +exit 0 if $ARGV[0] eq "\$"; + use Finance::Quote; $q = Finance::Quote->new; + $q->timeout(60); $q->require_labels(qw/price/); %quotes = $q->fetch("nasdaq", $ARGV[0]); + if ($quotes{$ARGV[0], "price"}) { print "\$", $quotes{$ARGV[0], "price"}, "\n"; -} else { - exit 1; } diff --git a/scripts/mean b/scripts/mean index 3c6f779a..3c6f779a 100755..100644 --- a/scripts/mean +++ b/scripts/mean diff --git a/scripts/profit b/scripts/profit index 26f112d1..26f112d1 100755..100644 --- a/scripts/profit +++ b/scripts/profit diff --git a/scripts/reg b/scripts/reg index 75ac364e..75ac364e 100755..100644 --- a/scripts/reg +++ b/scripts/reg diff --git a/scripts/report b/scripts/report index c5dbe171..aa42982e 100755..100644 --- a/scripts/report +++ b/scripts/report @@ -1,15 +1,17 @@ #!/bin/sh +dir=$HOME/doc/finance + cd /tmp -ledger "$@" > report + +ledger -M -G register "$@" > $1 gnuplot <<EOF set terminal png set output "report.png" set xdata time set timefmt "%Y/%m/%d" -plot "report" using 1:2 with linespoints +plot "$1" using 1:2 with linespoints EOF -rm -f report open report.png diff --git a/scripts/spending b/scripts/spending index 895c4170..895c4170 100755..100644 --- a/scripts/spending +++ b/scripts/spending diff --git a/scripts/test b/scripts/test deleted file mode 100755 index 09b0bb03..00000000 --- a/scripts/test +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -for test in \ - "-O nrl:checking" \ - "-B 401" \ - "-V 401" \ - "-G 401" \ - "-B retire" \ - "-V retire" \ - "-G retire" -do - echo testing: $test - python confirm.py $test -done diff --git a/scripts/worth b/scripts/worth index 58b20440..58b20440 100755..100644 --- a/scripts/worth +++ b/scripts/worth |