doc: move cost/market value into general options section

[ci skip]
This commit is contained in:
Simon Michael 2017-03-31 19:17:56 -07:00
parent 2f5c9df0de
commit d9488ea01b
9 changed files with 581 additions and 558 deletions

View File

@ -540,8 +540,8 @@ Market prices are not tied to a particular transaction; they represent
historical exchange rates between two commodities. historical exchange rates between two commodities.
(Ledger calls them historical prices.) For example, the prices published (Ledger calls them historical prices.) For example, the prices published
by a stock exchange or the foreign exchange market. by a stock exchange or the foreign exchange market.
Some commands (balance, currently) can use this information to show the hledger can use these prices to show the market value of things at a
market value of things at a given date. given date, see market value.
.PP .PP
To record market prices, use P directives in the main journal or in an To record market prices, use P directives in the main journal or in an
included file. included file.

View File

@ -540,9 +540,8 @@ File: hledger_journal.5.info, Node: Market prices, Prev: Transaction prices,
Market prices are not tied to a particular transaction; they represent Market prices are not tied to a particular transaction; they represent
historical exchange rates between two commodities. (Ledger calls them historical exchange rates between two commodities. (Ledger calls them
historical prices.) For example, the prices published by a stock historical prices.) For example, the prices published by a stock
exchange or the foreign exchange market. Some commands (balance, exchange or the foreign exchange market. hledger can use these prices
currently) can use this information to show the market value of things to show the market value of things at a given date, see market value.
at a given date.
To record market prices, use P directives in the main journal or in To record market prices, use P directives in the main journal or in
an included file. Their format is: an included file. Their format is:
@ -1005,39 +1004,39 @@ Node: Transaction prices18256
Ref: #transaction-prices18401 Ref: #transaction-prices18401
Node: Market prices19978 Node: Market prices19978
Ref: #market-prices20113 Ref: #market-prices20113
Node: Comments21086 Node: Comments21073
Ref: #comments21208 Ref: #comments21195
Node: Tags22321 Node: Tags22308
Ref: #tags22441 Ref: #tags22428
Node: Implicit tags23870 Node: Implicit tags23857
Ref: #implicit-tags23978 Ref: #implicit-tags23965
Node: Directives24495 Node: Directives24482
Ref: #directives24610 Ref: #directives24597
Node: Account aliases24803 Node: Account aliases24790
Ref: #account-aliases24949 Ref: #account-aliases24936
Node: Basic aliases25553 Node: Basic aliases25540
Ref: #basic-aliases25698 Ref: #basic-aliases25685
Node: Regex aliases26388 Node: Regex aliases26375
Ref: #regex-aliases26558 Ref: #regex-aliases26545
Node: Multiple aliases27329 Node: Multiple aliases27316
Ref: #multiple-aliases27503 Ref: #multiple-aliases27490
Node: end aliases28001 Node: end aliases27988
Ref: #end-aliases28143 Ref: #end-aliases28130
Node: account directive28244 Node: account directive28231
Ref: #account-directive28426 Ref: #account-directive28413
Node: apply account directive28722 Node: apply account directive28709
Ref: #apply-account-directive28920 Ref: #apply-account-directive28907
Node: Multi-line comments29579 Node: Multi-line comments29566
Ref: #multi-line-comments29771 Ref: #multi-line-comments29758
Node: commodity directive29899 Node: commodity directive29886
Ref: #commodity-directive30085 Ref: #commodity-directive30072
Node: Default commodity30957 Node: Default commodity30944
Ref: #default-commodity31132 Ref: #default-commodity31119
Node: Default year31669 Node: Default year31656
Ref: #default-year31836 Ref: #default-year31823
Node: Including other files32259 Node: Including other files32246
Ref: #including-other-files32418 Ref: #including-other-files32405
Node: EDITOR SUPPORT32815 Node: EDITOR SUPPORT32802
Ref: #editor-support32935 Ref: #editor-support32922
 
End Tag Table End Tag Table

View File

@ -442,7 +442,7 @@ Market prices are not tied to a particular transaction; they represent historica
(Ledger calls them historical prices.) (Ledger calls them historical prices.)
For example, the prices published by a [stock exchange](https://en.wikipedia.org/wiki/Stock_exchange) For example, the prices published by a [stock exchange](https://en.wikipedia.org/wiki/Stock_exchange)
or the [foreign exchange market](https://en.wikipedia.org/wiki/Foreign_exchange_market). or the [foreign exchange market](https://en.wikipedia.org/wiki/Foreign_exchange_market).
Some commands ([balance](hledger.html#market-value), currently) can use this information to show the market value of things at a given date. hledger can use these prices to show the market value of things at a given date, see [market value](#market-value).
To record market prices, use P directives in the main journal or To record market prices, use P directives in the main journal or
in an [included](#including-other-files) file. Their format is: in an [included](#including-other-files) file. Their format is:

View File

@ -411,9 +411,8 @@ FILE FORMAT
Market prices are not tied to a particular transaction; they represent Market prices are not tied to a particular transaction; they represent
historical exchange rates between two commodities. (Ledger calls them historical exchange rates between two commodities. (Ledger calls them
historical prices.) For example, the prices published by a stock historical prices.) For example, the prices published by a stock
exchange or the foreign exchange market. Some commands (balance, cur- exchange or the foreign exchange market. hledger can use these prices
rently) can use this information to show the market value of things at to show the market value of things at a given date, see market value.
a given date.
To record market prices, use P directives in the main journal or in an To record market prices, use P directives in the main journal or in an
included file. Their format is: included file. Their format is:

View File

@ -233,53 +233,6 @@ Balance changes in 2008:
``` ```
### Market value
The `-V/--value` flag converts the reported amounts to their market value
on the report end date, using the most recent applicable market prices,
when known.
Specifically, when there is a [market price](journal.html#market-prices) (P directive)
for the amount's commodity, dated on or before the
[report end date](hledger.html#report-start-end-date) (see hledger -> Report start & end date),
the amount will be converted to the price's commodity.
If multiple applicable prices are defined, the latest-dated one is used
(and if dates are equal, the one last parsed).
For example:
```journal
# one euro is worth this many dollars from nov 1
P 2016/11/01 € $1.10
# purchase some euros on nov 3
2016/11/3
assets:euros €100
assets:checking
# the euro is worth fewer dollars by dec 21
P 2016/12/21 € $1.03
```
How many euros do I have ?
```
$ hledger -f t.j bal euros
€100 assets:euros
```
What are they worth on nov 3 ? (no report end date specified, defaults to the last date in the journal)
```
$ hledger -f t.j bal euros -V
$110.00 assets:euros
```
What are they worth on dec 21 ?
```
$ hledger -f t.j bal euros -V -e 2016/12/21
$103.00 assets:euros
```
Currently, hledger's -V only uses market prices recorded with P directives,
not [transaction prices](journal.html#transaction-prices) (unlike Ledger).
Using -B and -V together is allowed.
### Custom balance output ### Custom balance output
In simple (non-multi-column) balance reports, you can customise the In simple (non-multi-column) balance reports, you can customise the

View File

@ -840,6 +840,71 @@ $\ hledger\ balance\ \-\-pivot\ member\ acct:.
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \-2\ EUR \ \ \ \ \ \ \ \ \ \ \ \ \ \ \-2\ EUR
\f[] \f[]
.fi .fi
.SS Cost
.PP
The \f[C]\-B/\-\-cost\f[] flag converts amounts to their cost at
transaction time, if they have a transaction price specified.
.SS Market value
.PP
The \f[C]\-V/\-\-value\f[] flag converts the reported amounts to their
market value on the report end date, using the most recent applicable
market prices, when known.
Specifically, when there is a market price (P directive) for the
amount\[aq]s commodity, dated on or before the report end date (see
hledger \-> Report start & end date), the amount will be converted to
the price\[aq]s commodity.
If multiple applicable prices are defined, the latest\-dated one is used
(and if dates are equal, the one last parsed).
.PP
For example:
.IP
.nf
\f[C]
#\ one\ euro\ is\ worth\ this\ many\ dollars\ from\ nov\ 1
P\ 2016/11/01\ \ $1.10
#\ purchase\ some\ euros\ on\ nov\ 3
2016/11/3
\ \ \ \ assets:euros\ \ \ \ \ \ \ \ €100
\ \ \ \ assets:checking
#\ the\ euro\ is\ worth\ fewer\ dollars\ by\ dec\ 21
P\ 2016/12/21\ \ $1.03
\f[]
.fi
.PP
How many euros do I have ?
.IP
.nf
\f[C]
$\ hledger\ \-f\ t.j\ bal\ euros
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ €100\ \ assets:euros
\f[]
.fi
.PP
What are they worth on nov 3 ?
(no report end date specified, defaults to the last date in the journal)
.IP
.nf
\f[C]
$\ hledger\ \-f\ t.j\ bal\ euros\ \-V
\ \ \ \ \ \ \ \ \ \ \ \ \ $110.00\ \ assets:euros
\f[]
.fi
.PP
What are they worth on dec 21 ?
.IP
.nf
\f[C]
$\ hledger\ \-f\ t.j\ bal\ euros\ \-V\ \-e\ 2016/12/21
\ \ \ \ \ \ \ \ \ \ \ \ \ $103.00\ \ assets:euros
\f[]
.fi
.PP
Currently, hledger\[aq]s \-V only uses market prices recorded with P
directives, not transaction prices (unlike Ledger).
.PP
Using \-B and \-V together is allowed.
.SS Regular expressions .SS Regular expressions
.PP .PP
hledger uses regular expressions in a number of places: hledger uses regular expressions in a number of places:
@ -1494,67 +1559,6 @@ Balance\ changes\ in\ 2008:
#\ Average\ is\ rounded\ to\ the\ dollar\ here\ since\ all\ journal\ amounts\ are #\ Average\ is\ rounded\ to\ the\ dollar\ here\ since\ all\ journal\ amounts\ are
\f[] \f[]
.fi .fi
.SS Market value
.PP
The \f[C]\-V/\-\-value\f[] flag converts the reported amounts to their
market value on the report end date, using the most recent applicable
market prices, when known.
Specifically, when there is a market price (P directive) for the
amount\[aq]s commodity, dated on or before the report end date (see
hledger \-> Report start & end date), the amount will be converted to
the price\[aq]s commodity.
If multiple applicable prices are defined, the latest\-dated one is used
(and if dates are equal, the one last parsed).
.PP
For example:
.IP
.nf
\f[C]
#\ one\ euro\ is\ worth\ this\ many\ dollars\ from\ nov\ 1
P\ 2016/11/01\ \ $1.10
#\ purchase\ some\ euros\ on\ nov\ 3
2016/11/3
\ \ \ \ assets:euros\ \ \ \ \ \ \ \ €100
\ \ \ \ assets:checking
#\ the\ euro\ is\ worth\ fewer\ dollars\ by\ dec\ 21
P\ 2016/12/21\ \ $1.03
\f[]
.fi
.PP
How many euros do I have ?
.IP
.nf
\f[C]
$\ hledger\ \-f\ t.j\ bal\ euros
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ €100\ \ assets:euros
\f[]
.fi
.PP
What are they worth on nov 3 ?
(no report end date specified, defaults to the last date in the journal)
.IP
.nf
\f[C]
$\ hledger\ \-f\ t.j\ bal\ euros\ \-V
\ \ \ \ \ \ \ \ \ \ \ \ \ $110.00\ \ assets:euros
\f[]
.fi
.PP
What are they worth on dec 21 ?
.IP
.nf
\f[C]
$\ hledger\ \-f\ t.j\ bal\ euros\ \-V\ \-e\ 2016/12/21
\ \ \ \ \ \ \ \ \ \ \ \ \ $103.00\ \ assets:euros
\f[]
.fi
.PP
Currently, hledger\[aq]s \-V only uses market prices recorded with P
directives, not transaction prices (unlike Ledger).
.PP
Using \-B and \-V together is allowed.
.SS Custom balance output .SS Custom balance output
.PP .PP
In simple (non\-multi\-column) balance reports, you can customise the In simple (non\-multi\-column) balance reports, you can customise the

View File

@ -126,6 +126,8 @@ File: hledger.1.info, Node: OPTIONS, Next: QUERIES, Prev: EXAMPLES, Up: Top
* Period expressions:: * Period expressions::
* Depth limiting:: * Depth limiting::
* Pivoting:: * Pivoting::
* Cost::
* Market value::
* Regular expressions:: * Regular expressions::
 
@ -508,7 +510,7 @@ will show only the uppermost accounts in the account tree, down to level
N. Use this when you want a summary with less detail. N. Use this when you want a summary with less detail.
 
File: hledger.1.info, Node: Pivoting, Next: Regular expressions, Prev: Depth limiting, Up: OPTIONS File: hledger.1.info, Node: Pivoting, Next: Cost, Prev: Depth limiting, Up: OPTIONS
2.11 Pivoting 2.11 Pivoting
============= =============
@ -568,9 +570,67 @@ $ hledger balance --pivot member acct:.
-2 EUR -2 EUR
 
File: hledger.1.info, Node: Regular expressions, Prev: Pivoting, Up: OPTIONS File: hledger.1.info, Node: Cost, Next: Market value, Prev: Pivoting, Up: OPTIONS
2.12 Regular expressions 2.12 Cost
=========
The '-B/--cost' flag converts amounts to their cost at transaction time,
if they have a transaction price specified.

File: hledger.1.info, Node: Market value, Next: Regular expressions, Prev: Cost, Up: OPTIONS
2.13 Market value
=================
The '-V/--value' flag converts the reported amounts to their market
value on the report end date, using the most recent applicable market
prices, when known. Specifically, when there is a market price (P
directive) for the amount's commodity, dated on or before the report end
date (see hledger -> Report start & end date), the amount will be
converted to the price's commodity. If multiple applicable prices are
defined, the latest-dated one is used (and if dates are equal, the one
last parsed).
For example:
# one euro is worth this many dollars from nov 1
P 2016/11/01 € $1.10
# purchase some euros on nov 3
2016/11/3
assets:euros €100
assets:checking
# the euro is worth fewer dollars by dec 21
P 2016/12/21 € $1.03
How many euros do I have ?
$ hledger -f t.j bal euros
€100 assets:euros
What are they worth on nov 3 ? (no report end date specified,
defaults to the last date in the journal)
$ hledger -f t.j bal euros -V
$110.00 assets:euros
What are they worth on dec 21 ?
$ hledger -f t.j bal euros -V -e 2016/12/21
$103.00 assets:euros
Currently, hledger's -V only uses market prices recorded with P
directives, not transaction prices (unlike Ledger).
Using -B and -V together is allowed.

File: hledger.1.info, Node: Regular expressions, Prev: Market value, Up: OPTIONS
2.14 Regular expressions
======================== ========================
hledger uses regular expressions in a number of places: hledger uses regular expressions in a number of places:
@ -999,7 +1059,6 @@ $ hledger balance -p 2008/6 expenses --no-total
* Flat mode:: * Flat mode::
* Depth limited balance reports:: * Depth limited balance reports::
* Multicolumn balance reports:: * Multicolumn balance reports::
* Market value::
* Custom balance output:: * Custom balance output::
* Output destination:: * Output destination::
* CSV output:: * CSV output::
@ -1038,7 +1097,7 @@ $ hledger balance -N --depth 1
$1 liabilities $1 liabilities
 
File: hledger.1.info, Node: Multicolumn balance reports, Next: Market value, Prev: Depth limited balance reports, Up: balance File: hledger.1.info, Node: Multicolumn balance reports, Next: Custom balance output, Prev: Depth limited balance reports, Up: balance
4.4.3 Multicolumn balance reports 4.4.3 Multicolumn balance reports
--------------------------------- ---------------------------------
@ -1138,58 +1197,9 @@ Balance changes in 2008:
# Average is rounded to the dollar here since all journal amounts are # Average is rounded to the dollar here since all journal amounts are
 
File: hledger.1.info, Node: Market value, Next: Custom balance output, Prev: Multicolumn balance reports, Up: balance File: hledger.1.info, Node: Custom balance output, Next: Output destination, Prev: Multicolumn balance reports, Up: balance
4.4.4 Market value 4.4.4 Custom balance output
------------------
The '-V/--value' flag converts the reported amounts to their market
value on the report end date, using the most recent applicable market
prices, when known. Specifically, when there is a market price (P
directive) for the amount's commodity, dated on or before the report end
date (see hledger -> Report start & end date), the amount will be
converted to the price's commodity. If multiple applicable prices are
defined, the latest-dated one is used (and if dates are equal, the one
last parsed).
For example:
# one euro is worth this many dollars from nov 1
P 2016/11/01 € $1.10
# purchase some euros on nov 3
2016/11/3
assets:euros €100
assets:checking
# the euro is worth fewer dollars by dec 21
P 2016/12/21 € $1.03
How many euros do I have ?
$ hledger -f t.j bal euros
€100 assets:euros
What are they worth on nov 3 ? (no report end date specified,
defaults to the last date in the journal)
$ hledger -f t.j bal euros -V
$110.00 assets:euros
What are they worth on dec 21 ?
$ hledger -f t.j bal euros -V -e 2016/12/21
$103.00 assets:euros
Currently, hledger's -V only uses market prices recorded with P
directives, not transaction prices (unlike Ledger).
Using -B and -V together is allowed.

File: hledger.1.info, Node: Custom balance output, Next: Output destination, Prev: Market value, Up: balance
4.4.5 Custom balance output
--------------------------- ---------------------------
In simple (non-multi-column) balance reports, you can customise the In simple (non-multi-column) balance reports, you can customise the
@ -1249,7 +1259,7 @@ may be needed to get pleasing results.
 
File: hledger.1.info, Node: Output destination, Next: CSV output, Prev: Custom balance output, Up: balance File: hledger.1.info, Node: Output destination, Next: CSV output, Prev: Custom balance output, Up: balance
4.4.6 Output destination 4.4.5 Output destination
------------------------ ------------------------
The balance, print, register and stats commands can write their output The balance, print, register and stats commands can write their output
@ -1262,7 +1272,7 @@ $ hledger balance -o FILE # write to FILE
 
File: hledger.1.info, Node: CSV output, Prev: Output destination, Up: balance File: hledger.1.info, Node: CSV output, Prev: Output destination, Up: balance
4.4.7 CSV output 4.4.6 CSV output
---------------- ----------------
The balance, print and register commands can write their output as CSV. The balance, print and register commands can write their output as CSV.
@ -2094,121 +2104,123 @@ Node: EXAMPLES1886
Ref: #examples1988 Ref: #examples1988
Node: OPTIONS3634 Node: OPTIONS3634
Ref: #options3738 Ref: #options3738
Node: General options3993 Node: General options4019
Ref: #general-options4120 Ref: #general-options4146
Node: Command options6643 Node: Command options6669
Ref: #command-options6796 Ref: #command-options6822
Node: Command arguments7194 Node: Command arguments7220
Ref: #command-arguments7354 Ref: #command-arguments7380
Node: Special characters7475 Node: Special characters7501
Ref: #special-characters7633 Ref: #special-characters7659
Node: Input files8801 Node: Input files8827
Ref: #input-files8939 Ref: #input-files8965
Node: Smart dates10902 Node: Smart dates10928
Ref: #smart-dates11045 Ref: #smart-dates11071
Node: Report start & end date12024 Node: Report start & end date12050
Ref: #report-start-end-date12196 Ref: #report-start-end-date12222
Node: Report intervals13262 Node: Report intervals13288
Ref: #report-intervals13427 Ref: #report-intervals13453
Node: Period expressions13828 Node: Period expressions13854
Ref: #period-expressions13988 Ref: #period-expressions14014
Node: Depth limiting16328 Node: Depth limiting16354
Ref: #depth-limiting16474 Ref: #depth-limiting16500
Node: Pivoting16675 Node: Pivoting16701
Ref: #pivoting16810 Ref: #pivoting16821
Node: Regular expressions18581 Node: Cost18592
Ref: #regular-expressions18715 Ref: #cost18702
Node: QUERIES20076 Node: Market value18820
Ref: #queries20180 Ref: #market-value18957
Node: COMMANDS23826 Node: Regular expressions20257
Ref: #commands23940 Ref: #regular-expressions20395
Node: accounts24613 Node: QUERIES21756
Ref: #accounts24713 Ref: #queries21860
Node: activity25695 Node: COMMANDS25506
Ref: #activity25807 Ref: #commands25620
Node: add26166 Node: accounts26293
Ref: #add26267 Ref: #accounts26393
Node: balance28925 Node: activity27375
Ref: #balance29038 Ref: #activity27487
Node: Flat mode31980 Node: add27846
Ref: #flat-mode32107 Ref: #add27947
Node: Depth limited balance reports32527 Node: balance30605
Ref: #depth-limited-balance-reports32730 Ref: #balance30718
Node: Multicolumn balance reports33150 Node: Flat mode33643
Ref: #multicolumn-balance-reports33352 Ref: #flat-mode33770
Node: Market value38000 Node: Depth limited balance reports34190
Ref: #market-value38164 Ref: #depth-limited-balance-reports34393
Node: Custom balance output39464 Node: Multicolumn balance reports34813
Ref: #custom-balance-output39637 Ref: #multicolumn-balance-reports35024
Node: Output destination41730 Node: Custom balance output39672
Ref: #output-destination41895 Ref: #custom-balance-output39860
Node: CSV output42165 Node: Output destination41953
Ref: #csv-output42284 Ref: #output-destination42118
Node: balancesheet42681 Node: CSV output42388
Ref: #balancesheet42809 Ref: #csv-output42507
Node: cashflow44716 Node: balancesheet42904
Ref: #cashflow44833 Ref: #balancesheet43032
Node: help46701 Node: cashflow44939
Ref: #help46813 Ref: #cashflow45056
Node: incomestatement47651 Node: help46924
Ref: #incomestatement47781 Ref: #help47036
Node: info49673 Node: incomestatement47874
Ref: #info49780 Ref: #incomestatement48004
Node: man50144 Node: info49896
Ref: #man50241 Ref: #info50003
Node: print50646 Node: man50367
Ref: #print50751 Ref: #man50464
Node: register54507 Node: print50869
Ref: #register54620 Ref: #print50974
Node: Custom register output59116 Node: register54730
Ref: #custom-register-output59247 Ref: #register54843
Node: stats60544 Node: Custom register output59339
Ref: #stats60650 Ref: #custom-register-output59470
Node: test61531 Node: stats60767
Ref: #test61618 Ref: #stats60873
Node: ADD-ON COMMANDS61986 Node: test61754
Ref: #add-on-commands62098 Ref: #test61841
Node: Official add-ons63385 Node: ADD-ON COMMANDS62209
Ref: #official-add-ons63527 Ref: #add-on-commands62321
Node: api63614 Node: Official add-ons63608
Ref: #api63705 Ref: #official-add-ons63750
Node: ui63757 Node: api63837
Ref: #ui63858 Ref: #api63928
Node: web63916 Node: ui63980
Ref: #web64007 Ref: #ui64081
Node: Third party add-ons64053 Node: web64139
Ref: #third-party-add-ons64230 Ref: #web64230
Node: diff64365 Node: Third party add-ons64276
Ref: #diff64464 Ref: #third-party-add-ons64453
Node: iadd64563 Node: diff64588
Ref: #iadd64679 Ref: #diff64687
Node: interest64762 Node: iadd64786
Ref: #interest64885 Ref: #iadd64902
Node: irr64980 Node: interest64985
Ref: #irr65080 Ref: #interest65108
Node: Experimental add-ons65158 Node: irr65203
Ref: #experimental-add-ons65312 Ref: #irr65303
Node: autosync65705 Node: Experimental add-ons65381
Ref: #autosync65819 Ref: #experimental-add-ons65535
Node: budget66058 Node: autosync65928
Ref: #budget66182 Ref: #autosync66042
Node: chart66248 Node: budget66281
Ref: #chart66367 Ref: #budget66405
Node: check66438 Node: chart66471
Ref: #check66562 Ref: #chart66590
Node: check-dates66629 Node: check66661
Ref: #check-dates66771 Ref: #check66785
Node: check-dupes66844 Node: check-dates66852
Ref: #check-dupes66987 Ref: #check-dates66994
Node: equity67064 Node: check-dupes67067
Ref: #equity67192 Ref: #check-dupes67210
Node: prices67311 Node: equity67287
Ref: #prices67440 Ref: #equity67415
Node: print-unique67495 Node: prices67534
Ref: #print-unique67644 Ref: #prices67663
Node: register-match67737 Node: print-unique67718
Ref: #register-match67893 Ref: #print-unique67867
Node: rewrite67991 Node: register-match67960
Ref: #rewrite68112 Ref: #register-match68116
Node: rewrite68214
Ref: #rewrite68335
 
End Tag Table End Tag Table

View File

@ -518,6 +518,53 @@ OPTIONS
-------------------- --------------------
-2 EUR -2 EUR
Cost
The -B/--cost flag converts amounts to their cost at transaction time,
if they have a transaction price specified.
Market value
The -V/--value flag converts the reported amounts to their market value
on the report end date, using the most recent applicable market prices,
when known. Specifically, when there is a market price (P directive)
for the amount's commodity, dated on or before the report end date (see
hledger -> Report start & end date), the amount will be converted to
the price's commodity. If multiple applicable prices are defined, the
latest-dated one is used (and if dates are equal, the one last parsed).
For example:
# one euro is worth this many dollars from nov 1
P 2016/11/01 $1.10
# purchase some euros on nov 3
2016/11/3
assets:euros 100
assets:checking
# the euro is worth fewer dollars by dec 21
P 2016/12/21 $1.03
How many euros do I have ?
$ hledger -f t.j bal euros
100 assets:euros
What are they worth on nov 3 ? (no report end date specified, defaults
to the last date in the journal)
$ hledger -f t.j bal euros -V
$110.00 assets:euros
What are they worth on dec 21 ?
$ hledger -f t.j bal euros -V -e 2016/12/21
$103.00 assets:euros
Currently, hledger's -V only uses market prices recorded with P direc-
tives, not transaction prices (unlike Ledger).
Using -B and -V together is allowed.
Regular expressions Regular expressions
hledger uses regular expressions in a number of places: hledger uses regular expressions in a number of places:
@ -1022,49 +1069,6 @@ COMMANDS
# Average is rounded to the dollar here since all journal amounts are # Average is rounded to the dollar here since all journal amounts are
Market value
The -V/--value flag converts the reported amounts to their market value
on the report end date, using the most recent applicable market prices,
when known. Specifically, when there is a market price (P directive)
for the amount's commodity, dated on or before the report end date (see
hledger -> Report start & end date), the amount will be converted to
the price's commodity. If multiple applicable prices are defined, the
latest-dated one is used (and if dates are equal, the one last parsed).
For example:
# one euro is worth this many dollars from nov 1
P 2016/11/01 $1.10
# purchase some euros on nov 3
2016/11/3
assets:euros 100
assets:checking
# the euro is worth fewer dollars by dec 21
P 2016/12/21 $1.03
How many euros do I have ?
$ hledger -f t.j bal euros
100 assets:euros
What are they worth on nov 3 ? (no report end date specified, defaults
to the last date in the journal)
$ hledger -f t.j bal euros -V
$110.00 assets:euros
What are they worth on dec 21 ?
$ hledger -f t.j bal euros -V -e 2016/12/21
$103.00 assets:euros
Currently, hledger's -V only uses market prices recorded with P direc-
tives, not transaction prices (unlike Ledger).
Using -B and -V together is allowed.
Custom balance output Custom balance output
In simple (non-multi-column) balance reports, you can customise the In simple (non-multi-column) balance reports, you can customise the
output with --format FMT: output with --format FMT:

View File

@ -315,6 +315,58 @@ $ hledger balance --pivot member acct:.
-2 EUR -2 EUR
``` ```
## Cost
The `-B/--cost` flag converts amounts to their cost at transaction time,
if they have a [transaction price](/journal.html#transaction-prices) specified.
## Market value
The `-V/--value` flag converts the reported amounts to their market value
on the report end date, using the most recent applicable market prices,
when known.
Specifically, when there is a [market price](journal.html#market-prices) (P directive)
for the amount's commodity, dated on or before the
[report end date](hledger.html#report-start-end-date) (see hledger -> Report start & end date),
the amount will be converted to the price's commodity.
If multiple applicable prices are defined, the latest-dated one is used
(and if dates are equal, the one last parsed).
For example:
```journal
# one euro is worth this many dollars from nov 1
P 2016/11/01 € $1.10
# purchase some euros on nov 3
2016/11/3
assets:euros €100
assets:checking
# the euro is worth fewer dollars by dec 21
P 2016/12/21 € $1.03
```
How many euros do I have ?
```
$ hledger -f t.j bal euros
€100 assets:euros
```
What are they worth on nov 3 ? (no report end date specified, defaults to the last date in the journal)
```
$ hledger -f t.j bal euros -V
$110.00 assets:euros
```
What are they worth on dec 21 ?
```
$ hledger -f t.j bal euros -V -e 2016/12/21
$103.00 assets:euros
```
Currently, hledger's -V only uses market prices recorded with P directives,
not [transaction prices](journal.html#transaction-prices) (unlike Ledger).
Using -B and -V together is allowed.
## Regular expressions ## Regular expressions
hledger uses [regular expressions](http://www.regular-expressions.info) in a number of places: hledger uses [regular expressions](http://www.regular-expressions.info) in a number of places: