$archiver
NSKeyedArchiver
$objects
$null
$class
CF$UID
37
NS.objects
CF$UID
2
$class
CF$UID
33
NS.keys
CF$UID
3
CF$UID
4
CF$UID
5
NS.objects
CF$UID
6
CF$UID
7
CF$UID
35
Title
Text
Date
Untitled Snapshot
$class
CF$UID
34
NSAttributes
CF$UID
10
NSDelegate
CF$UID
0
NSString
CF$UID
8
$class
CF$UID
9
NS.string
Ledger makes no assumptions about the commodities you use; it only requires that you specify a commodity. The commodity may be any non-numeric string that does not contain a period, comma, forward slash or at-sign. It may appear before or after the amount, although it is assumed that symbols appearing before the amount refer to currencies, while non-joined symbols appearing after the amount refer to commodities. Here are some valid currency and commodity specifiers:

@example $20.00 ; currency: twenty US dollars 40 AAPL ; commodity: 40 shares of Apple stock 60 DM ; currency: 60 Deutsch Mark £50 ; currency: 50 British pounds 50 EUR ; currency: 50 Euros (or use appropriate symbol) @end example

Ledger will examine the first use of any commodity to determine how that commodity should be printed on reports. It pays attention to whether the name of commodity was separated from the amount, whether it came before or after, the precision used in specifying the amount, whether thousand marks were used, etc. This is done so that printing the commodity looks the same as the way you use it.

An account may contain multiple commodities, in which case it will have separate totals for each. For example, if your brokerage account contains both cash, gold, and several stock quantities, the balance might look like:

@smallexample $200.00 100.00 AU AAPL 40 BORL 100 FEQTX 50 Assets:Brokerage @end smallexample

This balance report shows how much of each commodity is in your brokerage account.

Sometimes, you will want to know the current street value of your balance, and not the commodity totals. For this to happen, you must specify what the current price is for each commodity. The price can be any commodity, in which case the balance will be computed in terms of that commodity. The usual way to specify prices is with a price history file, which might look like this:

@smallexample P 2004/06/21 02:18:01 FEQTX $22.49 P 2004/06/21 02:18:01 BORL $6.20 P 2004/06/21 02:18:02 AAPL $32.91 P 2004/06/21 02:18:02 AU $400.00 @end smallexample

Specify the price history to use with the @option{--price-db} option, with the @option{-V} option to report in terms of current market value:

@example ledger --price-db prices.db -V balance brokerage @end example

The balance for your brokerage account will be reported in US dollars, since the prices database uses that currency.

@smallexample $40880.00 Assets:Brokerage @end smallexample

You can convert from any commodity to any other commodity. Let's say you had $5000 in your checking account, and for whatever reason you wanted to know many ounces of gold that would buy, in terms of the current price of gold:

@example ledger -T "@{1 AU@}*(O/P@{1 AU@})" balance checking @end example

Although the total expression appears complex, it is simply saying that the reported total should be in multiples of AU units, where the quantity is the account total divided by the price of one AU. Without the initial multiplication, the reported total would still use the dollars commodity, since multiplying or dividing amounts always keeps the left value's commodity. The result of this command might be:

@smallexample 14.01 AU Assets:Checking @end smallexample
$classes
NSMutableString
NSString
NSObject
$classname
NSMutableString
$class
CF$UID
33
NS.keys
CF$UID
11
CF$UID
12
NS.objects
CF$UID
13
CF$UID
30
NSParagraphStyle
NSFont
$class
CF$UID
29
NSAlignment
4
NSLineHeightMultiple
1.1000000238418579
NSTabStops
CF$UID
14
$class
CF$UID
28
NS.objects
CF$UID
15
CF$UID
17
CF$UID
18
CF$UID
19
CF$UID
20
CF$UID
21
CF$UID
22
CF$UID
23
CF$UID
24
CF$UID
25
CF$UID
26
CF$UID
27
$class
CF$UID
16
NSLocation
28
$classes
NSTextTab
NSObject
$classname
NSTextTab
$class
CF$UID
16
NSLocation
56
$class
CF$UID
16
NSLocation
84
$class
CF$UID
16
NSLocation
112
$class
CF$UID
16
NSLocation
140
$class
CF$UID
16
NSLocation
168
$class
CF$UID
16
NSLocation
196
$class
CF$UID
16
NSLocation
224
$class
CF$UID
16
NSLocation
252
$class
CF$UID
16
NSLocation
280
$class
CF$UID
16
NSLocation
308
$class
CF$UID
16
NSLocation
336
$classes
NSArray
NSObject
$classname
NSArray
$classes
NSParagraphStyle
NSObject
$classname
NSParagraphStyle
$class
CF$UID
32
NSName
CF$UID
31
NSSize
14
NSfFlags
16
Courier
$classes
NSFont
NSObject
$classname
NSFont
$classes
NSDictionary
NSObject
$classname
NSDictionary
$classes
KBWordCountingTextStorage
NSTextStorage
NSMutableAttributedString
NSAttributedString
NSObject
$classname
KBWordCountingTextStorage
$class
CF$UID
36
NS.time
267380389.27479199
$classes
NSDate
NSObject
$classname
NSDate
$classes
NSMutableArray
NSArray
NSObject
$classname
NSMutableArray
$top
Snapshots
CF$UID
1
$version
100000