hledger-forecast 1.2.0 → 1.3.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: 21be14ce391292a910e85657b5dd77e6e40648fc06a0c6ffe5d6aaabb8a4a52d
4
- data.tar.gz: 7764b423d46ed8f656af7907374fbdac9519a63b92de6ac0fd8e85db80fdc715
3
+ metadata.gz: ac4e0a16f2b440612fb4596519b02c02d4a88b0d5f9cdb95c0988047a9892c3e
4
+ data.tar.gz: 6f9aed952f65c445d965a9b3dd7ccdb25fdb2c300bdee748ffab51b6a5a5056e
5
5
  SHA512:
6
- metadata.gz: c52628b6b7259c24710e797a38f3bb01cfe85e4c199b26284d0e4aea7a2b2ec42f588cd69607b8a642c6637fd2d9d4a0d625c08e59c522f79bcd04a9a692b69d
7
- data.tar.gz: dc8e7808c9f51444ffbc3d09af9845a2d971f9750cdd07c8210f56e6b84274e3b8a6159d5c09c718586b58d2655d8f463e97471dffe503bc4dddf26ca6557c2f
6
+ metadata.gz: 40eb12f6238c4cc0f8fc37e85a74a6f4e88fbbd12917b07dfd2d305dd47f0cb09e1c999a343744d5766cb03c1484533e67ae6eb3e7ed6a7c3548f5f177eea55e
7
+ data.tar.gz: e09a771caf387bf62d9b09ca58ff59073589edeb0d9cbc3a9523246c31b7172b83869101fe6a020474d501a3b739dbe7a24ac6676a4baafb1380a5fe0c2a84b5
@@ -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,13 +61,13 @@ 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
62
73
  --force Force an overwrite of the output file
@@ -73,159 +84,175 @@ To work with hledger, include the forecast file and use the `--forecast` flag:
73
84
 
74
85
  hledger -f bank_transactions.journal -f forecast.journal --forecast bal assets -e 2024-02
75
86
 
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.
77
-
78
- > **Note**: To apply any modifiers, use the `--auto` flag at the end of your command.
87
+ 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).
79
88
 
80
89
  ### Summarize command
81
90
 
82
- As your `yaml` configuration file grows, it can be helpful to sum up the total amounts and output them to the CLI.
91
+ As your configuration file grows, it can be helpful to sum up the total amounts and output them to the CLI.
83
92
  Furthermore, being able to see your monthly profit and loss statement _if_ you were to purchase that new item may
84
93
  influence your buying decision. In hledger-forecast, this can be achieved by:
85
94
 
86
- hledger-forecast summarize -f my_forecast.yml
95
+ hledger-forecast summarize -f my_forecast.csv
87
96
 
88
97
  The available options are:
89
98
 
90
99
  Usage: hledger-forecast summarize [options]
91
100
 
92
- -f, --forecast FILE The path to the FORECAST yaml file to summarize
101
+ -f, --forecast FILE The path to the FORECAST CSV/YML file to summarize
93
102
  -r, --roll-up PERIOD The period to roll-up your forecasts into. One of:
94
103
  [yearly], [half-yearly], [quarterly], [monthly], [weekly], [daily]
95
104
  -v, --verbose Show additional information in the summary
96
105
  -h, --help Show this help message
97
106
 
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
107
+ ## :gear: Creating your forecast
108
+
109
+ 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.
110
+
111
+ ### Columns
112
+
113
+ The _CSV_ file _should_ contain a header row with the following columns:
114
+
115
+ - `type` - (string) - The type of forecast entry. One of `monthly`, `quarterly`, `half-yearly`, `yearly`, `once` or `custom`
116
+ - `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)
117
+ - `account` - (string) - The account the transaction applies to e.g. _Expenses:Food_
118
+ - `from` - (date) - The date the transaction should start from e.g. _2023-06-01_
119
+ - `to` - (date) _(optional)_ - The date the transaction should end on e.g. _2023-12-31_
120
+ - `description` - (string) - A description of the transaction
121
+ - `category` - (string) - The classification or category of the transaction
122
+ - `amount` - (integer/float) - The amount of the transaction
123
+ - `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
124
+ - `summary_exclude` - (boolean) _(optional)_ - Exclude the transaction from the summarizer?
125
+ - `track` - (boolean) _(optional)_ - Track the transaction against your confirmed transactions?
126
+
127
+ ### An example CSV forecast
128
+
129
+ Putting it together, we end up with a CSV file like:
130
+
131
+ ```csv
132
+ type,frequency,account,from,to,description,category,amount,roll-up,summary_exclude,track
133
+ monthly,,Assets:Bank,01/03/2023,,Salary,Income:Salary,-3500,,,
134
+ monthly,,Assets:Bank,01/03/2023,01/01/2025,Mortgage,Expenses:Mortgage,2000,,,
135
+ monthly,,Assets:Bank,01/03/2023,,Bills,Expenses:Bills,175,,,
136
+ monthly,,Assets:Bank,01/03/2023,,Food,Expenses:Food,500,,,
137
+ monthly,,Assets:Bank,01/03/2023,,New Kitchen,Expenses:House,=5000/24,,,
138
+ monthly,,Assets:Bank,01/03/2023,=12,Holiday,Expenses:Holiday,125,,,
139
+ monthly,,Assets:Bank,01/03/2023,01/03/2025,Rainy day fund,Assets:Savings,300,,,
140
+ monthly,,Assets:Pension,01/01/2024,,Pension draw down,Income:Pension,-500,,,
141
+ quarterly,,Assets:Bank,01/04/2023,,Quarterly bonus,Income:Bonus,-1000,,,
142
+ half-yearly,,Assets:Bank,01/04/2023,,Top up holiday funds,Expenses:Holiday,500,,,
143
+ yearly,,Assets:Bank,01/04/2023,,Annual bonus,Income:Bonus,-2000,,,
144
+ once,,Assets:Bank,05/03/2023,,Refund for that damn laptop,Expenses:Shopping,-3000,,TRUE,TRUE
145
+ custom,every 2 weeks,Assets:Bank,01/03/2023,,Hair and beauty,Expenses:Personal Care,80,26,,
146
+ custom,every 5 weeks,Assets:Bank,01/03/2023,,Misc expenses,Expenses:General Expenses,30,10.4,,
147
+ settings,currency,USD,,,,,,,,
121
148
  ```
122
149
 
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:
150
+ ### Additional features
133
151
 
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_
152
+ From the example above, there are a few additional features that may be useful.
139
153
 
140
- These will write periodic transactions such as `~ every 3 months` or `~ every year` in the output journal file.
154
+ #### Calculated amounts
141
155
 
142
- #### Custom period
156
+ > **Note**: Calculations will be determined up to two decimal places
143
157
 
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):
158
+ 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
159
 
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
160
+ ```csv
161
+ type,frequency,account,from,to,description,category,amount,roll-up,summary_exclude,track
162
+ monthly,,Assets:Bank,01/03/2023,,New Kitchen,Expenses:House,=5000/24,,,
155
163
  ```
156
164
 
157
- ### Dates
165
+ Simply start the `amount` column with a `=` sign and use standard Excel based math formatting.
158
166
 
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).
167
+ #### Calculated dates
160
168
 
161
- You can further control the dates at a period/top-level as well as at a transaction level:
169
+ It may also be helpful for `to` dates to be calculated:
162
170
 
163
- #### Top level
171
+ ```csv
172
+ type,frequency,account,from,to,description,category,amount,roll-up,summary_exclude,track
173
+ monthly,,Assets:Bank,01/03/2023,=12,Holiday,Expenses:Holiday,125,,,
174
+ ```
164
175
 
165
- In the example below, all transactions in the `monthly` block will be constrained by the `to` date:
176
+ ### Settings
166
177
 
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
178
+ There are also additional settings that can be applied in the forecast. The defaults are:
179
+
180
+ ```csv
181
+ type,frequency,account,from,to,description,category,amount,roll-up,summary_exclude,track
182
+ settings,currency,USD,,,,,,,,
183
+ settings,show_symbol,true,,,,,,,,
184
+ settings,thousands_separator,true,,,,,,,,
174
185
  ```
175
186
 
176
- #### Transaction level
187
+ ### An example YML forecast
188
+
189
+ > **Note**: The app uses `yml` in place of `yaml` by default
177
190
 
178
- In the example below, only the single transaction will be constrained by the `to` date:
191
+ Taking the _CSV_ example above and applying it to a _YML_ file:
179
192
 
180
- ```yaml
193
+ ```yml
181
194
  monthly:
182
195
  - account: "Assets:Bank"
183
196
  from: "2023-03-01"
184
197
  transactions:
198
+ - amount: -3500
199
+ category: "Income:Salary"
200
+ description: Salary
185
201
  - amount: 2000
186
202
  category: "Expenses:Mortgage"
187
203
  description: Mortgage
188
204
  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:
205
+ - amount: 175
206
+ category: "Expenses:Bills"
207
+ description: Bills
208
+ - amount: 500
209
+ category: "Expenses:Food"
210
+ description: Food
213
211
  - amount: "=5000/24"
214
212
  category: "Expenses:House"
215
213
  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
214
+ - amount: 125
215
+ category: "Expenses:Holiday"
216
+ description: Holiday
217
+ to: "=12"
218
+ - account: "Assets:Bank"
219
+ from: "2023-03-01"
220
+ to: "2025-01-01"
221
+ transactions:
222
+ - amount: 300
223
+ category: "Assets:Savings"
224
+ description: "Rainy day fund"
225
+ - account: "Assets:Pension"
226
+ from: "2024-01-01"
227
+ transactions:
228
+ - amount: -500
229
+ category: "Income:Pension"
230
+ description: Pension draw down
221
231
 
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
232
+ quarterly:
233
+ - account: "Assets:Bank"
234
+ from: "2023-04-01"
235
+ transactions:
236
+ - amount: -1000.00
237
+ category: "Income:Bonus"
238
+ description: Quarterly bonus
223
239
 
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.
240
+ half-yearly:
241
+ - account: "Assets:Bank"
242
+ from: "2023-04-01"
243
+ transactions:
244
+ - amount: 500
245
+ category: "Expenses:Holiday"
246
+ description: Top up holiday funds
225
247
 
226
- To mark transactions as available for tracking you may use the `track` option in your config file:
248
+ yearly:
249
+ - account: "Assets:Bank"
250
+ from: "2023-04-01"
251
+ transactions:
252
+ - amount: -2000.00
253
+ category: "Income:Bonus"
254
+ description: Annual Bonus
227
255
 
228
- ```yaml
229
256
  once:
230
257
  - account: "Assets:Bank"
231
258
  from: "2023-03-05"
@@ -233,94 +260,97 @@ once:
233
260
  - amount: -3000
234
261
  category: "Expenses:Shopping"
235
262
  description: Refund for that damn laptop
263
+ summary_exclude: true
236
264
  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
265
 
243
- hledger-forecast generate -t [journal_file_to_search] -f [path_to_yaml_file] -o [path_to_output_journal]
266
+ custom:
267
+ - account: "Assets:Bank"
268
+ from: "2023-03-01"
269
+ transactions:
270
+ - amount: 80
271
+ category: "Expenses:Personal Care"
272
+ description: Hair and beauty
273
+ frequency: "every 2 weeks"
274
+ roll-up: 26
275
+ - amount: 30
276
+ category: "Expenses:General Expenses"
277
+ description: Misc expenses
278
+ frequency: "every 5 weeks"
279
+ roll-up: 10.4
244
280
 
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.
281
+ settings:
282
+ currency: USD
283
+ ```
246
284
 
247
- ### Modifiers
285
+ #### Modifiers
248
286
 
249
287
  > **Note**: For modifiers to be included in your hledger reporting, use the `--auto` flag
250
288
 
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%:
289
+ Currently, a YML forecast allows a user to include forecasted % uplifts or downshifts:
252
290
 
253
- ```yaml
291
+ ```yml
254
292
  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"
293
+ - account: "Assets:Bank"
294
+ from: "2023-03-01"
295
+ transactions:
296
+ - amount: 500
297
+ category: "Expenses:Food"
298
+ description: Food
299
+ modifiers:
300
+ - amount: 0.02
301
+ description: "Inflation"
302
+ from: "2024-01-01"
303
+ to: "2024-12-31"
304
+ - amount: 0.05
305
+ description: "Inflation"
306
+ from: "2025-01-01"
307
+ to: "2025-12-31"
266
308
  ```
267
309
 
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.
310
+ 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
311
 
271
- Of course you may wish to apply 2% for next year and another 3% for the year after:
312
+ #### Additional YML features
272
313
 
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
- ```
314
+ Dates in a YML file can be constrained by the `to` date in two ways:
285
315
 
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?").
316
+ ```yml
317
+ monthly:
318
+ - account: "Assets:Bank"
319
+ from: "2023-03-01"
320
+ to: "2025-01-01"
321
+ transactions:
322
+ # details omitted for brevity
323
+ ```
289
324
 
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:
325
+ or:
291
326
 
292
- ```yaml
293
- custom:
294
- - frequency: "every 2 weeks"
295
- account: "Assets:Bank"
327
+ ```yml
328
+ monthly:
329
+ - account: "Assets:Bank"
296
330
  from: "2023-03-01"
297
- roll-up: 26
298
331
  transactions:
299
- - amount: 80
300
- category: "Expenses:Personal Care"
301
- description: Hair and beauty
332
+ - amount: 2000
333
+ category: "Expenses:Mortgage"
334
+ description: Mortgage
335
+ to: "2025-01-01"
302
336
  ```
303
337
 
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.
305
-
306
- To see the monthly summary of your `yaml` file, the following command can be used:
338
+ ### Tracking
307
339
 
308
- hledger-forecast summarize -f my_forecast.yml -r monthly
340
+ > **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
341
 
310
- You can also roll-up with the following periods:
342
+ 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
343
 
312
- - daily
313
- - weekly
314
- - monthly
315
- - quarterly
316
- - half-yearly
317
- - yearly
344
+ To mark transactions as available for tracking you may use the `track` option in your config file:
318
345
 
319
- ### Summary exclusions
346
+ ```csv
347
+ type,frequency,account,from,to,description,category,amount,roll-up,summary_exclude,track
348
+ once,,Assets:Bank,2023-03-05,,Refund for that damn laptop,Expenses:Shopping,-3000,,,TRUE
349
+ ```
320
350
 
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:
351
+ Or:
322
352
 
323
- ```yaml
353
+ ```yml
324
354
  once:
325
355
  - account: "Assets:Bank"
326
356
  from: "2023-03-05"
@@ -328,37 +358,18 @@ once:
328
358
  - amount: -3000
329
359
  category: "Expenses:Shopping"
330
360
  description: Refund for that damn laptop
331
- summary_exclude: true
332
361
  track: true
333
362
  ```
334
363
 
335
- ### Additional config settings
336
-
337
- Additional settings in the config file to consider:
338
-
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
- ```
364
+ > **Note**: This feature has been designed to work with `once` transaction types only
345
365
 
346
- ## :camera_flash: Screenshots
347
-
348
- **Yaml config file and output**
349
-
350
- <img src="https://user-images.githubusercontent.com/9512444/234382872-b81ac84d-2bcc-4488-a041-364f72627087.png" alt="Hledger-Forecast" />
351
-
352
- **Summarize command**
353
-
354
- <img src="https://user-images.githubusercontent.com/9512444/234386807-1301c8d9-af77-4f58-a3c3-a345b5e890a2.png" alt="Summarize command" />
366
+ To use this feature, ensure you pass a filepath to the `-t` flag, such as:
355
367
 
356
- ## :paintbrush: Rationale
368
+ hledger-forecast generate -t [journal_file_to_search] -f [path_to_yaml_file] -o [path_to_output_journal]
357
369
 
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.
370
+ 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
371
 
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.
372
+ ## :pencil2: Contributing
361
373
 
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!
374
+ 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
375
 
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,,,,,,,,