From a32173ace60df5a1e9414f5e95b556c436f62718 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 3 Aug 2004 04:34:50 +0000 Subject: changes --- scripts/bal | 18 +++++++++++------- scripts/confirm.py | 40 ---------------------------------------- scripts/entry | 0 scripts/getquote | 6 ++++-- scripts/mean | 0 scripts/profit | 0 scripts/reg | 0 scripts/report | 8 +++++--- scripts/spending | 0 scripts/test | 14 -------------- scripts/worth | 0 11 files changed, 20 insertions(+), 66 deletions(-) mode change 100755 => 100644 scripts/bal delete mode 100755 scripts/confirm.py mode change 100755 => 100644 scripts/entry mode change 100755 => 100644 scripts/getquote mode change 100755 => 100644 scripts/mean mode change 100755 => 100644 scripts/profit mode change 100755 => 100644 scripts/reg mode change 100755 => 100644 scripts/report mode change 100755 => 100644 scripts/spending delete mode 100755 scripts/test mode change 100755 => 100644 scripts/worth (limited to 'scripts') diff --git a/scripts/bal b/scripts/bal old mode 100755 new mode 100644 index ca79b8ad..7fdf54ca --- 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 old mode 100755 new mode 100644 diff --git a/scripts/getquote b/scripts/getquote old mode 100755 new mode 100644 index 8daf6633..cf8c8abd --- 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 old mode 100755 new mode 100644 diff --git a/scripts/profit b/scripts/profit old mode 100755 new mode 100644 diff --git a/scripts/reg b/scripts/reg old mode 100755 new mode 100644 diff --git a/scripts/report b/scripts/report old mode 100755 new mode 100644 index c5dbe171..aa42982e --- 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 <