Debian Codegraph @

examples/simple/basic.beancount

raw
1 ;;; -*- mode: org; mode: beancount; coding: utf-8; -*-
2 #+STARTUP: showall
3 ;;;
4 ;;; This is a basic example demo file, with some example accounts and
5 ;;; some example transactions. A real-life Ledger file has a lot
6 ;;; more transactions in it, and possibly a very different set
7 ;;; of accounts; feel free to define your own and to change
8 ;;; everything in here if you use this as a template. You can be
9 ;;; creative, because all the account categories and commodities
10 ;;; are entirely generic. (More comments are sprinkled below.)
11 ;;;
12 ;;; The order in which the transactions are declared does not
13 ;;; matter at all... personally I like to organize transactions
14 ;;; in chronological order, within sections that are
15 ;;; more-or-less by account. I normally pretty much keep them in
16 ;;; the order that the converted OFX file presents them. Here
17 ;;; however, I've ordered the transactions for better clarity of
18 ;;; presentation, since this is a file with sample transactions.
19
20 * Options
21
22 option "title" "Beancount Example Ledger"
23 option "operating_currency" "USD"
24 option "operating_currency" "CAD"
25
26
27 * Initialization
28
29
30 ;;; Declaration of Accounts.
31
32 ;;; Here you can declare a list of valid accounts, and
33 ;;; optionally, a constraint on which kind of commodity they are
34 ;;; allowed to hold (helps you track down mistakes).
35 ;;;
36 ;;; Note that
37 ;;;
38 ;;; - the system supports any currencies, and works with
39 ;;; multiple commodities in the same Ledger.
40 ;;;
41 ;;; - No distinction is made between currency commodities (e.g.
42 ;;; USD, EUR, USD) and investment commodities (e.g. FB, AMZN,
43 ;;; AAPL, MSFT).
44 ;;;
45 ;;; - The Assets, Liabilities, Equity, Income, Expenses
46 ;;; categories are not special; they are simply a convention;
47 ;;; be creative if you like. There are really only two kinds
48 ;;; of accounts: debit accounts and credit accounts, and the
49 ;;; type is only used for reporting (maybe).
50
51
52 ;defaccount De Assets:Fixed:Home USD
53 1970-01-01 open Assets:UTrade:Account USD
54 1970-01-01 open Assets:UTrade:Account:AAPL AAPL
55 1970-01-01 open Assets:UTrade:Account:EWJ EWJ
56 ;defaccount De Assets:Loans
57 1970-01-01 open Assets:AccountsReceivable
58
59 ;defaccount Cr Liabilities:AccountsPayable
60 1970-01-01 open Liabilities:BestBank:Mortgage:Loan USD
61 1970-01-01 open Liabilities:Credit-Card:VISA USD
62 1970-01-01 open Liabilities:Condo-Management USD
63
64 1970-01-01 open Equity:Opening-Balances
65
66 1970-01-01 open Income:Interest:Checking
67 1970-01-01 open Income:Interest:Savings
68 1970-01-01 open Income:Dividends
69 1970-01-01 open Income:Capital-Gains
70 1970-01-01 open Income:Salary:AcmeCo
71
72 1970-01-01 open Expenses:Financial:Fees
73 1970-01-01 open Expenses:Financial:Commissions
74 1970-01-01 open Expenses:Insurance:Life
75 1970-01-01 open Expenses:Food:Restaurant
76 1970-01-01 open Expenses:Food:Grocery
77 1970-01-01 open Expenses:Food:Alcool
78 1970-01-01 open Expenses:Communications:Phone
79 1970-01-01 open Expenses:Communications:Mail
80 ;defaccount De Expenses:Transportation:Parking
81 1970-01-01 open Expenses:Transportation:Taxi
82 ;defaccount De Expenses:Transportation:Trains
83 ;defaccount De Expenses:Transportation:PublicTrans
84 ;defaccount De Expenses:Taxes:US-State-California USD
85 1970-01-01 open Expenses:Taxes:US-Federal USD
86 1970-01-01 open Expenses:Govt-Services USD
87 1970-01-01 open Expenses:Clothes
88 1970-01-01 open Expenses:Car:Gas
89 1970-01-01 open Expenses:Sports
90 1970-01-01 open Expenses:Sports:Gear
91 1970-01-01 open Expenses:Fun:Movie
92 ;defaccount De Expenses:Fun:Museum
93 1970-01-01 open Expenses:Books
94 ;defaccount De Expenses:Travel:Flights
95 ;defaccount De Expenses:Travel:Accomodation
96 ;defaccount De Expenses:Toys:Photography
97 ;defaccount De Expenses:Toys:Computer
98 ;defaccount De Expenses:Office-Supplies
99 1970-01-01 open Expenses:Medical
100 1970-01-01 open Expenses:Charity
101 ;defaccount De Expenses:Misc
102 ;defaccount De Expenses:Home:Repair
103 ;defaccount De Expenses:Home:Maintenance
104 ;defaccount De Expenses:Home:Taxes:Municipal
105 ;defaccount De Expenses:Home:Taxes:School
106 ;defaccount De Expenses:Home:Insurance
107 ;defaccount De Expenses:Home:Monthly
108 ;defaccount De Expenses:Home:Monthly:Internet
109 1970-01-01 open Expenses:Home:Monthly:Condo-Fees
110 ;defaccount De Expenses:Home:Monthly:Electricity
111 1970-01-01 open Expenses:Home:Monthly:Loan-Interest
112 ;defaccount De Expenses:Home:Monthly:Water
113 ;defaccount De Expenses:Home:Acquisition:Furniture
114 ;defaccount De Expenses:Home:Acquisition:Renovations
115 ;defaccount De Expenses:Home:Acquisition:Legal
116 ;defaccount De Expenses:Home:Acquisition:Inspection
117
118
119
120 ;;; You can provide mappings from the account numbers ("account
121 ;;; ids") that are normally found in OFX files that the
122 ;;; banks/brokers provide, mapping to account names in this
123 ;;; Ledger file. This way, a script that converts the OFX into
124 ;;; Ledger-compatible syntax is able to automatically figure out
125 ;;; the right account names.
126
127 ;;; Account number mappings.
128 ;;accid "123456789012" Assets:BestBank:Checking
129 ;;accid "123456789012" Assets:BestBank:Savings
130 ;;accid "1234567890" Liabilities:BestBank:Mortgage:Loan
131 ;;accid "1234567890123456" Liabilities:Credit-Card:VISA
132 ;;accid "1234567890" Assets:UTrade:Account
133
134
135
136
137
138
139
140
141 * Assets:BestBank:Checking
142
143 1970-01-01 open Assets:BestBank:Checking USD
144
145 ;; This entry tells the software to automatically insert an
146 ;; entry at this date, of the amount required to fulfill the
147 ;; next check directive (chronologically) in the account (for
148 ;; all commodities present). If the required amount is 0, no
149 ;; entry is added.
150 2007-12-31 pad Assets:BestBank:Checking Equity:Opening-Balances
151
152 ;; This directive tells the software to assert that at the given
153 ;; date, in the given account, a specific amount of the given
154 ;; commodity was present.
155 2008-01-01 balance Assets:BestBank:Checking 1412.24 USD
156
157
158 ;; A check deposit, e.g. depositing a government check.
159 2008-01-05 * "GST CANADA" "Deposit from govt for consumer tax rebate"
160 Assets:BestBank:Checking 77.76 USD
161 Expenses:Taxes:US-Federal
162
163
164
165 ;; This is how salary direct deposit entries might show up
166 ;; within the checking account section. Note how the salaries
167 ;; are negative amounts... that's because Income is a credit
168 ;; account category, and the numbers there are negative (you can
169 ;; interpret this as the "amount of work-dollars that you took
170 ;; from society and placed into your account").
171
172 2008-01-10 * "ACME" "Salary paid from employer"
173 Assets:BestBank:Checking 2000.00 USD
174 Income:Salary:AcmeCo -2000 USD
175
176 2008-01-25 * "ACME" "Salary paid from employer"
177 Assets:BestBank:Checking 2000.00 USD
178 Income:Salary:AcmeCo
179
180 2008-02-10 * "ACME" "Salary paid from employer"
181 Assets:BestBank:Checking 2000.00 USD
182 Income:Salary:AcmeCo
183
184 2008-02-25 * "ACME" "Salary paid from employer"
185 Assets:BestBank:Checking 2000.00 USD
186 Income:Salary:AcmeCo
187
188
189
190 ;; Withdrawal from another bank's ATM machine (with fees).
191 2008-01-12 * "ATM withdrawal - 00044242"
192 Assets:BestBank:Checking -301.50 USD
193 Expenses:Financial:Fees 1.50 USD
194 Assets:Cash
195
196 ;; ATM withdrawal (without fees).
197 2008-01-30 * "ATM withdrawal"
198 Assets:BestBank:Checking -800.00 USD
199 Assets:Cash
200
201 2008-02-10 * "ATM withdrawal"
202 Assets:BestBank:Checking -500.00 USD
203 Assets:Cash
204
205 2008-02-24 * "ATM withdrawal"
206 Assets:BestBank:Checking -500.00 USD
207 Assets:Cash
208
209
210 ;; Automated withdrawal for Life insurance payments.
211 2008-01-02 * "LIFE INSURANCE -- LONDON LIFE"
212 Assets:BestBank:Checking -42.69 USD
213 Expenses:Insurance:Life
214
215 2008-02-02 * "LIFE INSURANCE -- LONDON LIFE"
216 Assets:BestBank:Checking -42.69 USD
217 Expenses:Insurance:Life
218
219
220 ;; A purchase from a store using the bank's debit card.
221 2008-01-17 * "Interac Purchase - 1341 - ACCES SPORTS S"
222 Assets:BestBank:Checking -89.00 USD
223 Expenses:Sports:Gear
224
225
226 ;; A monthly fee that the bank takes for its deposit banking services.
227 2008-01-10 * "MONTHLY FEE"
228 Assets:BestBank:Checking -4.00 USD
229 Expenses:Financial:Fees
230
231
232 ;; A typical bank's return on checking accounts.
233 2008-01-12 * "Deposit interest"
234 Assets:BestBank:Checking 0.02 USD
235 Income:Interest:Checking
236
237
238
239 ;; An example of using the A/R account: I bought an electronic
240 ;; toy for a friend, and I wanted to track the amount that he
241 ;; should pay back to me. Instead of placing it in expenses, I
242 ;; made it a receivable, which was cancelled later on where he
243 ;; paid me back.
244
245 2008-03-26 * "Bought an iPhone to Gilbert (had to use ATM)"
246 Assets:AccountsReceivable 431.92 USD
247 Expenses:Financial:Fees 3.00 USD
248 Assets:Cash -434.92 USD
249
250 ;; Notice that the amount pay back was for an approximate
251 ;; amount, so the overflow I placed in the cash account.
252 2008-04-02 * "Gilbert paid back for iPhone"
253 Assets:Cash 440.00 CAD
254 Assets:AccountsReceivable -431.92 USD
255 Assets:Cash
256
257
258
259 ;; At the end of the month, I take my statements, look at the
260 ;; bottom and enter the amount that the bank says was there at
261 ;; that date. It should corroborate with the data in my Ledger.
262 2008-02-01 balance Assets:BestBank:Checking 661.49 USD
263
264
265
266
267
268
269 * Assets:BestBank:Savings
270
271 1970-01-01 open Assets:BestBank:Savings USD
272 2007-12-31 pad Assets:BestBank:Savings Equity:Opening-Balances
273
274 2008-01-01 balance Assets:BestBank:Savings 12000 USD
275
276 ;; Interest paid on balance in savings account.
277 2008-01-03 * "DEPOSIT INTEREST"
278 Assets:BestBank:Savings 95.69 USD
279 Income:Interest:Savings
280
281
282 ;; An entry that indicates a bank transfer from a checking account to a savings account.
283 ;; There is a choice to locate this entry with the savings or with the checking, it's up to you.
284 2008-01-29 * "Transfer from checking to savings account"
285 Assets:BestBank:Savings 2000.00 USD
286 Assets:BestBank:Checking
287
288 2008-02-03 * "DEPOSIT INTEREST"
289 Assets:BestBank:Savings 102.34 USD
290 Income:Interest:Savings
291
292 2008-02-03 * "Transferring money to brokerage account for better investment."
293 Assets:BestBank:Savings -10000.00 USD
294 Assets:UTrade:Account
295
296
297 ;; A monthly check using the amount on the stament.
298 2008-03-01 balance Assets:BestBank:Savings 2340.19 USD
299
300
301
302 ;; Automated mortgage payments from the savings account.
303 2008-01-12 * "MORTGAGE PAYMENT"
304 Assets:BestBank:Savings -464.46 USD
305 Liabilities:BestBank:Mortgage:Loan 171.01 USD
306 Expenses:Home:Monthly:Loan-Interest
307
308 2008-01-27 * "MORTGAGE PAYMENT"
309 Assets:BestBank:Savings -464.46 USD
310 Liabilities:BestBank:Mortgage:Loan 171.01 USD
311 Expenses:Home:Monthly:Loan-Interest
312
313 2008-02-12 * "MORTGAGE PAYMENT"
314 Assets:BestBank:Savings -464.46 USD
315 Liabilities:BestBank:Mortgage:Loan 171.01 USD
316 Expenses:Home:Monthly:Loan-Interest
317
318 2008-02-27 * "MORTGAGE PAYMENT"
319 Assets:BestBank:Savings -464.46 USD
320 Liabilities:BestBank:Mortgage:Loan 171.01 USD
321 Expenses:Home:Monthly:Loan-Interest
322
323 2008-03-12 * "MORTGAGE PAYMENT"
324 Assets:BestBank:Savings -464.46 USD
325 Liabilities:BestBank:Mortgage:Loan 171.01 USD
326 Expenses:Home:Monthly:Loan-Interest
327
328 2008-03-27 * "MORTGAGE PAYMENT"
329 Assets:BestBank:Savings -464.46 USD
330 Liabilities:BestBank:Mortgage:Loan 171.01 USD
331 Expenses:Home:Monthly:Loan-Interest
332
333
334
335 * Liabilities:Credit-Card:VISA
336
337 2007-12-31 pad Liabilities:Credit-Card:VISA Equity:Opening-Balances
338 2008-01-01 balance Liabilities:Credit-Card:VISA -791.34 USD
339
340 ;; Paying back my credit card.
341 2008-01-22 * "Online Banking payment - 5051 - VISA"
342 Assets:BestBank:Checking -791.34 USD
343 Liabilities:Credit-Card:VISA
344
345
346 ;; Expenses at restaurants on credit card.
347 2008-01-15 * "Cafe Imagination" ""
348 Liabilities:Credit-Card:VISA
349 Expenses:Food:Restaurant 47.00 USD
350
351 2008-01-19 * "Soupe Bol" ""
352 Liabilities:Credit-Card:VISA -21.00 USD
353 Expenses:Food:Restaurant
354
355 2008-01-27 * "Scola Pasta" ""
356 Liabilities:Credit-Card:VISA
357 Expenses:Food:Restaurant 51.17 USD
358
359
360 ;; Cell phone bill via credit crad.
361 2008-01-19 * "FIDO" ""
362 Liabilities:Credit-Card:VISA
363 Expenses:Communications:Phone 121.96 USD
364
365
366
367
368
369
370
371 * Assets:UTrade:Account
372
373 2007-12-31 pad Assets:UTrade:Account Equity:Opening-Balances
374
375 2008-01-01 balance Assets:UTrade:Account 31273.02 USD
376
377 ;; Some example trades.
378 ;;
379 ;; - Notice how I like to create a special account to contain
380 ;; each kind of commodity. This choice is an arbitrary one: I
381 ;; could keep all the stocks in the one investing account
382 ;; (which would then contain many different kinds of
383 ;; commodities) but doing it this way I can more easily track
384 ;; the book value of the remaining shares that I have. I think
385 ;; there may be a better way to do this.
386 ;;
387 ;; - Usually I enter the final amounts from the trade
388 ;; confirmation slips that get emailed to me, because the
389 ;; information there is more precise and detailed than what I
390 ;; seem to get from the online brokerage interface. YMMV.
391 ;;
392 ;; - I still don't have a good generic way to deal with the
393 ;; capital gains automatically, so I enter them by hand for
394 ;; now. The challenge is to find a generic way to account
395 ;; for capital gains while accounting for commissions and
396 ;; trade fees the correct way (they should get removed from the
397 ;; capital gains at both ends of a trade).
398 ;;
399 ;; - Note that the "185.40 USD" cost amount below refers to the
400 ;; price PER UNIT of AAPL. If you wanted to provided a cost for
401 ;; the full amount, you could use two brackets, e.g. {{185.40 USD}}.
402
403 2008-01-08 * "Buy some Apple Computer"
404 Assets:UTrade:Account:AAPL 30 AAPL {185.40 USD}
405 Assets:UTrade:Account
406 Expenses:Financial:Commissions 9.95 USD
407
408 ;; A dividend payment.
409 2008-02-02 * "DIVIDEND from AAPL position"
410 Assets:UTrade:Account 0.68 USD
411 Income:Dividends
412
413 ;; Because of my skirt-length statistic computation.
414 2008-02-28 * "Sell off my Apple"
415 Assets:UTrade:Account:AAPL -30 AAPL {185.40 USD} @ 193.02 USD
416 Assets:UTrade:Account 5780.65 USD
417 Expenses:Financial:Commissions 9.95 USD
418 Income:Capital-Gains
419
420 ;; The line that says "BOOK AAPL" means to insert the amount that
421 ;; corresponds to the gains/losses for the commodity "AAPL" within
422 ;; the account for the posting in this transaction that includes AAPL
423 ;; (Assets:UTrade:Account:AAPL, found automatically).
424 ;; The inventory booking is done in FIFO order.
425 ;;
426 ;; The capital gain will show up as a negative number...
427 ;; that's because Income is a credit account, like a salary.
428
429 ;; This position is kept long, so it gets reflected below in the check.
430 2008-02-10 * "Buy some japanese ETF from iShares"
431 Assets:UTrade:Account:EWJ 100 EWJ {13.34 USD}
432 Assets:UTrade:Account
433 Expenses:Financial:Commissions 9.95 USD
434
435
436 ;; Run checks against statement summary of positions that gets
437 ;; mailed periodically.
438 2008-03-01 balance Assets:UTrade:Account 40138.45 USD
439 2008-03-01 balance Assets:UTrade:Account:AAPL 0 AAPL
440 2008-03-01 balance Assets:UTrade:Account:EWJ 100 EWJ
441
442
443
444
445
446
447
448 * Expenses:Insurance:Life
449
450 ;; Estimate of value of life insurance policy, to account for
451 ;; total net worth.
452 2008-01-01 * "Life insurance policy resale value"
453 Expenses:Insurance:Life 4407.06 USD
454 Equity:Opening-Balances
455
456
457
458
459
460
461
462 * Assets:Fixed:Home
463
464 ;; You could use this account in order to reevaluate your home.
465
466
467
468
469
470
471
472 * Expenses:Home:Monthly:Condo-Fees
473
474 2007-12-31 pad Liabilities:Condo-Management Equity:Opening-Balances
475
476 2008-01-01 balance Liabilities:Condo-Management -41.11 USD
477
478 2008-01-01 * "Propri-Manage" ""
479 Expenses:Home:Monthly:Condo-Fees 212.61 USD
480 Liabilities:Condo-Management
481
482 2008-01-14 * "(998) Propri-Manage" "cheque sent by snail mail"
483 Liabilities:Condo-Management 800.00 USD
484 Assets:BestBank:Checking
485
486 2008-02-01 * "Propri-Manage" ""
487 Expenses:Home:Monthly:Condo-Fees 212.61 USD
488 Liabilities:Condo-Management
489
490 2008-03-01 * "Propri-Manage" ""
491 Expenses:Home:Monthly:Condo-Fees 212.61 USD
492 Liabilities:Condo-Management
493
494 2008-03-10 * "Propri-Manage" "special billing, spring works"
495 Expenses:Home:Monthly:Condo-Fees 61.25 USD
496 Liabilities:Condo-Management
497
498 2008-04-01 balance Liabilities:Condo-Management 59.81 USD
499
500
501
502
503
504
505
506 * Assets:Cash
507 * Expenses:*
508
509 1970-01-01 open Assets:Cash
510
511 2007-12-30 pad Assets:Cash Equity:Opening-Balances
512
513
514 ;; Amount in wallet at a given time.
515 2007-12-31 balance Assets:Cash 200 CAD
516 2007-12-31 balance Assets:Cash 300 USD
517
518 ;; Because I don't track individual cash expenses very tightly,
519 ;; I still need to distribute the cash that disappeared into
520 ;; appropriate expense categories. What I like to do is
521 ;; guesstimate that about 80% of it goes into restaurants, and
522 ;; 20% into wine bars. What frequency and categories you choose
523 ;; to use is highly dependent on your lifestyle...
524
525 2008-01-02 * "Distribution of cash expenses"
526 Expenses:Food:Restaurant 300.00 USD
527 Expenses:Food:Alcool 100.00 USD
528 Assets:Cash
529
530 2008-01-16 * "Distribution of cash expenses"
531 Expenses:Food:Restaurant 300.00 USD
532 Expenses:Food:Alcool 100.00 USD
533 Assets:Cash
534
535 2008-02-02 * "Distribution of cash expenses"
536 Expenses:Food:Restaurant 300.00 USD
537 Expenses:Food:Alcool 100.00 USD
538 Assets:Cash
539
540 2008-02-16 * "Distribution of cash expenses"
541 Expenses:Food:Restaurant 300.00 USD
542 Expenses:Food:Alcool 100.00 USD
543 Assets:Cash
544
545 2008-03-02 * "Distribution of cash expenses"
546 Expenses:Food:Restaurant 300.00 USD
547 Expenses:Food:Alcool 100.00 USD
548 Assets:Cash
549
550 2008-03-16 * "Distribution of cash expenses"
551 Expenses:Food:Restaurant 300.00 USD
552 Expenses:Food:Alcool 100.00 USD
553 Assets:Cash
554
555
556
557 ;;
558 ;; Some common cash expenses.
559 ;;
560
561 2008-02-18 * "DMV" "Renewal of driver's license."
562 Expenses:Govt-Services 110.00 USD
563 Assets:Cash
564
565 2008-01-21 * "WHOLE FOODS" ""
566 Expenses:Food:Grocery 54.03 USD
567 Assets:Cash
568
569 2008-01-21 * "USPS" "sent package to mom"
570 Expenses:Communications:Mail 4.43 USD
571 Assets:Cash
572
573 2008-02-04 * "taxi home from meeting"
574 Expenses:Transportation:Taxi 12.00 USD
575 Assets:Cash
576
577
578
579 ;; Short weekend trip to Skii Mountain.
580 ;;
581 ;; You can use the pushtag and poptag directives to mark all
582 ;; transactions between them with a specific tag. Later on you
583 ;; can filter the postings to a tag by using a cmdline. This
584 ;; allows you to find out what expenses were incurred during a
585 ;; specific trip.
586
587 pushtag #ski-trip
588
589 2008-01-27 * "SUNONO" "fill'er up"
590 Expenses:Car:Gas 40 USD
591 Assets:Cash
592
593 2008-01-27 * "SKII" "Lift tickets"
594 Expenses:Sports 120 USD
595 Assets:Cash
596
597 2008-01-27 * "Dinner at chalet"
598 Expenses:Food:Restaurant 35.33 USD
599 Assets:Cash
600
601 2008-01-28 * "breakfast"
602 Expenses:Food:Restaurant 17.23 USD
603 Assets:Cash
604
605 2008-01-28 * "a new hat, it was cold"
606 Expenses:Clothes 40.02 USD
607 Assets:Cash
608
609 poptag #ski-trip
610
611
612
613
614 2008-03-03 * "ALDO" "new shoes"
615 Expenses:Clothes 121.20 USD
616 Assets:Cash
617
618 2008-02-24 * "AMC" "movies with girlfriend"
619 Expenses:Fun:Movie 24 USD
620 Assets:Cash
621
622 2008-03-06 * "Barnes & Noble" "books on accounting"
623 Expenses:Books 74.43 USD
624 Assets:Cash -74.43 USD
625
626 2008-02-03 * "ITHURTS MEDICAL CENT" "x-ray for broken bones"
627 Expenses:Medical 312.00 USD
628 Assets:Cash
629
630
631 2008-03-02 * "ZEN CENTER" "Donation to Zen center"
632 Expenses:Charity 50 USD
633 Assets:Cash
634
635
636
637
638 2008-03-01 balance Assets:Cash 200.00 CAD
639 2008-03-01 balance Assets:Cash 30.96 USD
640
641 2008-03-15 price USD 1.0934 CAD
642
643 2013-07-03 event "location" "New York City"