1. 19
  1. 5

    Just came here to drop a link: https://www.ledger-cli.org/

    1. 2

      He mentions ledger and says he doesn’t want to specify where the money came from in each purchase.

    2. 2

      I approve.

      1. 3

        No relation.

      2. 2

        Interesting idea. What does data entry look like? You mentioned that you used an Android app previously, do you use some app on android for adding entries to the CSV file(s) too?

        1. 4

          I’m currently entering the data on the computer, but I have some ideas on how to make it work with my phone.

          • CGI script with a form
          • Email handler that adds to my budget
          • Adding a command to my XMPP bot

          I can also just edit the CSV files from my phone and use the script from Termux. I keep that folder on Syncthing.

          1. 1

            Adding a command to my XMPP bot

            Nice, I think I may copy this idea.

        2. 1

          I’ve already posted a comment upstream but the formatting is broken there so re-posting it here as someone might find it useful:

          —–BEGIN QUOTE—–

          There are very few things which cannot be improved, so here we go :^)

          --- budget.sh.orig      Sat Apr  6 19:46:23 2019
          +++ budget      Fri Apr  5 12:41:50 2019
          @@ -1,21 +1,24 @@
           #!/bin/sh
          
          +tempfile=$(mktemp)
           days=${1:-7}
          +today=$(date '+%Y-%m-%d')
          +date=$(date -r $(($(date +%s) - $(($days * 86400)))) '+%Y-%m-%d')
          
          -cat *.csv | sed '/^Date/d' > combined.csv.temp
          +sed '/^Date/d' *.csv > $tempfile
          
          -output=$(sqlite3 <<EOF
          +sqlite3 <<EOF | sed 's/|/ /g'
           create table Transactions(Date, Amount, Currency, Category, Description);
           .mode csv
          -.import combined.csv.temp Transactions
          +.import $tempfile Transactions
           .mode list
          
           select 'Amount spent today:',
          -coalesce(sum(Amount), 0) from Transactions where Date = '$(date +%Y-%m-%d)';
          +coalesce(sum(Amount), 0) from Transactions where Date = '$today';
          
           select '';
           select 'Last $days days average:',
          -sum(Amount)/$days, Currency from Transactions where Date > '$(date --date="-$days days" +%Y-%m-%d)'
          +sum(Amount)/$days, Currency from Transactions where Date > '$date'
           group by Currency;
          
           select '';
          @@ -23,12 +26,8 @@
           select '=======================';
          
           select Category, sum(Amount) from Transactions
          -where Date > '$(date --date="-$days days" +%Y-%m-%d)'
          +where Date > '$date'
           group by Category order by sum(Amount) desc;
           EOF
          -      )
          
          -rm combined.csv.temp
          -
          -echo "$output" | sed 's/|/ /g'
          -
          +rm $tempfile
          

          It should all be self-explanatory but just in case it isn’t…:

          1. Use mktemp for the temporary file - always a good habbit, IMHO.

          2. --date is GNU-only, thus not portable so use something that will, at least, work on OpenBSD, macOS, and Linux - still not POSIX, but oh well

          3. Given that the same date command is ran twice, run it once and catch the output into a variable.

          4. Remove a UUOC ;^)

          5. No need to catch the output of sqlite3 + heredoc into a variable, so run it and pipe it to sed directly.

          We could also do something about *.csv, i.e. use $1 for it and $2 for days, maybe getopt(1), but that would be a bit much for a simple tool like this, IMHO.

          —–END QUOTE—–

          1. 1

            I wonder what Android app the author was using; I’ve used GoodBudget for several years and love it so much that I happily pay $45 each year to support the company.

            1. 3

              Does that export data into a sane format that other things can use? It seems like the author’s concern was about having portable data that can easily be migrated to a new platform and back out when that new platform stops being a thing, for example.

              1. 2

                Indeed, it exports to CSVs that I was easily able to import into a spreadsheet.

              2. 1

                How does GoodBudget compare to YNAB for your use-case?

                1. 2

                  Does YNAB have a Web app too? GoodBudget has a very nice one.

              3. 1

                Interesting. I’m curious how this system works out. I could imagine a little bit of work coming up as soon as you have multiple accounts and transfers in between those accounts and stuff like that.

                1. 3

                  Not handling that is deliberate. This is meant for keeping track of your expenses, if you transfer money between your accounts, you’re not spending money.

                  If you want to keep track of stuff like sending money to a savings account, just add it as an expense. You’re supposed to count savings as money you can’t touch anyway, so it makes sense to show it as an expense. If you want to hide those from the stats you see from the script, just make a category for those and hide them with SQL (you can show them differently) or filter them out with sed.

                  1. 2

                    Sure. What I mean is at some point you’ll run into other such edge cases, every one of which would require updating the SQL scripts you’ve written, to the point where your setup would start resembling an existing piece of accounting/budgeting software. :)

                2. 1

                  Wouldn’t this honestly be easier as a spreadsheet? Code is nice and all, but spreadsheets seem much better as a scratchpad for organizing things numbering in the dozens and doing basic math on them.

                  1. 1

                    As someone who maintains a large, convoluted spreadsheet for my investing shenanigans, having all the logic in flat files/scripts would be so, so very much easier to maintain/extend/debug over time than using the poorly formatted expression editor in $spreadsheet_app. When you have expressions scattered around the sheet(s), it becomes insane when you need to make modifications or debug something months/years later. You could literally implement this in whatever language you are comfortable with.

                    1. 3

                      I’ve seen my share of spreadsheets that were way too complex and needed to be converted to proper code too. But I believe there’s a place for both. Things that are simple, involve dozens to hundreds of rows of data and a few simple formulas and maybe a graph or two should be spreadsheets, not code IMO. Things that involve any combination of millions of rows of data, complex multi-step logic, integration with external data sources, and other such things should be code, not spreadsheets.

                      There’s some gap for things in between complexity levels, things that start simple and get more complex, things designed by people who don’t know how to code at all, etc. Sometimes a judgement call needs to be made. Sometimes spreadsheets legitimately grow complex enough that they should be converted to proper applications. But none of that means that simple problems that are likely to stay simple shouldn’t stay as spreadsheets.

                      1. 2

                        Another major issue with spreadsheets is they are not always portable between spreadsheet applications (ms office, libreoffice, google sheets, etc), and sometimes not even portable between versions of the same spreadsheet app.