;journal: edit the forecasting section (#1250)

This commit is contained in:
Simon Michael 2020-06-04 19:22:04 -07:00
parent d1f62f0f2e
commit 057b79558c

View File

@ -1402,23 +1402,26 @@ So,
### Forecasting with periodic transactions ### Forecasting with periodic transactions
With the `--forecast` flag, each periodic transaction rule generates The `--forecast` flag activates any periodic transaction rules in the journal.
future transactions recurring at the specified interval. They will generate temporary recurring transactions,
These are not saved in the journal, but appear in all reports. which are not saved in the journal, but will appear in all reports
They will look like normal transactions, but with an extra (eg [print](hledger.html#print)).
[tag](journal.html#tags): This can be useful for estimating balances into the future,
or experimenting with different scenarios.
Or, it can be used as a data entry aid: describe recurring
transactions, and every so often copy the output of `print --forecast`
into the journal.
- `generated-transaction:~ PERIODICEXPR` - shows that this was generated by a periodic transaction rule, and the period These transactions will have an extra [tag](journal.html#tags)
indicating which periodic rule generated them:
`generated-transaction:~ PERIODICEXPR`.
And a similar, hidden tag (beginning with an underscore) which,
because it's never displayed by print, can be used to match
transactions generated "just now":
`_generated-transaction:~ PERIODICEXPR`.
There is also a hidden tag, with an underscore prefix, which does not appear in hledger's output: Periodic transactions are generated within some forecast period.
By default, this
- `_generated-transaction:~ PERIODICEXPR`
This can be used to match transactions generated "just now",
rather than generated in the past and saved to the journal.
Forecast transactions start on the first occurrence, and end on the last occurrence,
of their interval within the forecast period. The default forecast period:
- begins on the later of - begins on the later of
- the report start date if specified with -b/-p/date: - the report start date if specified with -b/-p/date:
@ -1426,25 +1429,23 @@ of their interval within the forecast period. The default forecast period:
or today if there are no normal transactions. or today if there are no normal transactions.
- ends on the report end date if specified with -e/-p/date:, - ends on the report end date if specified with -e/-p/date:,
or 180 days from today. or 6 months (180 days) from today.
where "today" means the current date at report time. This means that periodic transactions will begin only after the latest
The "later of" rule ensures that by default forecast transactions do not overlap normal transactions in time; recorded transaction. And a recorded transaction dated in the future can
they will begin only after normal transactions end. If you wish to use your own forecast period, prevent generation of periodic transactions.
you can provied it via `--forecast=PERIODICEXPR`. (You can avoid that by writing the future transaction as a one-time
periodic rule instead - put tilde before the date, eg `~ YYYY-MM-DD ...`).
Forecasting can be useful for estimating balances into the future, Or, you can set your own arbitrary "forecast period", which can
and experimenting with different scenarios. overlap recorded transactions, and need not be in the future, by
Note the start date logic means that forecasted transactions are automatically replaced providing an option argument, like `--forecast=PERIODEXPR`.
by normal transactions as you add those. Note the equals sign is required, a space won't work.
PERIODEXPR is a [period expression](hledger.html#period-expressions),
Forecasting can also help with data entry: which can specify the start date, end date, or both,
describe most of your transactions with periodic rules, like in a [`date:` query](hledger.html#queries).
and every so often copy the output of `print --forecast` to the journal. (See also hledger.1 -> [Report start & end date](hledger.html#report-start-end-date)).
Some examples: `--forecast=202001-202004`, `--forecast=jan-`, `--forecast=2020`.
You can generate one-time transactions too:
just write a period expression specifying a date with no report interval.
(You could also write a normal transaction with a future date, but remember this disables forecast transactions on previous dates.)
### Budgeting with periodic transactions ### Budgeting with periodic transactions