# Sample Penny file. Penny is a double-entry accounting # system. Penny uses traditional accounting terminology, # which means that every transaction will have "debits" # and "credits". In every single transaction, debits # must equal credits, or this file will not parse # and Penny will quit with an error. # Penny has no concept of negative numbers. All numbers # are positive or zero. # To learn double-entry accounting, pick up a used accounting # textbook at your favorite online used book retailer. # They can be had for under 10 U.S. dollars, as college # students cast aside old editions that are perfectly good. # This website is also excellent and is free: # http://www.principlesofaccounting.com/ # As you can see, single line comments begin with # a hash mark, like a shell script. Currently there # is no way to make a multi-line comment. # Here is a sample transaction to start things off. 2011/12/15 Salts Deluxe Assets:Checking Dr $2000.00 'Payday Income:Salary Cr $1500.00 Expenses:Taxes Cr $500.00 ; This is a transaction memo. It is associated ; with the transaction, and the penny program lets you ; search their contents. Transaction memos appear immediately ; before a transaction and their lines begin with ; semicolons. 2012/01/01 Payee Name Assets:Checking Cr $5.00 Expenses:Food # Tags are only one word. Precede each tag with an asterisk. # Postings can have one or more "tags". These allow you to # classify postings by tag as well as by account. For example # you might take a vacation. Various postings might be scattered # across multiple accounts (Expenses:Food, Expenses:Gas, etc.) # but you can give them all a *vacation tag. # Transactions and postings can have an optional flag. # The flag is one or more letters. # It is wrapped in square brackets. # For instance, this can be used to indicate a posting # is cleared. # Penny uses spaces to separate different parts of the # transaction. If you want to include spaces in the name # of an account, you must enclose it in curly braces # as shown in the next transaction. 2012/01/02 [C] (302) GreenGas {Liabilities:Credit Card} Cr $5.00 Expenses:Car *gas *trips # Though the posting lines in this file are nicely indented for # readability, Penny does not require this. ; This transaction has a posting with a different payee. ; You can do this by enclosing the payee in greater than ; and less than signs as shown. ; The last posting has a memo. ; These begin with an apostrophe. As with posting lines, the ; indentation is nice for readability, but it is not required. ; (It does have to be on a new line though.) 2012/01/03 Flathead [R] (905) Expenses:Pet Dr $10.00 Assets:Checking Cr $5.00 [*] (2313) {Liabilities:Credit Card} Cr $5.00 'This interest rate is too high # Flags can be more than one letter. Actually they can include # any character except ']'. 2012/01/06 [Flagger] Flagged Up Transaction Expenses:Flags Dr $200.00 Assets:Checking Cr $200.00 # By default, the digit grouping character is the comma and # the radix point character is the period. You can configure these # (somewhat) easily by making changes to the source code (not # as bad as it sounds, believe it or not.) The digit grouping # character is really for your benefit; Penny mostly ignores # it. The radix point is of course quite significant. # Commodity names may be before or after the commodity amount. # They can be separated from the amount by one optional space. # To use multiple commodities, use a trading account. # The best explanation of trading accounts is here: # http://www.mscs.dal.ca/~selinger/accounting/tutorial.html # For this transaction, the debits and credits all add up to zero, # as they always must. If they do not, parsing of the ledger # file will fail. 2012/01/05 Stockbroker Assets:Brokerage Dr 1,000 LUV Assets:Current:Checking Cr $ 2,000.00 {Income:Brokerage Trading Account} Cr 1,000 LUV {Income:Brokerage Trading Account} Dr $ 2,000.00 # Prices allow you to specify how to convert one commodity # to another. Prices do not affect the way any of your # transactions are parsed. Even if you specify prices, # you still must ensure that the debits equal the credits # in every transaction; if they do not, the parser will fail. # The balance report uses price information for the --convert and -c # options. This allows you to convert all commodities in the file to a # single commodity. Typically you would use this to see what the # balance of all your accounts is in your home currency. # Prices specify that ONE unit of the given commodity # equals the given quantity of the other commodity. Here # are some examples. @ 2012/01/05 17:55:55 -0500 LUV $9.62 @ 2012/01/05 Gold $1738.35 # Prices only work one way. For instance the first # price tells you how many dollars one euro is worth, and allows # reports to convert from euro to dollars. To convert from # dollars to euro, you must specify another price. @ 2012/01/05 € $1.3207 @ 2012/01/05 $ €0.7572 @ 2012/01/05 ¥ 0.6418 INR ; Commodities can have several components in their names, ; just as accounts can. Subsequent parts can be viewed as ; sub-commodities. This can be handy if different commodities ; have something in common and you want to group them together. ; For example, let's say you bought shares in T in ; 2007 and in 2012. For tax purposes you want to track them separately ; in your reports (this can matter for capital gains taxes) yet ; shares in T have the same price whether you bought them in 2007 ; or in 2012. So you can have two different symbols, as the following ; two transactions show: 2007/02/01 Bought stock Assets:Brokerage Dr 100 T:2007 '$37.75 per share Assets:Checking Cr $3775 {Income:Brokerage Trading} Cr 100 T:2007 {Income:Brokerage Trading} Dr $3775 2012/01/12 Bought stock Assets:Brokerage Dr 100 T:2012 '$30.12 per share Assets:Checking Cr $3012 {Income:Brokerage Trading} Cr 100 T:2012 {Income:Brokerage Trading} Dr $3012 # and some prices to go along with the T example. Because no # different prices are specified for T:2012 and for T:2007, # the balance report will use the price for T for both these # commodities if you use the --convert or -c options. @ 2007/06/01 T $40.53 @ 2012/01/27 T $29.16 # As the examples above show with the currency symbols, # Penny works fine with Unicode. # Your ledger file should be encoded in your system's default # encoding. On my system this is UTF-8, as it is on most # recent Linux systems, but some systems use other encodings. # I know that Slackware was recently using ISO-8859-1. Non-Unicode # encodings should work fine as well, as Penny will convert them # to Unicode internally. # If your ledger file is encoded in UTF-8 # and you still have Unicode problems, # it is a bug. Please report it to me. # If you have no idea what all this encoding stuff is about, # the first thing to remember is that there is no such thing # as plain text. Read this: # http://www.joelonsoftware.com/articles/Unicode.html # The Penny program will not change your input file. It cannot # change your input file as it is opened read-only. ############################################################## # Dates - as one example with the prices suggested, dates # need not be just a date. They can also include a time. # Internally, Penny records all dates as both dates and times. # If you give a date but do not give a time, the time is assumed # to be midnight. # Of course you cannot have times without timezones. Penny # assumes each time is in the DefaultTimeZone, which you can configure # or which you can configure as being in whatever time zone your # system is set to use. Or of course you can specify the time # zone by specifying the number of hours and minutes the # time differs from UTC. To specify UTC, use +0000 or -0000. In the # default configuration, the DefaultTimeZone is UTC. ; Transaction that specifies a time. The time zone is the ; DefaultTimeZone, which you can configure. Times must be specified ; using 24 hour time. Leading zeroes are optional for the hours; ; they are mandatory for the minutes and seconds. 2012/01/28 09:58 King Arthur Flour Expenses:Food Dr $5.25 'Sourdough starter! Assets:Current:Checking ; Transaction specifying a local time zone 2012/01/28 17:26:44 -0500 Exactamundo Expenses:Amusements Dr $400 {Liabilities:Credit Card} Cr $300 Assets:Current:Checking Cr $100 ; Transaction specifying UTC. Also, you can always ; spell out "Debit" or "Credit" if you want to. 2012/01/28 23:30 +0000 Pacific Dispatch Expenses:Newspapers Debit $1.25 Assets:Cash Credit $1.25 # There are many different ways to write an amount. First, some # terminology. Some of these terms are specific to Penny; if these # terms are inconsistent with usual accounting terminology or if # they don't make sense, please let me know. # # A commodity is a thing of value you track in Penny. Typically this # will be a currency (like $ or €, but it can be whatever you like, # such as a ticker symbol or some letters to represent your house. # A quantity is a number, such as 3 or 65.2 or 33.80. Notice that # it does not have a commodity. # An amount is a quantity and a commodity. # An entry is an amount combined with an indication of Debit # or Credit. # You can write commodities and quantities in one of four ways: # # * Commodity first, without a separating space. E.g. $100, F25, €59, # In this case the commodity name CANNOT have any digits. # # * Commodity first, with a separating space. E.g. $ 100, € 59. # # * Commodity last, without separating space. E.g. 59€. # # * Commodity last, with separating space. E.g. 59 €. # # In the last three cases, the commodity name can include digits. # If you want to include spaces in the name of a commodity, surround # it with "quotes". # In all cases the commodity name can use sub-commodities by # using colons. # A commodity's identity is determined by the characters you use # when you type the commodity. Thus EUR 100 and 100 EUR mean the # same thing, except for the fact that they are formatted differently. # The Penny parser does remember the order in which you specified # the commodity and the quantity for every posting, but currently # nothing is done with this information. For instance, in the # postings report, the commodity is always shown first. # Here's an example. Note that the transaction balances # because the commodity is the same whether written before or after # the quantity. 2012/01/30 Benny Broker Assets:Brokerage Dr MSFT100 Assets:Current:Checking Cr 2959 $ {Income:Stock Trading Account} Cr 100 MSFT {Income:Stock Trading Acccount} Dr $2959 # What's the difference between transaction memos, posting # memos, and comments? Here I will draw a distinction between # penny (lower case), which is the command-line executable # program, and the Penny parser (upper case), which is the Haskell # module that parses your Penny ledger file. Thus penny lower-case # is the binary; Penny is broader and encompasses the library # as well as the program. # So, the Penny parser does see and remember transaction memos, # posting memos, and comments. However, it does not pass # comments along to the rest of the penny command-line program. # The penny command-line program only deals with transactions # and postings; transactions and postings can have # memos associated with them. # Therefore, using the penny command-line program, you can only # search memos, not comments. However, the fact that the Penny # parser does see comments might be useful if you are going to # write your own Haskell code using the parser. For instance, # you might want to transform your Penny ledger (maybe to # automatically reconcile your checking account statement). # By writing your own code using the Penny parser, you can # do transformations like this while still keeping your comments # intact. Pretty neat.