Next: , Previous: Output customization, Up: Options


2.3.4 Commodity reporting

These options affect how commodity values are displayed:

--price-db FILE sets the file that is used for recording downloaded commodity prices. It is always read on startup, to determine historical prices. Other settings can be placed in this file manually, to prevent downloading quotes for a specific, for example. This is done by adding a line like the following:

     ; Don't download quotes for the dollar, or timelog values
     N $
     N h

--price-exp MINS (-L MINS) sets the expected freshness of price quotes, in minutes. That is, if the last known quote for any commodity is older than this value—and if --download is being used—then the Internet will be consulted again for a newer price. Otherwise, the old price is still considered to be fresh enough.

--download (-Q) causes quotes to be automagically downloaded, as needed, by running a script named getquote and expecting that script to return a value understood by ledger. A sample implementation of a getquote script, implemented in Perl, is provided in the distribution. Downloaded quote price are then appended to the price database, usually specified using the environment variable LEDGER_PRICE_DB.

There are several different ways that ledger can report the totals it displays. The most flexible way to adjust them is by using value expressions, and the -t and -T options. However, there are also several “default” reports, which will satisfy most users basic reporting needs:

-O, --quantity
Reports commodity totals (this is the default)
-B, --basis
Reports the cost basis for all transactions.
-V, --market
Reports the last known market value for all commodities.
-g, --performance
Reports the net gain/loss for each transaction in a register report.
-G --gain
Reports the net gain/loss for all commodities in the report that have a price history.