Articles tagged with 'Personal Finance'

Tiller, Ledger, and Sorbet

21 May 2020

Tiller + Ledger

Thirteen years ago I started tracking my finances using a tool named Ledger. Up until 2018 I hand-entered every penny into my ledger files, which absolutely had value but eventually I decided that I wanted to automate things as much as I could.

I happened upon Tiller which scrapes bank accounts and puts the data into a Google spreadsheet. Importantly, Tiller adds a unique ID to every transaction it sees, which means if I want to automate something I don't have to try to implement deduplication.

Back in 2018 the script I used was rough, but I've polished it over the years and, just the other day, published the guts as LedgerTillerExport.

The gem consumes a set of reconciliation rules and a Google spreadsheet ID and produces a set of ledger transactions. Rules are given a row from the spreadsheet and return the correct account name for that transaction. For example, I can create a rule like this:

rule = LedgerTillerExport::RegexpRule.new(
  match: /Kroger/i,
  account: 'Expenses:Food:Groceries',
)

This rule looks for /Kroger/ in a Tiller payee line and says that that is always the Expenses:Food:Groceries expense account, like this:

2020-05-21 * Kroger
   ; tiller_id: 5323ch323466234c3467
   Expenses:Groceries                  $150.00
   Liabilities:CreditCard

I can create custom rules that do more complicated things than just a regular expression match. There's a rule in the readme that shows how I reconcile checks, for example.

Where does this tiller_id thing come in, you ask? LedgerTillerExport generates a list of known tiller_ids by querying ledger like this:

ledger --register-format='%(tag("tiller_id"))\n' reg expr 'has_tag(/tiller_id/)'

This extracts the value of the tiller_id tag for every transaction that has one applied. In Ruby we then split the value on commas because I have a bunch of transactions where I've collapsed multiple Tiller rows into one Ledger transaction by hand.

Sorbet

Ok, so, that's interesting, but I also want to talk about Sorbet.

I started working at Stripe almost a year ago and met the Sorbet type checker on my first day. Despite a few warts I've come to adore this way of working with types in Ruby. Both LedgerTillerExport and LedgerGen, my library for building ledger transactions, are built using Sorbet.

My favorite thing in Sorbet is T::Struct. This lets you define a typed record that you can then pass around to functions and serialize to json. For example, here's a struct from LedgerTillerExport:

class Row < T::Struct
  extend T::Sig

  const :txn_date, Date
  const :txn_id, String
  const :account, String
  const :amount, Float
  const :description, String

  sig {params(row: T::Hash[String, T.nilable(String)]).returns(Row)}
  def self.from_csv_row(row)
    new(
      txn_date: Date.strptime(T.must(row["Date"]), "%m/%d/%Y"),
      txn_id: T.must(row['Transaction ID']),
      account: T.must(row['Account']),
      amount: T.must(row["Amount"]).gsub('$', '').gsub(',', '').to_f,
      description: T.must(row['Description']).gsub(/\+? /, '').capitalize,
    )
  end
end

We create Rows from the Tiller spreadsheet's CSV rows. Every row consists of five fields, all defined as const which guarantees that nothing can change those fields once we've called new.

We can then pass a Row instance around in our program and lean on the static typechecker and runtime to ensure that we're using it correctly everywhere.

My only problem with T::Struct is that you can't subclass one due to limitations in the typechecker. If you want the prop/const behavior but you don't necessarily care about the other guarantees that Struct gives you you can either subclass T::InexactStruct or include a few modules:

class NotQuiteAStruct
  include T::Props
  include T::Props::Constructor

  prop :something, String
  const :something_else, String
end

NotQuiteAStruct.new(something: 'abc', something_else: 'def')

I use this in a couple places in LedgerTillerExport, namely for RegexpRule and Exporter to make them easily subclassable.

There are lots of other things to like about Sorbet. Method signatures, the typechecker is super fast, etc.

If you follow the rules Sorbet eliminates entire classes of tests that one would otherwise have to write to guarantee your program is correct.

Tagged: Personal Finance  Software 

Read More

Automatic Insurance

19 February 2019

The Setup

  • $1.5 million of term life insurance on me
  • A smaller amount of term life insurance on my wife
  • A private disability insurance policy on me that pays $5,000/mo if I can't program computers anymore, for up to 2 years
  • Employer sponsored short and long term disability insurance
  • Employer sponsored health insurance
  • Auto, home, and umbrella insurance

Why

My future income is currently my family's largest asset.

Term life protects my family if I die before the kids go to college. Disability protects them if I'm incapacitated but don't die. Health protects our assets from medical bankruptcy. Auto, home and umbrella protect our assets from car crashes, fires, and slip and fall incidents.

We own term life insurance because it's the simplest, cheapest possible product. If you die they pay. If you die before 2 years have passed they'll dig into your application and make sure you didn't lie or omit anything, but that's the only wrinkle. Never buy whole, universal, or variable life insurance. It combines insurance with investing on very bad (for the customer) terms.

I have both employer sponsored and private policies because my health history makes it difficult and expensive to get the amount of insurance that we need. The combination, while a little more complicated, helps me sleep easier.

Tagged: Personal Finance 

Read More

Automatic Investing

19 February 2019

The Setup

How Money Flows

  • Every investable dollar is in FFNOX across all account types
  • Automatically purchase a fixed amount of FFNOX in the brokerage account every pay period
  • Automatically contribute to my employer's 401K plan every pay period
  • Once per year fund our Roth IRAs
  • Once per year fund our Solo 401K (if possible/advantageous)

Why

I don't want anyone to have to think about where to pull money from at any time. I want me or my wife to be able to login to Fidelity and sell enough to cover cash needs with a very small number of clicks.

FFNOX is a fund of funds consisting of four inexpensive Fidelity index funds. It invests in 60% US total stock market, 25% international developed total stock market, and 15% US total bond market. This fits our family's desired asset allocation.

The brokerage account has margin enabled. Margin allows you to borrow up to 50% of the value of your investable assets (everything but cash and CDs) from your broker for any purpose whatsoever. It kicks in while you run out of cash and will automatically pay itself back when you deposit cash in the account.

We have margin turned on so that we don't have to worry about selling investments to raise cash while something awful is happening. We can login to Fidelity and sell some FFNOX when it's convenient rather than having to do it one some kind of schedule.

We have automatic investing turned on so that I don't have to make a decision to purchase twice a month. I'm frequently tempted to mess with the program but my own lived experience and that of countless others suggests that the more hands off I can be the better off I'll end up.

Contributing to my employer's 401K plan is an automatic tax break and also means I get my employer's matching contribution. I have it set up to max out my contribution space ($19,000 for 2019) by dividing that by the number of pay checks in the year and setting a fixed dollar contribution.

We fund the IRAs and Solo 401Ks once a year just for practicality.

We're right on the bubble where sometimes we have to do what's called a "backdoor" Roth IRA contribution and that's complex enough that I only want to deal with it once a year.

The amount we can contribute to the 401K depends on how much self-employment income I raised during the year. It only makes sense to calculate at tax time.

We don't use robo-investors. FFNOX's total expenses are capped at 0.08%, or $80 per $100,000 annually. Wealthfront charges 0.25% (more than 3x) on top of the fees for the actual ETFs (typically ~0.1%). Robo-investors are never going to offset their fees when compared to FFNOX or similar funds (Target Retirement funds at Vanguard or Freedom Index funds at Fidelity).

Tagged: Personal Finance 

Read More

Automatic Finances

19 February 2019


My friend Amy Hoy recently tweeted about financial planning and personal finance. This particular tweet stuck out to me:

Last year I radically simplified my family's personal financial system and made everything as automatic as possible. Amy and Joel Hooks asked me to write up how it works, so this is the start of a series of short posts about how and why I set everything up.

A Little Bit of Why

I prefer to think of myself as a realist. Due to my health history my wife is likely going to be around longer than me. Her family has some very long lived female members as well. Her grandmother is 103 and her great aunt just passed in 2018 at the ripe old age of 95.

I want to make our finances as simple as possible so she doesn't have to worry about them when the inevitable happens.

In 2016 my wife and I welcomed our first child into the world and in late 2018 we welcomed our second. They are two more very important reasons why I want things to be simple. If something happens to both my wife and me, I want our intentions with regards to our finances as plain as possible.

This system got a trial run in late 2018. My wife was admitted to the hospital at 29 weeks pregnant for preeclampsia, a very dangerous condition that needs close monitoring. My daugther was born at 34 weeks and spent the next five weeks in NICU.

I didn't have to touch this system at all. Not once. I logged in a handful of times to check up on it, but everything just hummed along.

Tagged: Personal Finance  _evergreen 

Read More

Automatic Cash Management

19 February 2019

The Setup

How Money Flows

  • Payroll direct deposited into brokerage
  • All non-mortgage, non-Amazon expenses are paid with the Fidelity credit card
  • Bills autopay from brokerage (credit cards, insurance, billpay to household vendors)
  • Debit cards and live paper checks written against CMA

Why

We use a brokerage account because it lets us keep cash and investments in the same account. All of our cash, including working capital and reserves, sits in the brokerage's core position. Our core position is FZFXX, a Federal money market fund that pays ~2% interest.

We use the Fidelity credit card because it pays 2% cash back when it's set up to deposit rewards into a Fidelity account. It is also one of the only cards I've seen that can be set to automatically cash out deposits. Ours is set to deposit into the brokerage account.

We use the Amazon Prime credit card for all Amazon expenses. This pays 5% back on Amazon purchases which makes it worth it for us. Your milage may vary.

We have the CMA so we don't expose the brokerage account number every time we write a paper check. This is probably overly paranoid and is the only significant complication in the entire system.

The CMA can optionally have "self-funded overdraft protection" turned on, which would automatically transfer from the brokerage account into the CMA to fund checks and debit card transactions. We don't have this turned on, again mostly for paranoia. We make so few transactions like this that it's no problem to top up the account every few months.

The brokerage core position is not FDIC insured. I don't care about FDIC insurance. FZFXX is composed of ultra short term US Treasury bills. If Treasuries are suddenly not liquid enough to withdraw our money our society has much bigger problems.

The CMA's core position is FDIC insured, and the CMA is almost a full brokerage account, but we don't use it as the centerpiece account for two reasons. First, the CMA core position pays shit for interest. Second, the CMA cannot have margin turned on. We'll talk about why that's important in the next post.

Tagged: Personal Finance 

Read More

Organizing Your Consulting Business

31 August 2015

This is an excerpt from my upcoming book Handle Your Business - the Succinct Guide to Money and Finance for the Self-Employed. Enter your email at the bottom for updates, early access, and a coupon when the book launches.

A business is a legal fiction. It only exists in so far as we and the courts believe it to. It's an entity made of pure thought, even more so than a computer program. When you write a computer program you're causing the computer to take physical actions. When you form a business, you're literally willing a new thing into existence.

This may seem like a trivial point, but you only get the benefits of a business as long as other people believe it exists. What are those benefits, you ask? There are two big things you get by forming a separate business entity:

  • limited personal liability for the financial liabilities of the company
  • tax incentives

You could just start doing business as yourself. You may have already. You could, in fact, just ignore this whole chapter, and there's nothing really wrong with that. But, you don't get those two things above.

Limited Liability

For a freelancer or consultant, there's honestly not a lot of benefit to the limited liability portion. Let's walk through a situation that might happen to you as a software developer. You write a system for a client that processes credit cards, using the latest in PCI-compliant systems like Stripe or Braintree so you're not storing credit card data on the client's servers. You do the best you can do to make it as secure as possible, but let's say there's a bug in the underlying framework. An attacker gets into the client's machines and modifies your code such that it starts skimming credit card numbers.

The credit card company identifies your client's system as the source of the leak and shuts down their merchant account. Your client sues you AND your business for negligence.

The liability shield built into the business might protect you, assuming you included the right language in your contract, but you're still on the hook for paying a defense lawyer. In the chapters on Insurance and Contracts we'll talk about ways to protect yourself, but just know that the business, by default, isn't really there to protect against this kind of liability.

"Limited liability" is much more narrow than that. It actually means you're not liable for debts the business owes by itself. For example, if your business took out a loan to purchase something, and then fell behind on payments and ended up in bankruptcy, your liability for that loan ends at the amount of money you have invested in the business. Unless the bank demanded a personal guarantee from you, of course. In that case you're still on the hook.

Tax Incentives

The biggest boon when you have a separate business entity is the tax deductions available when you're operating for profit. Businesses are taxed on their profits, not their total revenue (except in some states that have a gross revenue tax). Here's some examples of things you can write off as a business owner that you can't when you're an employee:

  • full cost of health care insurance premiums
  • full cost of business insurance premiums
  • mileage on your car
  • new computer equipment
  • phone and internet service, including web hosting
  • meals with clients
  • home office

Any expense the business incurs in the normal course of operations counts as something you can deduct in some way. There are rules surrounding some deductions because they're been abused in the past, but for purposes of this discussion just know that almost every expense is tax free.

Types of Business Entities

Broadly speaking, there are three different types of entities you can start.

Sole Proprietor and Partnership

First you have the defaults. If you just start charging people money for goods or services as yourself, you're by default a Sole Proprietor. The buck starts and stops with you. You reap all the profits from your business, and you're liable for everything your business does, because you are your business. A partnership is the same thing except you have two or more people involved instead of just yourself.

Corporations

Sole proprietors and partnerships are the original ways to do business, and they're the simplest to form (do nothing). That said, they have a lot of drawbacks, especially around liabilities. Thus, the corporation. Story time: a long time ago people would get together and fund trade expeditions. They would pool their money, take out loans, hire a ship and a crew, and send them out to find riches and trade routes. Exploration is a dangerous game. Sometimes (i.e. all the time) a ship would sink, the crew would disappear, and the banks that gave the group loans would demand their money back. They would find the richest investor and demand compensation, and the courts would give it to them, sometimes to the point of sending investors to debtors' prison.

Investors were naturally hesitant to invest in new expeditions, because the risk of catastrophic loss and subsequent personal loss was so high. So, they got together with their friends on the government and wrote down a way to limit their liability to just the money they put into the business.

A corporation is a separate legal entity from the owners. It doesn't die until it's killed. It can have bank accounts, buy things, sell things, and generally go about conducting business as if it were a sole proprietor, all while protecting the owners from their debtors. To this day, corporations are the most common form of formal business entity.

Modern corporations are great if you want your business to have lots of little shareholders or you want to retain significant money in the business. They also come with all kinds of required formalities, like annual meetings, stock certificates, and other paperwork. Corporations have to file their own tax return and have their own tax brackets. This means you would probably end up paying taxes twice on some portion of your company's revenue, which is not ideal. There are ways to minimize it, but consultants aren't looking for this kind of thing, so a corporation is probably not the best idea for them.

LLCs

An LLC (Limited Liability Company) is a hybrid between a partnership and a corporation. The owners enjoy limited liability without all of the paperwork that a corporation requires. In trade, they give up the ability to sell shares to the public, among other things.

You can conjure up an LLC in 10 minutes by filling out a form and sending it into your state's Secretary of State along with the registration fee. Bam. New company, born in less time than it takes to buy a cup of coffee.

The rules for the internal workings of an LLC vary by state, but the common ones are:

  • File with the state periodically (some states are annual, some are every other year)
  • Usually pay some sort of franchise fee or tax
  • Don't commingled personal and business assets (i.e. have a separate bank account)
  • Don't commit fraud

Every state's LLC law sets out default rules and then allows you to write an Operating Agreement to override them. For all practical purposes, single-member LLCs like your baby consulting company can generally get by with the default rules or a simple agreement like the following:

http://www.northwestregisteredagent.com/single-member-llc-operating-agreement.html

Yes, you'll be signing a contract by yourself. The point is that you have written processes in place for your business, which helps to enforce the notion in your mind and other peoples minds that the business is in fact a separate entity. Remember, a business only exists if people believe it does.

Taxes and S-Corp Elections

By default, an LLC is a "pass through" entity. The IRS doesn't acknowledge its existence, calling it a "disregarded entity", which means all of the revenues and expenses from the business flow onto your personal tax return and are taxed at the personal rates. Most states don't tax LLCs individually either, except for yearly registration fees, but some states like California have a tax on your gross receipts with a minimum of $800.

When you work for a business as a normal employee, the business reports what they paid you and how much they withheld for taxes to you and the IRS on form W-2. There are three Federal-level taxes on a W-2: Federal income tax, Medicare, and Social Security. As an employee, you only see half of the Medicare and Social Security taxes withheld from your paycheck. Your employer pays the other half and gets to deduct it on their income taxes. Each half of Social Security is 6.2% up to $118,500 in wages, and each half of Medicare is 1.45% on all wages.

As a business owner you are your own employer. This means you get the privilege of paying both halves of Medicare and Social Security, which comes to a total of 15.3% on the first $118,500 in income and 2.9% of every dollar after. You do get to deduct half of that when figuring how much is subject to income tax, but it's still a hefty bite.

Long ago the IRS decided to allow a special type of corporation, called a Sub-chapter S corporation, to reduce how much they pay for Social Security and Medicare. When a corporation elects Sub-chapter S status they agree to certain rules, including pass-through taxation like a partnership or sole proprietor, limited number of shareholders, and rules about the types of stock they can issue and who can own it. In return, they get to decide how much each owner gets paid as wage vs dividend and thus how much self-employment tax they pay.

The IRS allows LLCs to make this same election. Here's an illustration, assuming $100,000 of taxable income and a reasonable wage of $60,000.

Disregarded Entity S-Corp Diff
Taxable Income $100,000 $100,000 $0
Wage $0 $60,000 $60,000
Social Security $12,400 $7,400 $5,000
Medicare $2,900 $1,740 $1,160
Total SE Tax $15,300 $9,140 $6,160

By electing S-corp taxation you save yourself $6,160 in taxes. Here's another example, this time assuming $200,000 in taxable wages and $140,000 reasonable salary:

Disregarded Entity S-Corp Diff
Taxable Income $200,000 $200,000 $0
Wage $0 $140,000 $140,000
Social Security $14,694 $14,694 $0
Medicare $5,800 $4,060 $1,740
Total SE Tax $20,494 $18,754 $1,740

In this case you only save $1,740 because of the wage cap on Social Security.

As you can see, the benefits of S-corp taxation are massive when you have below $200,000 in taxable income per member for the year. They start to phase out at the Social Security wage cap, but there are some big deductions you can take to keep your taxable income near that level.

Save for Taxes!

As you can see, as a successful business owner you are going to be paying taxes. Don't be surprised next April when you see your bill by making estimated payments each quarter. The IRS's due dates for quarterly payments are:

  • April 15th
  • June 15th
  • September 15th
  • January 15th

No, these are not calendar quarters, but I have yet to see a good explanation as to why Stick them in your calendar with reminders so you don't forget.

How do you figure out how much to pay? For first year, don't stress about it too much. The IRS doesn't really care that you make uneven payments, just that you pay at least 100% of what you paid last year or 90% of what you need to pay this year by April 15th. Also remember that if you or your spouse had a job at any point in the year you paid at least something in already, so you can subtract that out when figuring out an estimate.

For subsequent years you and your accountant can figure out how much your quarterly payments should be.

Summary

In sum, here's how you should organize your business:

  • Form an LLC in your state
  • Elect S-corp taxation by filing form 2553 with the IRS
  • Save for taxes and pay quarterly

In later chapters we're going to talk about the other things you should do to maintain the separation between you and your business, including contracts, banking, and insurance.

Tagged: Business  Personal Finance 

Read More

Program Your Finances: Algorithmic Savings

17 June 2015

When I started my first full time job in 2007 I started putting away a little bit of my paycheck every two weeks into savings. For the past two years I haven't been doing that manually. Instead, I've been using Ledger's fantastic automated transactions to put money away without having to think about it, both for long term goals and envelope budgeting.

Automated saving transactions have been great, except that they never really captured the whole picture, nor did they fit a few constraints I wanted:

  • When a fund is below a minimum threshold it should get priority
  • When a fund is above a maximum it should not receive any more savings
  • I don't want to save any more than I actually have available in a given month

For example, I keep an emergency fund that I keep at about $15k. If it falls below, say, $13k, I want to boost it up as fast as possible. But, if I only have $10 left at the end of the month I don't want to try to save more than that.

Algorithms

Ledger's automated transactions can't reach that kind of flexibility because they don't have access to arbitrary account balances (at least as far as I can tell). Also, because they're evaluated at parse time, the first 300 lines of my ledger file are automated transaction rules.

Instead of using automated transactions, I wrote a little program that generates a transaction to be pasted into my ledger. It takes the three constraints above and turns the cash left over at the end of the month into savings without me having to put numbers into a spreadsheet and manually construct the Ledger transaction.

The algorithm happens in two stages and acts on a set of rules, something like this:

RULES = [
  { 'Emergency'      => { min: 13000, max: 15000, weight: 10 } },
  { 'Medical'        => { min:  1500, max:  4000, weight:  8 } },
  { 'House'          => { min:  3000, max: 15000, weight:  8 } },
  { 'Furniture'      => { min:   200, max:  4000, weight:  4 } },
  { 'Travel'         => { min:  2000, max: 20000, weight:  4 } },
]

It also depends on having a few numbers available, namely the balance of each fund in the set of rules as well as how much excess cash there was at the end of the month.

The algorithm then takes two passes over the rules.

  1. Sum up the weights in all of the rules. If the account balance is greater than or equal to the max, set the weight to zero. If it's below the min, multiply the weight by 4. Keep track of the total weight in the set and the calculated weight for each rule.

  2. For each rule, calculate the percentage "share" by dividing the account weight by the total weight. Then calculate the amount of this share by multiplying it by the remaining income, up to the max for that fund. Subtract that amount from the remaining income, subtract that rule's weight from the total weight, and continue down the rules until you're out of money.

Each rule is evaluated in terms of two shrinking pies: the total weight and the remaining income. When no funds hit their max value this is strictly equivalent to a straight percentage savings, but elegantly deals with both the min and max situations.

Here's what that looks like in code:

account_weights = {}
total_weight = 0

RULES.each do |rule|
  account = rule.keys.first
  rules = rule.values.first
  weight = rules[:weight]

  if (fund_balances[account] || 0) < rules[:min]
    weight = weight * 4
  elsif fund_balances[account] >= rules[:max]
    weight = 0
  end

  total_weight += weight
  account_weights[account] = weight
end

xtns = {}
RULES.each do |rule|
  account = rule.keys.first
  rules = rule.values.first
  weight = account_weights[account]
  balance = fund_balances[account] || 0
  share = weight.to_f / total_weight.to_f

  deposit_amount = [
    remaining_income * share, 
    rules[:max] - balance
  ].min

  next if deposit_amount.round == 0

  total_weight -= weight
  remaining_income -= deposit_amount
  xtns[account] = deposit_amount
end

This algorithm has some great properties:

  • The priority of a fund is determined by it's placement in the rules. Earlier funds get funded before later funds.
  • The amount a fund gets is determined by it's weight. Higher weight gets a bigger share.
  • Funds below their minimum get plumped up with the weight multiplier, while full funds automatically drop out.

The only drawback is that I have to manually run this script every month, but I feel like that's a small price to pay for the flexibility this gives me. If you're interested in the gory details of the script I put the whole thing in a gist. I'd love to hear your thoughts, even if you just want to tell me I'm crazy.

Tagged: Personal Finance  Ledger 

Read More

Pay Your Taxes!

8 May 2015

"I'm in deep with the IRS."

"We ended up owing $15,000 this year."

"I don't have that kind of money just laying around. How do I file an extension?"

Sound familiar? Maybe you're a freelancer. A consultant. An independent business person. Somehow, some way, you've got money coming in that isn't from a normal everyday W2 job.

One thing's for sure: you have to pay taxes on that.

What? Taxes?

Yep. Taxes. That thing you don't want to think about because other things are way more important, like actually running your business and bringing money in and buying groceries and cutting your toe nails.

Still, you have to pay them or the IRS gets cranky. Crankier than your two year old after a six hour car ride. Crankier than your cat is at the vet. Suffice to say, probably something you'd rather avoid.

How much?

It's your honor and duty as a citizen of the United States to pay as little as you can possibly get away with, but no less. As a business owner (because that's what you are, you lucky dog you) there are all kinds of tricks and deductions and things you can do to reduce what you owe, but that's a lot to think about and really that's why accountants exist and can charge so much.

The simplest thing you can do to avoid the IRS's ire is to pay what you paid last year.

Yep. It's that simple.

Look at your last Form 1040, find the line where it says "Total Tax" (line 63 on Form 1040, line 12 on 1040EZ), and pay that. Same with your state taxes, if you have state income tax.

When?

Quarterly. Except not really.

Specifically, you'll divide up that amount from last year into four equal payments and send the IRS a check and a Form 1040ES (or pay online with EFTPS) on these dates:

  • April 15
  • June 15
  • September 15
  • January 15

If you notice, those are not equal time periods. The IRS likes to keep things interesting.

What if I'll make more this year than last year?

Awesome! High five! That's how you run a successful business.

Here's what I do:

  1. Set aside 30-40% of every invoice payment into a separate money market account.
  2. Every quarter, I pay the quarterly payment we figured out above from that money market account.
  3. At the end of the year, I send the IRS a check for whatever we owe on top of the quarterlies.

If you know how much you're going to be making you can do some math to figure it out and send in the extra on the quarterlies, but usually it's not worth it.

The percentage you set aside is going to depend a lot on your situation and location. For your first year it's safer to set aside 40% and then dial in the next year.

What if I'll make less?

No problem. If you know you're going to be making less, you can just reduce your quarterlies. Alternatively, you can just send the IRS some money every quarter. As long as you pay at least 90% of what you'll owe by the end of the year the IRS is happy.

But what if...

There there. It's ok. Taxes are complicated.

You still have to pay them.

Tagged: Business  Personal Finance 

Read More

Program Your Finances: Envelope Budgeting

8 April 2015

Note: you can find much more information about ledger on ledger-cli.org, including links to official documentation and other implementations. Also, check out my intro to accounting with Ledger.

A few years ago I heard about YNAB, or You Need A Budget. YNAB is a set of rules and associated software that help people to dig themselves out of financial holes and prosper with a budget. The rules are:

  1. Give Every Dollar a Job
  2. Save for a Rainy Day
  3. Roll With the Punches
  4. Live on Last Month's Income

YNAB embraces both traditional budgeting, where you have a fixed amount of money every month for a category, as well as "envelope budgeting", where you put a fixed amount every month into a category, but if you don't spend all of that it rolls to the next month.

In this blog post I'm going to talk about how to smoothly implement envelope budgeting in Ledger land.

Envelope Budgeting: A Primer

Envelope budgeting is a pretty simple concept. When you receive a paycheck, you separate out a certain amount of money for each category and put it in an envelope. When the money in the envelope is gone, you can't spend any more for that category. Some financial systems actually have you draw out your entire paycheck in cash and put it into physical envelopes, but we're not going to go that far.

Chart of Accounts

If you've ever taken an accounting class you're probably familiar with the concept of a "chart of accounts". In an accounting system, your accounts make a tree, starting from five root accounts:

  • Assets
  • Liabilities
  • Income
  • Expenses
  • Equity

For example, if you have a checking account, that's an asset, like this: Assets:Checking. A credit card would be a liability: Liabilities:Credit Card. Your paycheck would be income: Income:Salary, and getting groceries would be an expense: Expenses:Food:Groceries. Equity is out of scope for this discussion, but in a personal finance system it's typically used when you're declaring opening balances in accounts.

Parallel Accounts

The best way to implement envelope budgeting in Ledger is using a parallel chart of accounts. That is to say, a set of accounts that's outside of your normal real-money assets, income, expenses, or liabilities. I've chosen to use Assets:Funds and Liabilities:Funds ("fund" as in "slush fund") in the examples that follow, but you can use whatever you want as long as it doesn't mix with your real money accounts.

Let's say our water bill comes every other month and averages $100. In a traditional monthly budgeting system this would be hard to account for, since some months will be zero and some will have a charge. With our parallel accounts, though, this is easy:

2015/04/02 * Salary
    Assets:Checking              $1,000.00
    Income:Salary

2015/04/02 * Water Bill Accrual
    Assets:Funds:Water              $50.00
    Liabilities:Funds:Water

2015/05/02 * Salary
    Assets:Checking              $1,000.00
    Income:Salary

2015/05/02 * Water Bill Accrual
    Assets:Funds:Water              $50.00
    Liabilities:Funds:Water

At the beginning of April and May, we receive our salary deposit and set aside $50 each time for your water bill. Notice how, in the accrual account, we're depositing into our Assets:Funds:Water account and balancing it out from a companion liability. This reflects the fact that in double entry accounting every transaction has to balance, and dedicated balancing liabilities make things easier later on. Here are our balances:

           $2,100.00  Assets
           $2,000.00    Checking
             $100.00    Funds:Water
          $-2,000.00  Income:Salary
            $-100.00  Liabilities:Funds:Water
--------------------
                   0

Now let's look at what happens when our water bill comes due:

2015/05/03 * Water Bill
    Expenses:Water                  $95.00
    Assets:Checking                $-95.00
    Liabilities:Funds:Water         $95.00
    Assets:Funds:Water             $-95.00

Notice how we pull $95 out of our checking account and also pull $95 out of our Liabilities:Funds:Water account.

Here's what the balances look like now:

           $1,910.00  Assets
           $1,905.00    Checking
               $5.00    Funds:Water
              $95.00  Expenses:Water
          $-2,000.00  Income:Salary
              $-5.00  Liabilities:Funds:Water
--------------------
                   0

$95 went from the checking account into the water expense and the water fund still has $5 in it.

Automated Envelopes

This system would be a pain in the butt if we had to manually track it for every transaction. Thankfully, Ledger has us covered with automated transactions.

An automated transaction looks a lot like a normal transaction, except it starts with an = and has an expression instead of a payee and date. Let's see what our water accrual rule looks like:

= /Income:Salary/
    * Assets:Funds:Water         $50.00
    * Liabilities:Funds:Water   $-50.00

In this example the expression is a regular expression surrounded by /s. /Income:Salary/ will match any posting with that as the account name.

After the expression we have two lines. They start with a * to indicate that they're cleared transactions. Next is the account name and an amount, just like in a normal ledger transaction.

Now, let's set up a matching rule for spending out of the envelope:

= /Expenses:Water/
    * Liabilities:Funds:Water      1.0
    * Assets:Funds:Water          -1.0

This one is very similar to the first, except for those amounts. Notice how they don't have a commodity attached to them? In automated transactions, ledger will treat an amount without a commodity as a percentage, where 1.0 = 100%. This rule means that we want to match every water expense and pull 100% of it out of our water envelope.

Putting it all together, here's what the automatic version looks like:

= /Income:Salary/
    * Assets:Funds:Water            $50.00
    * Liabilities:Funds:Water      $-50.00

= /Expenses:Water/
    * Liabilities:Funds:Water          1.0
    * Assets:Funds:Water              -1.0

2015/04/02 * Salary
    Assets:Checking              $1,000.00
    Income:Salary

2015/05/02 * Salary
    Assets:Checking              $1,000.00
    Income:Salary

2015/05/03 * Water Bill
    Expenses:Water                  $95.00
    Assets:Checking                $-95.00

Here's the resulting register report:

15-Apr-02 Salary     Assets:Checking          $1,000.00 $1,000.00
                     Income:Salary           $-1,000.00         0
                     Assets:Funds:Water          $50.00    $50.00
                     Liabilities:Funds:Water    $-50.00         0
15-May-02 Salary     Assets:Checking          $1,000.00 $1,000.00
                     Income:Salary           $-1,000.00         0
                     Assets:Funds:Water          $50.00    $50.00
                     Liabilities:Funds:Water    $-50.00         0
15-May-03 Water Bill Expenses:Water              $95.00    $95.00
                     Assets:Checking            $-95.00         0
                     Liabilities:Funds:Water     $95.00    $95.00
                     Assets:Funds:Water         $-95.00         0

For every paycheck, $50 went into our fund. When we paid the water bill, $95 came out of the fund. To set this up for more envelopes, just create a corresponding pair of rules for each one.

One last thing. What if we want to change how much we're setting aside in the water envelope? Let's say our rates go up and we now need to save $55 from each paycheck instead of $50. Here's how we do that:

= /Income:Salary/ and expr date >= [2015/04/01] && date < [2015/06/01]
    * Assets:Funds:Water         $50.00
    * Liabilities:Funds:Water   $-50.00

= /Income:Salary/ and expr date >= [2015/06/01]
    * Assets:Funds:Water         $55.00
    * Liabilities:Funds:Water   $-55.00

We can't just delete the old rule because then the transactions from before would be off. Instead, we add date expressions to our rules. Ledger's expression grammar is pretty complicated and not very well documented, but this should be sufficient for the rules you'll be writing for automatic envelopes. Ledger's manual has more documentation on automatic transactions.

I put the examples in this gist if you'd like to play with them. You'll need Ledger 3 installed.

Tagged: Personal Finance  Ledger 

Read More

A Robust Reporting System for Ledger

1 January 2012

Note: you can find much more information about ledger on ledger-cli.org, including links to official documentation and other implementations

For the last five years I've kept my personal finances in order using the ledger system, a sophisticated command line program that consumes a lightly formatted text file. It's helped me repay debts and get everything in order, helping me financially absorb an injury last month that would have been extremely detrimental just a few years prior.

The stock ledger program is exclusively command-line oriented. For quick checks and greping over output, this is fine. For some time, though, I've wanted a more graphical, more robust way of looking at my finances. I've also wanted a more familiar query language, since version 2.0's queries were someone limited and version 3.0's query syntax is not very well documented yet. Last year I wrote a simple system that pushed monthly reports out to static HTML files, which got me part of the way there but I really wanted something more flexible. Something where I can just write an arbitrary query and have the output dumped to HTML.

Thus, I present Ledger Web. In Ledger Web, your ledger is kept in a text file, just the same as always, reports are ERB files, and queries are SQL. Ledger Web watches your ledger file and whenever it changes dumps it into a PostgreSQL database table. It's also quite customizable, letting you set hooks both before and after row insertion and before and after ledger file load.

Tagged: Personal Finance  Ledger  Projects  Ruby 

Read More

Program Your Finances: Automated Transactions

18 December 2011

Note: you can find much more information about ledger on ledger-cli.org, including links to official documentation and other implementations

I've been using Ledger for almost five years now to keep track of my personal finances. For three of those years I've lived with a roommate of one form or another. Part of living with a roommate is splitting up bills. Some people decide to do this by dividing the bills up between roommates. For example, Pete pays the electric and gas bills and Andrew pays the water and the cable. Other roommates decide to nominate one person to have all of the bills in their name and post the amounts due every month for everyone to see. This is what my girlfriend and have been doing and it's been working great. All of the bills are in my name and I give her a summary every month and she hands me a check. Easy peasy.

Of course, being a complete and utter nerd means that I have to make this more complicated than it needs to be in the name of reducing the amount of work I have to do.

Tagged: Personal Finance  Ledger 

Read More

Program Your Finances: Vacation Tracking

4 August 2011

Note: you can find much more information about ledger on ledger-cli.org, including links to official documentation and other implementations

Recently my girlfriend and I visited the wonderful city of Vancouver, Canada. While out of country we tend to use my Schwab Investor Checking account because it carries no fees whatsoever, including currency conversions, and it refunds all ATM fees. Last year when we went to Ireland we just kept all of the receipts and figured it out when we got back, which was excrutiatingly painful. Lost receipts, invisible cash transactions, ugh. It hurts to even think about it. This year, I decided to cobble together a simple system so we could track on the fly. Read on to see how it came together.

Tagged: Personal Finance  Ledger 

Read More

Program your Finances: Reporting for Fun and Profit

9 July 2011

Note: you can find much more information about ledger on ledger-cli.org, including links to official documentation and other implementations

Another note: I've written a new version of this that is much more dynamic and flexible named Ledger Web.

Last year I wrote what ended up being the most popular article on this blog ever, Program Your Finances: Command-line Accounting. That post went over how I track and report on my finances using a program called Ledger along with a few helper scripts. Recently I expanded that toolset quite a bit and wanted to show how keeping meticulous track of your finances can give you superpowers. Read on for the gory details.

Tagged: Personal Finance  Ledger 

Read More

Program your Finances: Command-line Accounting

23 May 2010

Note: you can find much more information about ledger on ledger-cli.org, including links to official documentation and other implementations

About three years ago I was in some serious financial straits. I had just started my first job out of college that I had moved across the country for and had to bootstrap almost my whole life. This meant buying furniture, buying a car, outfitting a kitchen, etc. Every two weeks I would get a salary deposit, and within two weeks it would be almost completely gone from my checking account. I actually bounced a rent check or two in there. After the second time that happened I vowed it wouldn't happen again and started keeping track of every penny that I spent using a program called ledger. This was, in hindsight, exactly what I needed to get myself back on track. Actually seeing money moving in and out of my accounts forced me to modify my behavior. At the time, Mint wasn't around, but I don't think it would have helped nearly as much. Forcing myself to actually type out the transactions was the key to changing behavior.

Ledger is almost the most boring, austere accounting program you could think of. There's no pretty graphs, no online interaction, no GUI of any sort. It's basically a command-line driven calculator with a lot of specializations that make it ideal for tracking finances, which is what makes it so ideal for someone who spends a lot of time inside a text editor. It's very easy to script around and it has a very rich query language that lets you get at the data that you want with a minimum of fuss. It's very much the inspiration for Calorific.

Tagged: Personal Finance  Ledger  _evergreen 

Read More