hledger-forecast 1.2.1 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 410b448de275184312f25f5f5cc008fbaf945c27c40827c9f203fd3c14422729
4
- data.tar.gz: d9c9f019852246dee148758231bd8619f10e8246459dd2b719ede97f31ee8e05
3
+ metadata.gz: b5ba12a84909e9d92ac3a9b1b5d977b661131fe6673f8a1c6e73f9ec57d790e2
4
+ data.tar.gz: 8f7f23fde8f640912eacb23982e198d67bfe83671c43eba6357a1cdde9a87528
5
5
  SHA512:
6
- metadata.gz: 7700e2fc1778ad1e0548cd53ce3648b38ec2f56ce493204b5bb1efedff0d6621c3563ec09494ed2362f926aa3fe22c10f06394f551b5907cb8c9106c2642e3a1
7
- data.tar.gz: fba3f08d0c906fddaab46c31a236602b2843a0c6a5f56723cac9fdc89453e46b6871f129d0e8a684d369883f4dfa8a81cfde64e5997cf8ee4485e90e345ad772
6
+ metadata.gz: 33c532dc9e25ff41c968a1ada59379dbc56a9a0587e2abc4f07acdd10387c88b6f834ec6025dccb44e5ab5f4b3446341e09b947275e540857884728e84b5392a
7
+ data.tar.gz: 918e5be4d90e1bd52a75436ce0ded33a72e49dd29e9d0a112067eddf2b86693a8ac6c21bd027ed2148d28819e5af432e594a063ca28fdcbe14bceeaee335d283
@@ -19,7 +19,7 @@ jobs:
19
19
  - name: Update packages
20
20
  run: sudo apt-get update
21
21
  - name: Install packages
22
- run: sudo apt-get -y install ledger hledger
22
+ run: sudo apt-get -y install hledger
23
23
  - name: Set up Ruby
24
24
  uses: ruby/setup-ruby@v1
25
25
  with:
data/README.md CHANGED
@@ -11,19 +11,30 @@
11
11
  <a href="https://github.com/olimorris/hledger-forecast/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/olimorris/hledger-forecast/ci.yml?branch=main&label=tests&style=for-the-badge"></a>
12
12
  </p>
13
13
 
14
- **"Improved", you say?** Using a _yaml_ file, forecasts can be quickly generated into a _journal_ file ready to be fed into [hledger](https://github.com/simonmichael/hledger). Forecasts can be easily constrained between dates, inflated by modifiers, tracked until they appear in your bank statements and summarized into your own daily/weekly/monthly/yearly personal forecast income and expenditure statement.
14
+ **"Improved", you say?** Using a _CSV_ (or _YML_) file, forecasts can be quickly generated into a _journal_ file ready to be fed into [hledger](https://github.com/simonmichael/hledger). **A 15 line [CSV file](https://github.com/olimorris/hledger-forecast/blob/main/example.csv) can generate a 42 line hledger [forecast file](https://github.com/olimorris/hledger-forecast/blob/main/example.journal)!**
15
15
 
16
- I **strongly** recommend you read the [rationale](#paintbrush-rationale) section to see if this app might be useful to you.
16
+ Forecasts can also be constrained between dates, inflated by modifiers, tracked until they appear in your bank statements and summarized into your own daily/weekly/monthly/yearly personal forecast income and expenditure statement.
17
17
 
18
18
  ## :sparkles: Features
19
19
 
20
- - :book: Uses a simple yaml file to generate forecasts which can be used with hledger
20
+ - :muscle: Uses a simple CSV (or YML) file to generate forecasts which can be used with hledger
21
21
  - :date: Can smartly track forecasts against your bank statement
22
22
  - :moneybag: Can automatically apply modifiers such as inflation/deflation to forecasts
23
23
  - :abacus: Enables the use of maths in your forecasts (for amounts and dates)
24
24
  - :chart_with_upwards_trend: Display your forecasts as income and expenditure reports (e.g. daily, weekly, monthly)
25
25
  - :computer: Simple and easy to use CLI
26
26
 
27
+ ## :camera_flash: Screenshots
28
+
29
+ **CSV forecast and corresponding journal output**
30
+
31
+ <img src="https://github.com/olimorris/hledger-forecast/assets/9512444/430503b5-f447-4972-b122-b48f8628aff9" alt="Hledger-Forecast" />
32
+
33
+ **Output from the `summarize` command**
34
+
35
+ <img src="https://github.com/olimorris/hledger-forecast/assets/9512444/f5017ea2-9606-46ec-8b38-8840dc175e7b" alt="Summarize command" />
36
+
37
+
27
38
  ## :package: Installation
28
39
 
29
40
  Assuming you have Ruby and [Rubygems](http://rubygems.org/pages/download) installed on your system, simply run:
@@ -50,15 +61,16 @@ The available options are:
50
61
 
51
62
  ### Generate command
52
63
 
53
- The `hledger-forecast generate` command will generate a forecast _from_ a `yaml` file _to_ a journal file. You can see the output of this command in the [example.journal](https://github.com/olimorris/hledger-forecast/blob/main/example.journal) file.
64
+ The `hledger-forecast generate` command will generate a forecast _from_ a `CSV` or `YML` file _to_ a journal file. You can see the output of this command in the [example.journal](https://github.com/olimorris/hledger-forecast/blob/main/example.journal) file.
54
65
 
55
66
  The available options are:
56
67
 
57
68
  Usage: hledger-forecast generate [options]
58
69
 
59
- -f, --forecast FILE The path to the FORECAST yaml file to generate from
70
+ -f, --forecast FILE The path to the FORECAST CSV/YML file to generate from
60
71
  -o, --output-file FILE The path to the OUTPUT file to create
61
72
  -t, --transaction FILE The path to the TRANSACTION journal file
73
+ -v, --verbose Don't group transactions by type in the output file
62
74
  --force Force an overwrite of the output file
63
75
  --no-track Don't track any transactions
64
76
  -h, --help Show this help message
@@ -73,159 +85,177 @@ To work with hledger, include the forecast file and use the `--forecast` flag:
73
85
 
74
86
  hledger -f bank_transactions.journal -f forecast.journal --forecast bal assets -e 2024-02
75
87
 
76
- The command will generate a forecast up to the end of Feb 2024, showing the balance for any asset accounts, overlaying some bank transactions with the forecast journal file. Of course, refer to the [hledger](https://hledger.org/dev/hledger.html) documentation for more information on how to query your finances.
88
+ The command will generate a forecast up to the end of Feb 2024, showing the balance for any asset accounts, overlaying some bank transactions with the forecast journal file. Forecasting in hledger can be complicated so be sure to refer to the [documentation](https://hledger.org/dev/hledger.html) or start a [discussion](https://github.com/olimorris/hledger-forecast/discussions/new?category=q-a).
77
89
 
78
- > **Note**: To apply any modifiers, use the `--auto` flag at the end of your command.
90
+ If you use the `hledger-ui` tool, it may be helpful to use the `--verbose` flag. This ensures that transactions are not grouped together in the forecast journal file, making descriptions much easier to read.
79
91
 
80
92
  ### Summarize command
81
93
 
82
- As your `yaml` configuration file grows, it can be helpful to sum up the total amounts and output them to the CLI.
94
+ As your configuration file grows, it can be helpful to sum up the total amounts and output them to the CLI.
83
95
  Furthermore, being able to see your monthly profit and loss statement _if_ you were to purchase that new item may
84
96
  influence your buying decision. In hledger-forecast, this can be achieved by:
85
97
 
86
- hledger-forecast summarize -f my_forecast.yml
98
+ hledger-forecast summarize -f my_forecast.csv
87
99
 
88
100
  The available options are:
89
101
 
90
102
  Usage: hledger-forecast summarize [options]
91
103
 
92
- -f, --forecast FILE The path to the FORECAST yaml file to summarize
104
+ -f, --forecast FILE The path to the FORECAST CSV/YML file to summarize
93
105
  -r, --roll-up PERIOD The period to roll-up your forecasts into. One of:
94
106
  [yearly], [half-yearly], [quarterly], [monthly], [weekly], [daily]
95
107
  -v, --verbose Show additional information in the summary
96
108
  -h, --help Show this help message
97
109
 
98
- ## :gear: Configuration
99
-
100
- ### The yaml file
101
-
102
- > **Note**: See the [example.yml](https://github.com/olimorris/hledger-forecast/blob/main/example.yml) file for an example config and its corresponding [output](https://github.com/olimorris/hledger-forecast/blob/main/example.journal)
103
-
104
- Firstly, create a `yaml` file which will contain the transactions you'd like to forecast:
105
-
106
- ```yaml
107
- # forecast.yml
108
- monthly:
109
- - account: "Assets:Bank"
110
- from: "2023-03-01"
111
- transactions:
112
- - amount: 2000
113
- category: "Expenses:Mortgage"
114
- description: Mortgage
115
- - amount: 500
116
- category: "Expenses:Food"
117
- description: Food
118
-
119
- settings:
120
- currency: GBP
110
+ ## :gear: Creating your forecast
111
+
112
+ The app makes it easy to generate a comprehensive _journal_ file with very few lines of code, making it much easier to stay on top of your forecasting from month to month.
113
+
114
+ ### Columns
115
+
116
+ The _CSV_ file _should_ contain a header row with the following columns:
117
+
118
+ - `type` - (string) - The type of forecast entry. One of `monthly`, `quarterly`, `half-yearly`, `yearly`, `once` or `custom`
119
+ - `frequency` - (string) - The frequency that the type repeats with (only if `custom`). As per hledger's [periodic rule syntax](https://hledger.org/dev/hledger.html#periodic-transactions)
120
+ - `account` - (string) - The account the transaction applies to e.g. _Expenses:Food_
121
+ - `from` - (date) - The date the transaction should start from e.g. _2023-06-01_
122
+ - `to` - (date) _(optional)_ - The date the transaction should end on e.g. _2023-12-31_
123
+ - `description` - (string) - A description of the transaction
124
+ - `category` - (string) - The classification or category of the transaction
125
+ - `amount` - (integer/float) - The amount of the transaction
126
+ - `roll-up` - (integer/float) _(optional)_ - For use with the summarizer, the value you need to multiply the amount by to get it into a yearly amount
127
+ - `summary_exclude` - (boolean) _(optional)_ - Exclude the transaction from the summarizer?
128
+ - `track` - (boolean) _(optional)_ - Track the transaction against your confirmed transactions?
129
+
130
+ ### An example CSV forecast
131
+
132
+ Putting it together, we end up with a CSV file like:
133
+
134
+ ```csv
135
+ type,frequency,account,from,to,description,category,amount,roll-up,summary_exclude,track
136
+ monthly,,Assets:Bank,01/03/2023,,Salary,Income:Salary,-3500,,,
137
+ monthly,,Assets:Bank,01/03/2023,01/01/2025,Mortgage,Expenses:Mortgage,2000,,,
138
+ monthly,,Assets:Bank,01/03/2023,,Bills,Expenses:Bills,175,,,
139
+ monthly,,Assets:Bank,01/03/2023,,Food,Expenses:Food,500,,,
140
+ monthly,,Assets:Bank,01/03/2023,,New Kitchen,Expenses:House,=5000/24,,,
141
+ monthly,,Assets:Bank,01/03/2023,=12,Holiday,Expenses:Holiday,125,,,
142
+ monthly,,Assets:Bank,01/03/2023,01/03/2025,Rainy day fund,Assets:Savings,300,,,
143
+ monthly,,Assets:Pension,01/01/2024,,Pension draw down,Income:Pension,-500,,,
144
+ quarterly,,Assets:Bank,01/04/2023,,Quarterly bonus,Income:Bonus,-1000,,,
145
+ half-yearly,,Assets:Bank,01/04/2023,,Top up holiday funds,Expenses:Holiday,500,,,
146
+ yearly,,Assets:Bank,01/04/2023,,Annual bonus,Income:Bonus,-2000,,,
147
+ once,,Assets:Bank,05/03/2023,,Refund for that damn laptop,Expenses:Shopping,-3000,,TRUE,TRUE
148
+ custom,every 2 weeks,Assets:Bank,01/03/2023,,Hair and beauty,Expenses:Personal Care,80,26,,
149
+ custom,every 5 weeks,Assets:Bank,01/03/2023,,Misc expenses,Expenses:General Expenses,30,10.4,,
150
+ settings,currency,USD,,,,,,,,
121
151
  ```
122
152
 
123
- Let's examine what's going on in this config file:
124
-
125
- - We're telling the app to create two monthly transactions and repeat them, forever, starting from March 2023
126
- - We're telling the app to link them both to the `Assets:Bank` account
127
- - We've added descriptions to make it easy to follow in our output file
128
- - Finally, we're telling the app to use the `GBP` currency; the default (`USD`) will be used if this is not specified
129
-
130
- ### Periods
131
-
132
- Besides monthly recurring transactions, the app also supports the following periods:
153
+ ### Additional features
133
154
 
134
- - `quarterly` - For transactions every _3 months_
135
- - `half-yearly` - For transactions every _6 months_
136
- - `yearly` - Generate transactions _once a year_
137
- - `once` - Generate _one-time_ transactions on a specified date
138
- - `custom` - Generate transactions every _n days/weeks/months_
155
+ From the example above, there are a few additional features that may be useful.
139
156
 
140
- These will write periodic transactions such as `~ every 3 months` or `~ every year` in the output journal file.
157
+ #### Calculated amounts
141
158
 
142
- #### Custom period
159
+ > **Note**: Calculations will be determined up to two decimal places
143
160
 
144
- When you need a bespoke time bound forecast, a custom period may be useful. Custom periods allow you to specify a periodic rule as per hledger's [periodic rule syntax](https://hledger.org/dev/hledger.html#periodic-transactions):
161
+ It may be helpful to let the app calculate the forecasted amount in your transactions on your behalf. This can be especially useful if you're spreading a payment out over a number of months:
145
162
 
146
- ```yaml
147
- custom:
148
- - frequency: "every 2 weeks"
149
- account: "Assets:Bank"
150
- from: "2023-03-01"
151
- transactions:
152
- - amount: 80
153
- category: "Expenses:Personal Care"
154
- description: Hair and beauty
163
+ ```csv
164
+ type,frequency,account,from,to,description,category,amount,roll-up,summary_exclude,track
165
+ monthly,,Assets:Bank,01/03/2023,,New Kitchen,Expenses:House,=5000/24,,,
155
166
  ```
156
167
 
157
- ### Dates
168
+ Simply start the `amount` column with a `=` sign and use standard Excel based math formatting.
158
169
 
159
- The core of any solid forecast is predicting the correct periods that costs will fall into. When running the app from the CLI, you can specify specific dates to generate transactions over (see the [usage](#rocket-usage) section).
170
+ #### Calculated dates
160
171
 
161
- You can further control the dates at a period/top-level as well as at a transaction level:
172
+ It may also be helpful for `to` dates to be calculated:
162
173
 
163
- #### Top level
174
+ ```csv
175
+ type,frequency,account,from,to,description,category,amount,roll-up,summary_exclude,track
176
+ monthly,,Assets:Bank,01/03/2023,=12,Holiday,Expenses:Holiday,125,,,
177
+ ```
164
178
 
165
- In the example below, all transactions in the `monthly` block will be constrained by the `to` date:
179
+ ### Settings
166
180
 
167
- ```yaml
168
- monthly:
169
- - account: "Assets:Bank"
170
- from: "2023-03-01"
171
- to: "2025-01-01"
172
- transactions:
173
- # details omitted for brevity
181
+ There are also additional settings that can be applied in the forecast. The defaults are:
182
+
183
+ ```csv
184
+ type,frequency,account,from,to,description,category,amount,roll-up,summary_exclude,track
185
+ settings,currency,USD,,,,,,,,
186
+ settings,show_symbol,true,,,,,,,,
187
+ settings,thousands_separator,true,,,,,,,,
174
188
  ```
175
189
 
176
- #### Transaction level
190
+ ### An example YML forecast
191
+
192
+ > **Note**: The app uses `yml` in place of `yaml` by default
177
193
 
178
- In the example below, only the single transaction will be constrained by the `to` date:
194
+ Taking the _CSV_ example above and applying it to a _YML_ file:
179
195
 
180
- ```yaml
196
+ ```yml
181
197
  monthly:
182
198
  - account: "Assets:Bank"
183
199
  from: "2023-03-01"
184
200
  transactions:
201
+ - amount: -3500
202
+ category: "Income:Salary"
203
+ description: Salary
185
204
  - amount: 2000
186
205
  category: "Expenses:Mortgage"
187
206
  description: Mortgage
188
207
  to: "2025-01-01"
189
- ```
190
-
191
- It can also be useful to compute a `to` date by adding on a number of months to the `from` date. Extending the example above:
192
-
193
- ```yaml
194
- - amount: 125
195
- category: "Expenses:Holiday"
196
- description: Holiday
197
- to: "=12"
198
- ```
199
-
200
- This will take the `to` date to _2024-02-29_. This can be useful if you know a payment is due to end in _n_ months time and don't wish to use one of the many date calculators on the internet.
201
-
202
- ### Calculated amounts
203
-
204
- > **Note**: Calculations will be determined up to two decimal places
205
-
206
- It may be helpful to let the app calculate the forecasted amount in your transactions on your behalf. This can be especially useful if you're spreading a payment out over a number of months:
207
-
208
- ```yaml
209
- monthly:
210
- - account: "Liabilities:Amex"
211
- from: "2023-05-01"
212
- transactions:
208
+ - amount: 175
209
+ category: "Expenses:Bills"
210
+ description: Bills
211
+ - amount: 500
212
+ category: "Expenses:Food"
213
+ description: Food
213
214
  - amount: "=5000/24"
214
215
  category: "Expenses:House"
215
216
  description: New Kitchen
216
- ```
217
-
218
- Simply ensure that the amount starts with an `=` sign, is enclosed in quotation marks and uses standard mathematical notations. Of course, it may make sense to restrict this transaction with a `to` date in months, as per the [transaction level dates](#transaction-level) section.
219
-
220
- ### Tracking transactions
217
+ - amount: 125
218
+ category: "Expenses:Holiday"
219
+ description: Holiday
220
+ to: "=12"
221
+ - account: "Assets:Bank"
222
+ from: "2023-03-01"
223
+ to: "2025-01-01"
224
+ transactions:
225
+ - amount: 300
226
+ category: "Assets:Savings"
227
+ description: "Rainy day fund"
228
+ - account: "Assets:Pension"
229
+ from: "2024-01-01"
230
+ transactions:
231
+ - amount: -500
232
+ category: "Income:Pension"
233
+ description: Pension draw down
221
234
 
222
- > **Note**: Marking a transaction for tracking will ensure that it is only written into the forecast if it isn't found within a specified transaction file
235
+ quarterly:
236
+ - account: "Assets:Bank"
237
+ from: "2023-04-01"
238
+ transactions:
239
+ - amount: -1000.00
240
+ category: "Income:Bonus"
241
+ description: Quarterly bonus
223
242
 
224
- Sometimes it can be useful to track and monitor forecasted transactions to ensure that they are accounted for in any financial projections. If they are present, then these should be discarded from your forecast as this will create a double count against your actuals. However, if they can't be found then they should be carried forward into a future period to ensure accurate recording.
243
+ half-yearly:
244
+ - account: "Assets:Bank"
245
+ from: "2023-04-01"
246
+ transactions:
247
+ - amount: 500
248
+ category: "Expenses:Holiday"
249
+ description: Top up holiday funds
225
250
 
226
- To mark transactions as available for tracking you may use the `track` option in your config file:
251
+ yearly:
252
+ - account: "Assets:Bank"
253
+ from: "2023-04-01"
254
+ transactions:
255
+ - amount: -2000.00
256
+ category: "Income:Bonus"
257
+ description: Annual Bonus
227
258
 
228
- ```yaml
229
259
  once:
230
260
  - account: "Assets:Bank"
231
261
  from: "2023-03-05"
@@ -233,94 +263,97 @@ once:
233
263
  - amount: -3000
234
264
  category: "Expenses:Shopping"
235
265
  description: Refund for that damn laptop
266
+ summary_exclude: true
236
267
  track: true
237
- ```
238
-
239
- > **Note**: This feature has been designed to work with one-off transactions only
240
-
241
- To use this feature, ensure you pass a filepath to the `-t` flag, such as:
242
268
 
243
- hledger-forecast generate -t [journal_file_to_search] -f [path_to_yaml_file] -o [path_to_output_journal]
269
+ custom:
270
+ - account: "Assets:Bank"
271
+ from: "2023-03-01"
272
+ transactions:
273
+ - amount: 80
274
+ category: "Expenses:Personal Care"
275
+ description: Hair and beauty
276
+ frequency: "every 2 weeks"
277
+ roll-up: 26
278
+ - amount: 30
279
+ category: "Expenses:General Expenses"
280
+ description: Misc expenses
281
+ frequency: "every 5 weeks"
282
+ roll-up: 10.4
244
283
 
245
- The app will use a hledger query to determine if the combination of category and amount is present in the periods between the `from` key and the current date in the journal file you've specified. If not, then the app will include it as a forecast transaction in the output file.
284
+ settings:
285
+ currency: USD
286
+ ```
246
287
 
247
- ### Modifiers
288
+ #### Modifiers
248
289
 
249
290
  > **Note**: For modifiers to be included in your hledger reporting, use the `--auto` flag
250
291
 
251
- Within your forecasts, it can be useful to reflect future increases/decreases in certain categories. For example, next year, I expect the cost of groceries to increase by 2%:
292
+ Currently, a YML forecast allows a user to include forecasted % uplifts or downshifts:
252
293
 
253
- ```yaml
294
+ ```yml
254
295
  monthly:
255
- account: "Assets:Bank"
256
- from: "2023-03-05"
257
- transactions:
258
- - amount: 450
259
- category: "Expenses:Groceries"
260
- description: Food shopping
261
- modifiers:
262
- - amount: 0.02
263
- description: "Inflation"
264
- from: "2024-01-01"
265
- to: "2024-12-31"
296
+ - account: "Assets:Bank"
297
+ from: "2023-03-01"
298
+ transactions:
299
+ - amount: 500
300
+ category: "Expenses:Food"
301
+ description: Food
302
+ modifiers:
303
+ - amount: 0.02
304
+ description: "Inflation"
305
+ from: "2024-01-01"
306
+ to: "2024-12-31"
307
+ - amount: 0.05
308
+ description: "Inflation"
309
+ from: "2025-01-01"
310
+ to: "2025-12-31"
266
311
  ```
267
312
 
268
- This will generate an [auto-posting](https://hledger.org/dev/hledger.html#auto-postings) in your forecast which will
269
- uplift any transaction with an `Expenses:Groceries` category.
313
+ This will generate an [auto-posting](https://hledger.org/dev/hledger.html#auto-postings) in your forecast which will uplift any transaction with an `Expenses:Food` category. In the first year the uplift with be 2% and in the following year, 5%.
270
314
 
271
- Of course you may wish to apply 2% for next year and another 3% for the year after:
315
+ #### Additional YML features
272
316
 
273
- ```yaml
274
- # details above omitted for brevity
275
- modifiers:
276
- - amount: 0.02
277
- description: "Inflation"
278
- from: "2024-01-01"
279
- to: "2024-12-31"
280
- - amount: 0.05
281
- description: "Inflation"
282
- from: "2025-01-01"
283
- to: "2025-12-31"
284
- ```
317
+ Dates in a YML file can be constrained by the `to` date in two ways:
285
318
 
286
- ### Roll-ups
287
-
288
- As part of the summarize command, it can be useful to sum-up all of the transactions in your `yaml` file and see what your income and expenditure is over a given period (e.g. "how much profit do I _actually_ make every year when all of my costs are taken into account?").
319
+ ```yml
320
+ monthly:
321
+ - account: "Assets:Bank"
322
+ from: "2023-03-01"
323
+ to: "2025-01-01"
324
+ transactions:
325
+ # details omitted for brevity
326
+ ```
289
327
 
290
- In order to do this, custom forecasts need to have the `roll-up` key defined. That is, given the custom period you've specified, what number do you need to multiply the amount by in order to "roll it up" into an annualised figure. Let's look at the example below:
328
+ or:
291
329
 
292
- ```yaml
293
- custom:
294
- - frequency: "every 2 weeks"
295
- account: "Assets:Bank"
330
+ ```yml
331
+ monthly:
332
+ - account: "Assets:Bank"
296
333
  from: "2023-03-01"
297
- roll-up: 26
298
334
  transactions:
299
- - amount: 80
300
- category: "Expenses:Personal Care"
301
- description: Hair and beauty
335
+ - amount: 2000
336
+ category: "Expenses:Mortgage"
337
+ description: Mortgage
338
+ to: "2025-01-01"
302
339
  ```
303
340
 
304
- Every 2 weeks a planned expense of £80 is made. So over the course of a year, we'd need to multiply that amount by 26 to get to an annualised figure. Of course for periods like `monthly` and `quarterly` it's easy for hledger-forecast to annualise those amounts so no `roll-up` is required.
341
+ ### Tracking
305
342
 
306
- To see the monthly summary of your `yaml` file, the following command can be used:
307
-
308
- hledger-forecast summarize -f my_forecast.yml -r monthly
343
+ > **Note**: Marking a transaction for tracking will ensure that it is only written into the forecast if it isn't found within a specified transaction file
309
344
 
310
- You can also roll-up with the following periods:
345
+ Sometimes it can be useful to track and monitor forecasted transactions to ensure that they are accounted for in any financial projections. If they are present, then these should be discarded from your forecast as this will create a double count against your actuals. However, if they can't be found then they should be carried forward into a future period to ensure accurate recording.
311
346
 
312
- - daily
313
- - weekly
314
- - monthly
315
- - quarterly
316
- - half-yearly
317
- - yearly
347
+ To mark transactions as available for tracking you may use the `track` option in your config file:
318
348
 
319
- ### Summary exclusions
349
+ ```csv
350
+ type,frequency,account,from,to,description,category,amount,roll-up,summary_exclude,track
351
+ once,,Assets:Bank,2023-03-05,,Refund for that damn laptop,Expenses:Shopping,-3000,,,TRUE
352
+ ```
320
353
 
321
- It can be useful to exclude certain items from your summary, like one-off items. This can be achieved by specifying `summary_exclude: true` next to a transaction:
354
+ Or:
322
355
 
323
- ```yaml
356
+ ```yml
324
357
  once:
325
358
  - account: "Assets:Bank"
326
359
  from: "2023-03-05"
@@ -328,37 +361,18 @@ once:
328
361
  - amount: -3000
329
362
  category: "Expenses:Shopping"
330
363
  description: Refund for that damn laptop
331
- summary_exclude: true
332
364
  track: true
333
365
  ```
334
366
 
335
- ### Additional config settings
336
-
337
- Additional settings in the config file to consider:
367
+ > **Note**: This feature has been designed to work with `once` transaction types only
338
368
 
339
- ```yaml
340
- settings:
341
- currency: GBP # Specify the currency to use
342
- show_symbol: true # Show the currency symbol?
343
- thousands_separator: true # Separate thousands with a comma?
344
- ```
345
-
346
- ## :camera_flash: Screenshots
347
-
348
- **Yaml config file and output**
349
-
350
- <img src="https://github.com/olimorris/hledger-forecast/assets/9512444/c3c3222e-f797-4643-bebd-9c94134bee92" alt="Hledger-Forecast" />
351
-
352
- **Summarize command**
353
-
354
- <img src="https://github.com/olimorris/hledger-forecast/assets/9512444/f5017ea2-9606-46ec-8b38-8840dc175e7b" alt="Summarize command" />
369
+ To use this feature, ensure you pass a filepath to the `-t` flag, such as:
355
370
 
356
- ## :paintbrush: Rationale
371
+ hledger-forecast generate -t [journal_file_to_search] -f [path_to_yaml_file] -o [path_to_output_journal]
357
372
 
358
- I moved to hledger from my trusty Excel macro workbook. This thing had been with me for 5+ years. I used it to workout whether I could afford that new gadget and when I'd be in a position to buy a house. I used it to see if I was on track to have £X in my savings accounts by a given date as well as see how much money I could save on a monthly basis. That time I accidentally double counted my bonus or thought I'd accounted for my credit card bill? Painful! Set me back a few months in terms of my savings plans. In summary, I relied _heavily_ on having a detailed and accurate forecast.
373
+ The app will use a hledger query to determine if the combination of category and amount is present in the periods between the `from` key and the current date in the journal file you've specified. If not, then the app will include it as a forecast transaction in the output file.
359
374
 
360
- I love hledger. Switching from Excel has been a breath of fresh air. There's only so many bank transactions a workbook can take before it starts groaning (yes, even on an M1 Mac). However there were a few forecasting features that I missed. The sort of features that in Excel terms mean I'd just copy a bunch of cells and paste them into columns which represented future dates or apply a neat little formula to divide a big number by 12 to get to a monthly repayment. Because I like to plan 3-5 years out at a time, I wanted to crudely account for future price and salary increases. Sure, I can add some auto-postings to the end of my journal file but I bet a lot of users didn't know about this or even know how to constrain them between two dates.
375
+ ## :pencil2: Contributing
361
376
 
362
- I also made an assumption that a lot of users probably think of their finances in terms of their monthly costs (e.g. car payments, mortgage, food), half-yearly costs (e.g. service charge if you have an apartment in the UK) and yearly costs (e.g. holidays, gifts) etc. But likely never do the math to add them all together and workout how much money they have left over by the end of it all. Well I built that into this app and my daily profit figure hit me hard :rofl:. Give it a try!
377
+ I am open to any pull requests that fix bugs but would ask that any new functionality is discussed before it could be accepted.
363
378
 
364
- So I thought I'd share this little Ruby gem in the hope that people find it useful. Perhaps for those who are moving from an Excel based approach to [plain text accounting](https://plaintextaccounting.org), or for those who want a little bit of improvement to the existing capabilities within hledger.
data/example.csv ADDED
@@ -0,0 +1,16 @@
1
+ type,frequency,account,from,to,description,category,amount,roll-up,summary_exclude,track
2
+ monthly,,Assets:Bank,01/03/2023,,Salary,Income:Salary,-3500,,,
3
+ monthly,,Assets:Bank,01/03/2023,01/01/2025,Mortgage,Expenses:Mortgage,2000,,,
4
+ monthly,,Assets:Bank,01/03/2023,,Bills,Expenses:Bills,175,,,
5
+ monthly,,Assets:Bank,01/03/2023,,Food,Expenses:Food,500,,,
6
+ monthly,,Assets:Bank,01/03/2023,,New Kitchen,Expenses:House,=5000/24,,,
7
+ monthly,,Assets:Bank,01/03/2023,=12,Holiday,Expenses:Holiday,125,,,
8
+ monthly,,Assets:Bank,01/03/2023,01/03/2025,Rainy day fund,Assets:Savings,300,,,
9
+ monthly,,Assets:Pension,01/01/2024,,Pension draw down,Income:Pension,-500,,,
10
+ quarterly,,Assets:Bank,01/04/2023,,Quarterly bonus,Income:Bonus,-1000,,,
11
+ half-yearly,,Assets:Bank,01/04/2023,,Top up holiday funds,Expenses:Holiday,500,,,
12
+ yearly,,Assets:Bank,01/04/2023,,Annual bonus,Income:Bonus,-2000,,,
13
+ once,,Assets:Bank,05/03/2023,,Refund for that damn laptop,Expenses:Shopping,-3000,,TRUE,TRUE
14
+ custom,every 2 weeks,Assets:Bank,01/03/2023,,Hair and beauty,Expenses:Personal Care,80,26,,
15
+ custom,every 5 weeks,Assets:Bank,01/03/2023,,Misc expenses,Expenses:General Expenses,30,10.4,,
16
+ settings,currency,USD,,,,,,,,