(Hey all. Apologies for my inactivity on Felicifia of late. I've been working on other things, but I hope to return in a few months. However, I thought I would post this in the meantime while it's on my mind.)

tl;dr

Depending on your income, expected rate of return, and purchase transactions fees, it makes sense to buy a new stock about every half month or every month, assuming you manually buy stocks as your vehicle for continuous investment.

Problem

Say you earn $800 post-tax per week, and you want to invest those earnings by buying some random stock. Suppose you think the stock will earn 7% per year in expectation, and for convenience, let's use simple interest. When you buy a stock, there's a fixed transactions fee of $8 per purchase. How many weeks should you wait before you buy a stock in order to optimally trade off the cost of missed investment income against the transaction cost of buying a new stock?

Notation

To generalize, let's say your wage is w = $800, and that you earn n = 52 wages in a year. You expect an annual return of r = 0.07 with simple interest. When buying stocks, the transaction fee is c = $8.

Cost formula

Every wage period when you don't use w dollars to buy stock, you lose out on expected investment income of wr/n, since r/n is the expected interest rate for one wage period.

If you wait two wage periods to buy a stock, w dollars lie idle for one week, and w dollars are used immediately. The only lost income is from the first wage period in the amount of wr/n.

If you wait three wage periods, w dollars lie idle for two weeks, w dollars lie idle for one week, and w dollars are used immediately. The lost income is then (wr/n)(2) + (wr/n)(1).

If you wait k wage periods, the lost income is (wr/n)(k-1) + (wr/n)(k-2) + ... (wr/n)(1) = (wr/n)[k(k-1)/2] using the formula for triangular numbers.

Say you follow this pattern of waiting k wage periods for a long time T, where T is sufficiently big that we can assume it's a multiple of k and ignore the irregularities at the end of the time period. You would then buy stocks T/k times.

The purchase cost of the stocks would be c(T/k). The lost income would be (wr/n)[k(k-1)/2](T/k). The total cost is

which is what we want to minimize.

Minimizing the cost

T factors out of the cost, so it suffices to minimize

While k can only take on discrete values, we can pretend for the moment that this function is continuous so that we can differentiate and set equal to 0:

Note that the second derivative with respect to k is d^2F/dk^2 = 2c/k^3 > 0, so this is indeed a minimum point.

Plugging in values

Using the figures in the original problem, the continuous solution is k = sqrt(2 * 8 * 52 / (800 * 0.07)) = 3.85. Using Excel, I found the actual values of the cost at each k from 1 to 5:

so k=4 is indeed the minimum. In other words, using these figures, you should buy a new stock about once a month.

Alternate values

Suppose instead you're paid twice a month (n = 24), with w = $2000 per pay period and an assumed rate of return of r = 0.10. Then the optimal continuous value of k = 1.4, which means it's better to buy a stock every pay period than to hold on for a second pay period.

Related problems

These situations of accumulating benefits for an action that has fixed cost crop up a lot. For example: How often should you cut your hair? I like to have short hair because it reduces shower time and saves on hot-water bills, but getting a haircut also costs money and time in itself. Every day that you have hair longer than it needs to be, you lose a small amount of money, say L(d), when it's been d days since your last hair cut. L(0) = 0, and then L(d) grows as d grows. The accumulated cost after waiting k days will be sum_i=1^k L(i). The minimization will be the same as before, with the [k(k-1)/2] term replaced by this summation.

tl;dr

Depending on your income, expected rate of return, and purchase transactions fees, it makes sense to buy a new stock about every half month or every month, assuming you manually buy stocks as your vehicle for continuous investment.

Problem

Say you earn $800 post-tax per week, and you want to invest those earnings by buying some random stock. Suppose you think the stock will earn 7% per year in expectation, and for convenience, let's use simple interest. When you buy a stock, there's a fixed transactions fee of $8 per purchase. How many weeks should you wait before you buy a stock in order to optimally trade off the cost of missed investment income against the transaction cost of buying a new stock?

Notation

To generalize, let's say your wage is w = $800, and that you earn n = 52 wages in a year. You expect an annual return of r = 0.07 with simple interest. When buying stocks, the transaction fee is c = $8.

Cost formula

Every wage period when you don't use w dollars to buy stock, you lose out on expected investment income of wr/n, since r/n is the expected interest rate for one wage period.

If you wait two wage periods to buy a stock, w dollars lie idle for one week, and w dollars are used immediately. The only lost income is from the first wage period in the amount of wr/n.

If you wait three wage periods, w dollars lie idle for two weeks, w dollars lie idle for one week, and w dollars are used immediately. The lost income is then (wr/n)(2) + (wr/n)(1).

If you wait k wage periods, the lost income is (wr/n)(k-1) + (wr/n)(k-2) + ... (wr/n)(1) = (wr/n)[k(k-1)/2] using the formula for triangular numbers.

Say you follow this pattern of waiting k wage periods for a long time T, where T is sufficiently big that we can assume it's a multiple of k and ignore the irregularities at the end of the time period. You would then buy stocks T/k times.

The purchase cost of the stocks would be c(T/k). The lost income would be (wr/n)[k(k-1)/2](T/k). The total cost is

c(T/k) + (wr/n)[k(k-1)/2](T/k),

which is what we want to minimize.

Minimizing the cost

T factors out of the cost, so it suffices to minimize

F(k) := c/k + (wr/n)[k(k-1)/2](1/k) = c/k + (wr)(k-1)/(2n).

While k can only take on discrete values, we can pretend for the moment that this function is continuous so that we can differentiate and set equal to 0:

dF/dk = -c/k^2 + wr/(2n) = 0

wr/(2n) = c/k^2

k^2 = 2cn/(wr)

k = sqrt(2cn/(wr)).

Note that the second derivative with respect to k is d^2F/dk^2 = 2c/k^3 > 0, so this is indeed a minimum point.

Plugging in values

Using the figures in the original problem, the continuous solution is k = sqrt(2 * 8 * 52 / (800 * 0.07)) = 3.85. Using Excel, I found the actual values of the cost at each k from 1 to 5:

F(1) = 8

F(2) = 4.5

F(3) = 3.7

F(4) = 3.6

F(5) = 3.8,

so k=4 is indeed the minimum. In other words, using these figures, you should buy a new stock about once a month.

Alternate values

Suppose instead you're paid twice a month (n = 24), with w = $2000 per pay period and an assumed rate of return of r = 0.10. Then the optimal continuous value of k = 1.4, which means it's better to buy a stock every pay period than to hold on for a second pay period.

Related problems

These situations of accumulating benefits for an action that has fixed cost crop up a lot. For example: How often should you cut your hair? I like to have short hair because it reduces shower time and saves on hot-water bills, but getting a haircut also costs money and time in itself. Every day that you have hair longer than it needs to be, you lose a small amount of money, say L(d), when it's been d days since your last hair cut. L(0) = 0, and then L(d) grows as d grows. The accumulated cost after waiting k days will be sum_i=1^k L(i). The minimization will be the same as before, with the [k(k-1)/2] term replaced by this summation.