#!/bin/sh

# usage: buchungen [startdate [enddate]]
# (date format YYYYMMDD)

if [ -n "$1" ]; then
	reqargs="$reqargs --fromdate=$1"
fi
if [ -n "$2" ]; then
	reqargs="$reqargs --todate=$2"
fi

ctx=`mktemp -t buchungen`
aqbanking-cli request -c $ctx $reqargs --transactions
aqbanking-cli listtrans -c $ctx | csv2ledger.hs
rm -f $ctx

