Saturday, March 10, 2012

Can Someone Check My Math?

(See Other Posts about Lending Club Extension)

In my last post I announced the first release of a Lending Club Chrome Browser plugin I am writing. I am using it myself and making several improvements. One of the improvements is when you offer a Note for sale it will calculate the annualized return range for a given sales price (range because it could be sold any day from today to up to 7 days later). When I was converting my calculation from my Python script, I noticed I was not happy with the original calculation.

I'd really like to have your feedback on the calculation, and have a math check on it.

In precalculus I learned from Ms. Delores Dean that the basic formula when dealing with compounding interest, or rates of return, is:
A = P (R + 1) T
which reads Amount equals Principal times Interest Rate increased by One raised to Time in years. I also wanted to add in Tax, Fees and Payments made. So my final formula was:
S + P (1 - M) - T (S + P (1 - M) - I - FS) - FS = I (G + 1)Y
The variables are as follows:

  • S - Sales Price
  • P - Payments Made
  • T - Tax Rate (ie 0.395)
  • I - Initial Investment
  • F - Fee Rate (ie 0.01) on Sale
  • G - Annualized Gain
  • Y - Years Held
  • M - Maintenance Fee Rate

If you love a simple math problem that requires algebra, please stop reading here and solve for S. If you love a math problem that requires algebra and a little precalculus, please stop reading here and solve for G.

Now an explanation of the equation above. So the actual amount of money you are left with (A in the first equation) is the Sales Price plus Payments Received minus Tax you'll have to pay minus Sales Fee. The Tax would be your Tax Rate (for a conservative estimate of your tax, I recommend using your short term capital gains rate) multiplied by the sum of your Sales Price and Payments Received minus your Initial Investment minus your Fees Paid. And of course the Fee Paid is Fee Rate times Sales Price.

Of note, I assume that the Payments Made needs to be reduced by the Maintenance Fees Paid. Lending Club states that this is 1%, but remember that it is rounded up, usually $0.01 for $25 Notes. I found that the lowest regular payment I've had this month is $0.61, which the fee ended up being 1.64%. So to be conservative, I put the Maintenance Fee (M) at 2% (or 0.02). Some Notes do not have a Maintenance Fee, but to be conservative (and keep things simple) we'll assume there always is one.

Let me know in the comments if there is a problem with this formula or how I am thinking about it.

Now that you've had some time to work through the math, did you get:
G = eloge( (S + P (1 - M) - T (S + P (1 - M) - I - FS)) / I ) / Y - 1
and
S = (I (G + 1)Y - T (I - P (1 - M)) - P (1 - M)) / (1 - T - F + TF)
Let me know in the comments if you got something different.

Now the formula needs to be converted to JavaScript to actually be used in the Chrome Extension. Here is the JavaScript I had for S:
Math.pow(Math.E, Math.log( (salesPrice + (1.0 - maintenanceRate) * payments - taxRate * (salesPrice + (1.0 - maintenanceRate) * payments - investment - feeRate * salesPrice) - feeRate * salesPrice) / investment ) / years) - 1
and for G:
(investment * Math.pow(1.0 + annualGain, years) - taxRate * (investment - (1.0 - maintenanceRate) * payments) - (1.0 - maintenanceRate) * payments) / (1.0 - taxRate - feeRate + taxRate*feeRate)
Anyone see any problems with the JavaScript? Again, please leave a comment.

This is what I am looking at adding to the Sell Notes page using the Chrome Extension. It will add an Annualized Return column and calculate the return if it were sold as soon as possible up to the date selected for the expiration.

This is not a photoshopped image, this is a screen grab from version 0.2 of the extension.

Currently version 0.1 is available, and lets you filter the Browse Notes on FolioFN. When version 0.2 is ready, I'll post again with a list of the enhancements I have made, as well as the assumptions that go into it. I still have a few glitches to work out, but I am excited about 0.2.

Now with 0.2 I can completely ditch my old Python script that used Apple Events to scrape the web pages of Safari to see what I was seeing and calculate these things. Version 0.2 of the Chrome Extension will even one-up the script with a neat little feature that will save me so much time in selling Notes (I'll reveal that in the next post when I release it).

So if you'll do me a favor (and yourself if you plan on using or trying my Chrome Extension version 0.2) and look over my math. I'd really like this to be peer reviewed before I release it.

In the mean time, I'm really having fun using this. I spend so much less time on the FolioFN site and will have fewer human errors.

If I haven't mentioned it yet, please leave me some feedback on the math above.

Thanks.

No comments:

Post a Comment