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 +4 -4
- data/.github/workflows/ci.yml +1 -1
- data/README.md +209 -195
- data/example.csv +16 -0
- data/example.journal +19 -23
- data/example.yml +8 -3
- data/lib/hledger_forecast/calculator.rb +1 -1
- data/lib/hledger_forecast/cli.rb +26 -4
- data/lib/hledger_forecast/csv_parser.rb +106 -0
- data/lib/hledger_forecast/generator.rb +2 -1
- data/lib/hledger_forecast/summarizer.rb +1 -1
- data/lib/hledger_forecast/transactions/default.rb +47 -5
- data/lib/hledger_forecast/transactions/trackers.rb +7 -0
- data/lib/hledger_forecast/version.rb +1 -1
- data/lib/hledger_forecast.rb +2 -1
- data/spec/command_spec.rb +9 -1
- data/spec/csv_and_yml_comparison_spec.rb +32 -0
- data/spec/csv_parser_spec.rb +110 -0
- data/spec/custom_spec.rb +6 -9
- data/spec/stubs/forecast.csv +5 -0
- data/spec/summarizer_spec.rb +7 -7
- data/spec/verbose_output_spec.rb +27 -0
- metadata +13 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5ba12a84909e9d92ac3a9b1b5d977b661131fe6673f8a1c6e73f9ec57d790e2
|
4
|
+
data.tar.gz: 8f7f23fde8f640912eacb23982e198d67bfe83671c43eba6357a1cdde9a87528
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33c532dc9e25ff41c968a1ada59379dbc56a9a0587e2abc4f07acdd10387c88b6f834ec6025dccb44e5ab5f4b3446341e09b947275e540857884728e84b5392a
|
7
|
+
data.tar.gz: 918e5be4d90e1bd52a75436ce0ded33a72e49dd29e9d0a112067eddf2b86693a8ac6c21bd027ed2148d28819e5af432e594a063ca28fdcbe14bceeaee335d283
|
data/.github/workflows/ci.yml
CHANGED
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
|
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
|
-
|
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
|
-
- :
|
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 `
|
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
|
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.
|
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
|
-
|
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
|
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.
|
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
|
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:
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
157
|
+
#### Calculated amounts
|
141
158
|
|
142
|
-
|
159
|
+
> **Note**: Calculations will be determined up to two decimal places
|
143
160
|
|
144
|
-
|
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
|
-
```
|
147
|
-
|
148
|
-
|
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
|
-
|
168
|
+
Simply start the `amount` column with a `=` sign and use standard Excel based math formatting.
|
158
169
|
|
159
|
-
|
170
|
+
#### Calculated dates
|
160
171
|
|
161
|
-
|
172
|
+
It may also be helpful for `to` dates to be calculated:
|
162
173
|
|
163
|
-
|
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
|
-
|
179
|
+
### Settings
|
166
180
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
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
|
-
|
190
|
+
### An example YML forecast
|
191
|
+
|
192
|
+
> **Note**: The app uses `yml` in place of `yaml` by default
|
177
193
|
|
178
|
-
|
194
|
+
Taking the _CSV_ example above and applying it to a _YML_ file:
|
179
195
|
|
180
|
-
```
|
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
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
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
|
-
|
219
|
-
|
220
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
284
|
+
settings:
|
285
|
+
currency: USD
|
286
|
+
```
|
246
287
|
|
247
|
-
|
288
|
+
#### Modifiers
|
248
289
|
|
249
290
|
> **Note**: For modifiers to be included in your hledger reporting, use the `--auto` flag
|
250
291
|
|
251
|
-
|
292
|
+
Currently, a YML forecast allows a user to include forecasted % uplifts or downshifts:
|
252
293
|
|
253
|
-
```
|
294
|
+
```yml
|
254
295
|
monthly:
|
255
|
-
account: "Assets:Bank"
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
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
|
-
|
315
|
+
#### Additional YML features
|
272
316
|
|
273
|
-
|
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
|
-
|
287
|
-
|
288
|
-
|
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
|
-
|
328
|
+
or:
|
291
329
|
|
292
|
-
```
|
293
|
-
|
294
|
-
-
|
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:
|
300
|
-
category: "Expenses:
|
301
|
-
description:
|
335
|
+
- amount: 2000
|
336
|
+
category: "Expenses:Mortgage"
|
337
|
+
description: Mortgage
|
338
|
+
to: "2025-01-01"
|
302
339
|
```
|
303
340
|
|
304
|
-
|
341
|
+
### Tracking
|
305
342
|
|
306
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
354
|
+
Or:
|
322
355
|
|
323
|
-
```
|
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
|
-
|
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
|
-
|
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
|
-
|
371
|
+
hledger-forecast generate -t [journal_file_to_search] -f [path_to_yaml_file] -o [path_to_output_journal]
|
357
372
|
|
358
|
-
|
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
|
-
|
375
|
+
## :pencil2: Contributing
|
361
376
|
|
362
|
-
I
|
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,,,,,,,,
|