Debian Codegraph @

examples/simple/starter.beancount

raw
1 #!/usr/bin/env bean-web
2 ;; -*- mode: org; mode: beancount; coding: utf-8; fill-column: 400; -*-
3 ;; Starter Kit Example Ledger
4
5 * Initialization
6 ;; This is a starter example file that you should copy to get started
7 ;; using Beancount. This is an example starting point, with the same
8 ;; organization choices and style in which I (the author) write my own
9 ;; ledger files. You should delete all these explanatory comments
10 ;; and put your own instead. When you start, the best way to begin is
11 ;; to create one of these, with all your assets and liabilities, so
12 ;; that you can see your balance sheet and your net worth.
13 ;;
14 ;; This example is written from the perspective of someone starting
15 ;; their ledger file on 2013-12-22.
16 ;;
17 ;; This example uses headers in the Emacs outline mode style. Note
18 ;; that you don't have to do that if you don't use Emacs, it's not
19 ;; required, but it's just really convenient if you do, as you can
20 ;; fold and unfold large sections of your input file and get an
21 ;; overview of its structure..
22 ;;
23 ;; The order of directives in the file does not matter. I choose to
24 ;; organize my transactions by-account, mostly. I create one section
25 ;; for each accounts, and above that, I organize sections by country
26 ;; and institution. It's entirely arbitrary, just a choice based on
27 ;; whatever feels most comfortable for you.
28 ;;
29 ;; In this example file the choice of account names follows my own
30 ;; favorite hierarchy:
31 ;;
32 ;; - The type (Assets/Liabilities/Equity/Expense/Income), which
33 ;; is required by Beancount;
34 ;;
35 ;; - Country. This is useful if you have accounts in multiple places;
36 ;;
37 ;; - Institution. These contain multiple accounts. For example, a
38 ;; bank has checking and savings accounts, typically. They don't
39 ;; have to be physical real institution at this level, but I like
40 ;; to have that level, it's the name of the company that holds the
41 ;; account, even if the account is fictional.
42 ;;
43 ;; - Account name within the institution.
44 ;;
45 ;; Again, this is entirely arbitrary, but I've evolved into this
46 ;; choice over several years of usage, and I think it's pretty neat.
47 ;; Feel free to elide the country, or design your own account
48 ;; hierarchy, it should work just the same, Beancount does not
49 ;; depend on this choice at all, beyond the first component for the
50 ;; type. Several examples below.
51
52 ** Options
53 ;; We begin with the declaration of some global options.
54 ;; Run "bean-doctor list_options" for the full list of available options.
55
56 option "title" "Starter Kit Beancount Ledger"
57
58 ;; We will assume this user operates in US dollars.
59 option "operating_currency" "USD"
60
61
62
63 ** General Accounts
64 ;; We need to declare a few general accounts that we will use below.
65
66 ;; Declare some sort of account to use as the source for padding
67 ;; entries (see below). Use your birth date... that's when you began
68 ;; accumulating equity!
69 1982-04-01 open Equity:Opening-Balances
70
71 ** Events
72 ;; This is a section where I declare some general properties.
73
74 ;; Enter the date when this address last changed and its curent value.
75 2008-07-01 event "address" "12345 Brick Lane, New York City, NY 10011, USD"
76
77 ;; Same thing with your employer.
78 2011-02-15 event "employer" "Boogle Tech Inc."
79
80 ;; You can track trips here too by changing the value of a "location"
81 ;; event (variable). Insert one of these every time you travel. It can
82 ;; be used for various purposes (see documentation). You can also
83 ;; choose to put them along your cash expenses somewhere below, which
84 ;; is what I do (remember: the order of declarations in the file is
85 ;; not important).
86 2013-12-22 event "location" "New York City, USA"
87
88
89 * USA Accounts
90 ** BofA Bank
91 ;; This example individual has some regular accounts in Bank of America
92 ;; (we'll abbreviate as BofA) and a credit card with them.
93
94 *** Checking
95 ;; A main checking account.
96
97 ;; Open the account at the approximate date where you think you
98 ;; actually created it if you don't remember; if you do, find the
99 ;; date and put it here.
100 ;; You don't really have to put a currency constraint, but for a
101 ;; bank account it makes sense to do so, because it really
102 ;; cannot contain any other kinds of beans. This is a US dollar
103 ;; account, so I choose to introduce the "USD" currency here (it's
104 ;; otherwise not pre-defined in any way, it just comes into being
105 ;; as you use it, I could have typed any other all-caps word
106 ;; instead of "USD" here, like "EUR", or "POINTS").
107 2004-08-01 open Assets:US:BofABank:Checking USD
108
109 ;; Then we don't want to have to go and enter all the history from the
110 ;; past here before we get working... so we'll declare a padding
111 ;; directive right at the opening date that will take care of
112 ;; inserting the correct amount to make the following assert balance.
113 2004-08-01 pad Assets:US:BofABank:Checking Equity:Opening-Balances
114
115 ;; Now insert the balance as of the last date that you have a
116 ;; statement for (or if this is available, you can log into your
117 ;; online account and check that your current account balance is).
118 2013-12-22 balance Assets:US:BofABank:Checking 973.03 USD
119
120 ;; That's it! That is the main template. The rest of this file
121 ;; just follows this example in order to setup all the available
122 ;; accounts. From this point on, you can add or import new
123 ;; transactions following the check date.
124
125
126
127 *** Savings
128 ;; A high-interest savings account, presumably opened on the same date..
129
130 2004-08-01 open Assets:US:BofABank:Savings USD
131 2004-08-01 pad Assets:US:BofABank:Savings Equity:Opening-Balances
132 2013-12-22 balance Assets:US:BofABank:Savings 2402.81 USD
133
134
135
136 *** Mortgage
137 ;; A mortgage loan account associated with a Brick Lane property
138 ;; declared below. The date is the same as the purchase of the
139 ;; property, because that's when the mortgage loan began.
140
141 2010-03-20 open Liabilities:US:BofABank:Mortgage USD
142
143 ;; Pad this for payments whose detail we won't enter yet.
144 2010-03-20 pad Liabilities:US:BofABank:Mortgage Equity:Opening-Balances
145
146 ;; Current value of mortgage.
147 2013-12-22 balance Liabilities:US:BofABank:Mortgage -101832.34 USD
148
149
150
151 ** American Express
152 ; He also has an American Express BlueCash Everyday card (we'll
153 ;; abbreviate as Amex).
154
155 2009-08-01 open Liabilities:US:Amex:BlueCash USD
156 2009-08-01 pad Liabilities:US:Amex:BlueCash Equity:Opening-Balances
157 2013-12-22 balance Liabilities:US:Amex:BlueCash -1121.26 USD
158
159
160
161 ** Fidelity Investments
162 ;; His employer deposits 401k matching amounts in a Fidelity 401k
163 ;; account.
164
165 ;; Also, note how I create a subaccount for each instrument type
166 ;; being held; this is not strickly necessary, but I like to do this,
167 ;; as it results in nicer output, where each type of instrument has
168 ;; its own journal and it's just overall less messy.
169 ;;
170 ;; Since this is a 401k account and all the amounts deposited are
171 ;; immediately invested, there is no need to declare a Cash account.
172
173 2009-08-01 open Assets:US:Fidelity:Boogle401k:RGAGX RGAGX
174 2009-08-01 open Assets:US:Fidelity:Boogle401k:VBMPX VBMPX
175
176 2009-08-01 pad Assets:US:Fidelity:Boogle401k:RGAGX Equity:Opening-Balances
177 2009-08-01 pad Assets:US:Fidelity:Boogle401k:VBMPX Equity:Opening-Balances
178
179 ;; Here we just add the contents of the investment account (mutual
180 ;; funds) and their current market value, because this is a registered
181 ;; account (401k) and it is not taxable, so we don't care about the
182 ;; capital gains detail. If you decide later on to add all the
183 ;; purchase transactions, you would find the capital gain appearing.
184 ;;
185
186 2013-12-22 balance Assets:US:Fidelity:Boogle401k:RGAGX 201.02 RGAGX
187 2013-12-22 balance Assets:US:Fidelity:Boogle401k:VBMPX 743.82 VBMPX
188
189 2013-12-22 price RGAGX 40.93 USD
190 2013-12-22 price VBMPX 10.02 USD
191
192
193
194
195 ** E*Trade
196 ;; In addition, he has an E*Trade taxable trading account with some
197 ;; stocks he buys into.
198
199 ;; In this account, we do have a cash component, which holds our
200 ;; deposits and whose contents is converted against stock during
201 ;; transactions. We pad the cash account to account for past
202 ;; deposits.
203 2011-03-15 open Assets:US:ETrade:Investment:Cash USD
204 2011-03-15 pad Assets:US:ETrade:Investment:Cash Equity:Opening-Balances
205 2013-12-22 balance Assets:US:ETrade:Investment:Cash 102.10 USD
206
207
208 ;; These we won't pad; because there's a tax consequence on the
209 ;; capital gain, we want to make sure that we have at least the
210 ;; book value for each position. (Ideally we'd go backwards
211 ;; and enter all the real transactions in the past.)
212 2011-03-15 open Assets:US:ETrade:Investment:HOOL HOOL
213 2011-03-15 open Assets:US:ETrade:Investment:AAPL AAPL
214
215
216 ;; For each of our current positions, add an assertion for the
217 ;; position, as well as the original transaction that got us
218 ;; that position, which provides its cost (book value).
219
220 2013-02-03 * "Bought some stock"
221 Assets:US:ETrade:Investment:HOOL 8 HOOL {701.20 USD}
222 Expenses:Financial:Commissions 7.95 USD
223 Assets:US:ETrade:Investment:Cash
224
225 2013-09-03 * "Bought some stock"
226 Assets:US:ETrade:Investment:HOOL 4 HOOL {850.08 USD}
227 Expenses:Financial:Commissions 7.95 USD
228 Assets:US:ETrade:Investment:Cash
229
230 2013-12-22 balance Assets:US:ETrade:Investment:HOOL 12 HOOL
231 2013-12-22 price HOOL 1101.02 USD
232
233
234 ;; Some other stock.
235
236 2013-06-02 * "Bought some Apple stock"
237 Assets:US:ETrade:Investment:AAPL 10 AAPL {450.72 USD}
238 Expenses:Financial:Commissions 7.95 USD
239 Assets:US:ETrade:Investment:Cash
240
241 2013-12-22 balance Assets:US:ETrade:Investment:AAPL 10 AAPL
242 2013-12-22 price AAPL 549.02 USD
243
244
245
246 ** Brick Lane Home
247 ;; A while back, he bought a property on Brick Lane. Since there
248 ;; is no stock ticker or currency denomination for "his property,"
249 ;; we'll simply create one as a new symbol: "BRICKHOME" and we'll
250 ;; deposit 1 unit of this home in an account. If he bought another
251 ;; home we would create a different symbol.
252
253 2010-03-20 open Assets:US:RealEstate:BrickHome BRICKHOME
254
255 2010-03-20 * "Bought the beautiful Brick Lane house from Joe Oldowner"
256 Assets:US:RealEstate:BrickHome 1 BRICKHOME {175000 USD}
257 Assets:US:BofABank:Checking -50000 USD ; Downpayment
258 Liabilities:US:BofABank:Mortgage -125000 USD ; Loan
259
260
261 ;; Now, for a large asset that has been held over a long period of
262 ;; time, it's unlikely that its current value is the same as that
263 ;; it was when it was purchased, so we'll put as a price the most
264 ;; current evaluation.
265 2013-06-15 price BRICKHOME 210000 USD
266
267
268
269
270 * Expenses
271 ;; You should declare a list of buckets for booking expenses into.
272 ;; This is useful in your income statement, to see where your
273 ;; money is going, where it is being spent.
274 ;;
275 ;; I keep all the unused ones commented, because Beancount generates
276 ;; a warning for unused accounts. Uncomment as needed. Because this
277 ;; ledger does not yet contain any history of spending, they're
278 ;; almost all commented out for now.
279
280 ;1982-04-01 open Expenses:Financial:Fees
281 1982-04-01 open Expenses:Financial:Commissions USD
282 ;1982-04-01 open Expenses:Financial:Interest
283 ;1982-04-01 open Expenses:Insurance:Life
284 ;1982-04-01 open Expenses:Communications:Phone
285 ;1982-04-01 open Expenses:Communications:Email
286 ;1982-04-01 open Expenses:Communications:Internet
287 ;1982-04-01 open Expenses:Clothing
288 ;1982-04-01 open Expenses:Clothing:Cleaning
289 ;1982-04-01 open Expenses:Beauty:Hair
290 ;1982-04-01 open Expenses:Health:Massage
291 ;1982-04-01 open Expenses:Sports:Gear
292 ;1982-04-01 open Expenses:Sports:Cycling
293 ;1982-04-01 open Expenses:Sports:Yoga
294 ;1982-04-01 open Expenses:Fun:Movie
295 ;1982-04-01 open Expenses:Fun:Theater
296 ;1982-04-01 open Expenses:Fun:Concerts
297 ;1982-04-01 open Expenses:Fun:Museum
298 ;1982-04-01 open Expenses:Food:Restaurant
299 ;1982-04-01 open Expenses:Food:Grocery
300 ;1982-04-01 open Expenses:Food:Alcohol
301 ;1982-04-01 open Expenses:Books
302 ;1982-04-01 open Expenses:Gifts
303 ;1982-04-01 open Expenses:Travel:Accommodation
304 ;1982-04-01 open Expenses:Travel:Gear
305 ;1982-04-01 open Expenses:Travel:Documents
306 ;1982-04-01 open Expenses:Travel:Tours
307 ;1982-04-01 open Expenses:Travel:Communications
308 ;1982-04-01 open Expenses:Travel:Insurance
309 ;1982-04-01 open Expenses:Transportation:Flights
310 ;1982-04-01 open Expenses:Transportation:Parking
311 ;1982-04-01 open Expenses:Transportation:Taxi
312 ;1982-04-01 open Expenses:Transportation:Train
313 ;1982-04-01 open Expenses:Transportation:Bus
314 ;1982-04-01 open Expenses:Transportation:Car-Rental
315 ;1982-04-01 open Expenses:Transportation:Gas
316 ;1982-04-01 open Expenses:Moving
317 ;1982-04-01 open Expenses:Toys:Photography
318 ;1982-04-01 open Expenses:Toys:Computer
319 ;1982-04-01 open Expenses:Toys:Electronics
320 ;1982-04-01 open Expenses:Office-Supplies
321 ;1982-04-01 open Expenses:Misc
322 ;1982-04-01 open Expenses:Govt-Services:Drivers-License
323 ;1982-04-01 open Expenses:Medical:Insurance ;; Paying for insurance coverage
324 ;1982-04-01 open Expenses:Medical:Copay ;; Copays
325 ;1982-04-01 open Expenses:Medical:Deductible ;; Amount towards deductible
326 ;1982-04-01 open Expenses:Medical:MaxOutOfPocket ;; Amount towards max out-of-pocket expenses
327 ;1982-04-01 open Expenses:Medical:Drugs ;; Pills, drugs, and other OTC medicine
328 ;1982-04-01 open Expenses:Medical:Dental ;; Costs of dentist
329 ;1982-04-01 open Expenses:Medical:Glasses ;; Corrective glasses
330 ;1982-04-01 open Expenses:Medical:Acupuncture
331 ;1982-04-01 open Expenses:Charity
332 ;1982-04-01 open Expenses:Tips
333
334 ;;; ... add more here, add your own categories ...
335
336
337
338 * Cash Daybook
339 ;; This is a section you can use to enter transactions by hand,
340 ;; that is, not from imported OFX files.
341
342
343
344
345 ;;------------------------------------------------------------------------------------------------------------------------
346 ;; That's it! Run bean-web on this file and you should view a basic
347 ;; balance sheet.
348 ;;
349 ;; Now, the income statement will be sparse and won't reflect the
350 ;; reality of spending and income. You then need to add transactions to
351 ;; it. You can do a few things from here on:
352 ;;
353 ;; 1. You can simply forget all the past history, and begin entering
354 ;; new transactions from this point onwards.
355 ;;
356 ;; 2. You can decide to enter the details of the past history of
357 ;; these accounts back to the beginnign of the calendar year.
358 ;; This provides a good useful starting dataset, because you
359 ;; will be able to use the ledger to figure out amounts to
360 ;; declare on your taxes.
361 ;;
362 ;; 3. For some accounts, you may decide to enter all the past history
363 ;; back to the actual beginning of the account. This would make
364 ;; sense for your investment accounts, for instance, if you don't
365 ;; have too many transactions. For each account whose detail has
366 ;; been fully entered until its beginning, you can delete the
367 ;; corresponding pad entry.
368 ;;
369 ;; Depending on how excited you are about this, you might even
370 ;; choose to try to complete all your accounts a few years back.
371 ;; It's entirely up to you.