A User's view of Hledger

Learning about hledger

Working program to generate fake hledger transactions

Last week I shared how I wanted to write a program that would generate hledger transactions that I could use in instructional videos, for example.

I now have a working version, written in R. Here is what is working well. The program picks a random date between 2 dates, and it selects random payees, expense categories, and payment categories from lists of the same. Finally, it picks a random currency amount between a minimum and maximum.

Here is some sample output:

2024-01-12 Convenience 
   expenses:entertainment    $19.18 
   liabilities:Universal Credit Card    -$19.18 

2023-08-28 Mom&Pop 
   expenses:automotive    $16.14 
   assets:cash    -$16.14 

2023-07-27 Mom&Pop 
   expenses:groceries    $6.60 
   liabilities:Universal Credit Card    -$6.60 

2023-06-09 BigStore 
   expenses:gas    $8.83 
   assets:cash    -$8.83 

2023-09-09 Acme 
   expenses:groceries    $9.66 
   assets:checking    -$9.66 

2023-10-01 BigStore 
   expenses:groceries    $12.79 
   assets:checking    -$12.79 

2023-08-11 Acme 
   expenses:gas    $21.04 
   assets:checking    -$21.04 

2023-11-09 Mom&Pop 
   expenses:gas    $22.44 
   assets:cash    -$22.44 

2023-10-19 BigStore 
   expenses:groceries    $24.62 
   assets:checking    -$24.62 

2023-08-26 Convenience 
   expenses:groceries    $16.05 
   liabilities:Universal Credit Card    -$16.05 

2024-01-11 Acme 
   expenses:groceries    $17.40 
   assets:checking    -$17.40 

2023-08-31 Sales-R-Us 
   expenses:automotive    $23.06 
   liabilities:Universal Credit Card    -$23.06 

2023-06-04 Acme 
   expenses:home    $17.15 
   assets:checking    -$17.15 

2023-08-28 Sales-R-Us 
   expenses:gas    $11.49 
   assets:checking    -$11.49 

2023-12-07 Mom&Pop 
   expenses:entertainment    $5.40 
   assets:checking    -$5.40 

2023-07-26 Sales-R-Us 
   expenses:entertainment    $14.78 
   assets:cash    -$14.78 

2023-07-10 BigStore 
   expenses:automotive    $11.90 
   liabilities:Universal Credit Card    -$11.90 

2023-12-30 Sales-R-Us 
   expenses:groceries    $22.09 
   liabilities:Universal Credit Card    -$22.09 

2023-11-12 Mom&Pop 
   expenses:gas    $12.41 
   liabilities:Universal Credit Card    -$12.41 

Improvements needed? Aligning the currency amounts would be nice, as well as sorting chronologically. Fortunately, the Emacs ledger command accomplishes both tasks with aplomb, so neither is a big problem.

However, I definitely want to improve the program so that by default it will create transactions with dates in the last 6 months, no matter when the program is run. You can still specify whatever date range you like, but the default will be for the last 6 months.

Next week, I hope to be finished and to share the updated R code.

Upgrading to hledger 1.32.3

Finally, I have seen this before on a Mac, where brew will give a warning message for some if its programs (though not hledger, thankfully) that it is attempting to upgrade. The message is that you need to run “xcode-select –install.” So naturally, I ran this at the command line, but unfortunately saw no results. This is because a dialogue box that needed my approval popped up out-of-sight behind another window. Once I found the dialogue box and made the appropriate approval, the xcode tools seemed to be properly installed as brew was then able to upgrade the remaining programs. Again, nothing that was needed for hledger, but nice to have brew upgrade my other programs.