;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
With the `--forecast` flag, each periodic transaction rule generates
future transactions recurring at the specified interval.
These are not saved in the journal, but appear in all reports.
They will look like normal transactions, but with an extra
[tag](journal.html#tags):
The `--forecast` flag activates any periodic transaction rules in the journal.
They will generate temporary recurring transactions,
which are not saved in the journal, but will appear in all reports
(eg [print](hledger.html#print)).
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:
- `_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:
Periodic transactions are generated within some forecast period.
By default, this
- begins on the later of
- 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.
- 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.
The "later of" rule ensures that by default forecast transactions do not overlap normal transactions in time;
they will begin only after normal transactions end. If you wish to use your own forecast period,
you can provied it via `--forecast=PERIODICEXPR`.
This means that periodic transactions will begin only after the latest
recorded transaction. And a recorded transaction dated in the future can
prevent generation of periodic transactions.
(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,
and experimenting with different scenarios.
Note the start date logic means that forecasted transactions are automatically replaced
by normal transactions as you add those.
Forecasting can also help with data entry:
describe most of your transactions with periodic rules,
and every so often copy the output of `print --forecast` to the journal.
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.)
Or, you can set your own arbitrary "forecast period", which can
overlap recorded transactions, and need not be in the future, by
providing an option argument, like `--forecast=PERIODEXPR`.
Note the equals sign is required, a space won't work.
PERIODEXPR is a [period expression](hledger.html#period-expressions),
which can specify the start date, end date, or both,
like in a [`date:` query](hledger.html#queries).
(See also hledger.1 -> [Report start & end date](hledger.html#report-start-end-date)).
Some examples: `--forecast=202001-202004`, `--forecast=jan-`, `--forecast=2020`.
### Budgeting with periodic transactions