Sub topic 6
Automating Recurring Investments
This chapter assumes you know what a share and an ETF are, and that you can compute averages and percentages. It also assumes you have read the earlier chapters on fractional shares, dollar-based orders, and the definition of dollar-cost averaging (DCA). A brokerage account helps but is not required to follow the logic. This is educational material, not personalized financial advice.
What a recurring investment is
A recurring investment is a standing instruction to your broker: "On this schedule, spend this dollar amount on this security." You set it once. The broker then places a dollar-based order on each scheduled date without you logging in.
Two earlier ideas make this work:
- Dollar-based orders let you spend an exact amount, such as $100, even when one share costs far more.
- DCA is the practice of investing a fixed amount at regular intervals, whatever the price.
Automation joins the two. The schedule decides when you buy, the dollar amount decides how much, and fractional shares make the amount fit any price.
The anatomy of a recurring plan
Every recurring plan has the same parts. Brokers label them differently, so look for these.
| Setting | What it controls | Typical choices |
|---|---|---|
| Security | What you buy | A stock, ETF, or index fund |
| Amount | Dollars per purchase | A fixed sum, often with a broker minimum |
| Frequency | How often it runs | Daily, weekly, every two weeks, monthly |
| Start date | First purchase | A specific date |
| Funding source | Where the cash comes from | Linked bank account or cash already in the account |
| End condition | When it stops | Usually none; you cancel manually |
Some brokers also let you split one contribution across several securities, for example 70% to one fund and 30% to another. The plan then creates one order per security each time it runs.
How a scheduled purchase executes
A scheduled purchase is not an instant trade at the moment you set it. Several steps sit between the schedule and your shares.
Funding check
If the money comes from a bank transfer, the transfer may take one or more business days to clear. Some brokers advance the cash to you, and others wait until it arrives. If the cash is missing on the scheduled date, the purchase may be skipped or fail. Brokers differ in whether they retry or notify you, so read the policy.
Timing of the order
Fractional orders are often batched or limited to certain hours rather than filled the instant they are placed. A purchase scheduled for Saturday will usually run on the next trading day. The price you get is the price at execution, not the price you saw when you set up the plan.
Share calculation
The broker divides your dollars by the fill price and rounds down to its supported precision. The earlier chapter on dollar-based orders showed this arithmetic. A small remainder, a fraction of a cent, may stay as cash.
A runnable model of a recurring plan
The following script simulates a monthly plan against a list of fill prices. It tracks shares, total invested, and average cost, and it truncates shares to six decimal places to mimic a broker's rounding. The six-place figure is an illustration, since real precision varies by broker.
from decimal import Decimal, ROUND_DOWN
def run_plan(amount, prices, places="0.000001"):
amount = Decimal(str(amount))
total_shares = Decimal("0")
invested = Decimal("0")
history = []
for month, price in enumerate(prices, start=1):
price = Decimal(str(price))
shares = (amount / price).quantize(Decimal(places), rounding=ROUND_DOWN)
total_shares += shares
invested += amount
avg_cost = invested / total_shares
history.append((month, price, shares, total_shares, avg_cost))
return history
prices = [50, 40, 25, 40, 50]
for month, price, shares, total, avg in run_plan(100, prices):
print(f"Month {month}: price {price}, bought {shares}, "
f"total {total}, avg cost {avg:.2f}")Running this prints the position after each purchase. After month 5 you hold 13 shares for $500, an average cost of about $38.46. That is lower than the simple average of the prices, $41, because the fixed $100 buys more shares when the price is low.
Note that the script divides total dollars by total shares. That is the correct average cost. Averaging the five prices directly would give $41 and overstate your cost.
Choosing frequency
Frequency is a practical choice more than a mathematical one. The main considerations are:
- Alignment with income. If you are paid twice a month, contributing twice a month avoids holding idle cash.
- Fees per transaction. Most major brokers charge no commission on stock and ETF trades, but some charge per trade or per recurring order. When a fee applies, fewer and larger purchases reduce its drag.
- Record volume. Weekly purchases create about 52 tax lots a year per security. That is manageable for software but tedious to check by hand.
- Price smoothing. More frequent purchases sample more prices, but the difference between weekly and monthly is usually small compared with the gap between investing and not investing.
A reasonable default is to match your pay schedule and keep the plan simple.
Choosing the amount
Pick an amount you can sustain through a bad month. A plan that is canceled during a downturn defeats its purpose.
A common method is to work backward from a monthly budget:
- Cover fixed expenses and an emergency fund first.
- Decide what share of income goes to investing, for example 10%.
- Divide that by the number of contributions per month.
- Round to an amount that is at or above the broker's minimum.
monthly_income = 3200
invest_rate = 0.10
contributions_per_month = 2
minimum = 5
amount = max(minimum, round(monthly_income * invest_rate / contributions_per_month, 2))
print(amount)
# 160.0Increasing contributions over time
A fixed amount loses weight as your income grows. Some people raise the amount once a year, often after a raise. Some brokers offer an automatic escalation feature, but many do not, so you may need to edit the plan by hand. Put a yearly review on your calendar so it happens.
What can go wrong with automation
Automation removes effort but also removes attention. These are the usual failure modes.
Silent failures
A plan can fail without you noticing. Common causes include an expired bank link, insufficient cash, a security that becomes restricted, or a closed account. Check your statements or order history after the first run and again each quarter.
Price differences from expectation
Because the order fills at the market price at execution, you cannot know the price in advance. Fractional orders are often market-style orders. In a fast market, the fill can differ from the last quote you saw. For long-term DCA this is small, but it is not zero.
Corporate actions and delistings
Stock splits, mergers, and ticker changes can alter or pause a plan. After a split, your share count changes but your total value does not. After a delisting, recurring orders usually stop. Broker notices explain what happens, so read them.
Overdraft and linked-account risk
If the plan pulls from a bank account, a low balance can trigger bank overdraft fees. Keep a buffer in the funding account, or fund the plan from cash already held at the broker.
Staying invested through losses
Automation continues buying while prices fall. That is the intended behavior, but it also means you keep adding money to a falling position. If the security is a single company, a falling price may reflect real damage, not a temporary dip. DCA does not protect against a company that never recovers. Later chapters cover diversification and the limits of DCA.
Recurring plans and cost-basis records
Each scheduled purchase creates a separate tax lot, which is a record of one purchase with its date, quantity, and price. Your broker tracks these for you. When you later sell, the lots you sell determine your gain or loss. A later chapter covers this in detail. For now, know that automation produces many small lots and that you should keep your broker's confirmations or year-end statements.
A setup checklist
Before you turn on a plan, confirm the following:
- The security is eligible for fractional or dollar-based buying at your broker.
- You know the minimum amount and any fee per recurring order.
- The funding source is linked and has enough cash, with a buffer.
- You know what happens if a purchase fails, and whether you are notified.
- You have decided when to review the plan, for example every quarter.
- You understand that the order fills at execution, not at the price you see today.
Summary
A recurring investment turns DCA from a habit into a standing order. It depends on fractional shares so that a fixed amount works at any price. The settings that matter are security, amount, frequency, funding source, and review date. The main risks are silent failures, funding gaps, corporate actions, and continuing to buy a falling single stock. Check the first run, review regularly, and keep your records.
Exercise
You set up a $200 monthly plan in one ETF. The fill prices over four months are $80, $50, $40, and $100. Assume the broker supports fractional shares without rounding loss. (a) How many shares do you own after four months? (b) What is your average cost per share? (c) Why is the answer to (b) not the simple average of the four prices?
Show answer
(a) Shares bought are 200/80 = 2.5, 200/50 = 4, 200/40 = 5, and 200/100 = 2, for a total of 13.5 shares. (b) You invested $800, so the average cost is 800 / 13.5 = about $59.26. (c) The simple average of the prices is (80 + 50 + 40 + 100) / 4 = $67.50. Your average cost is lower because a fixed dollar amount buys more shares when the price is low (5 shares at $40) and fewer when it is high (2 shares at $100). The average cost is total dollars divided by total shares, not the mean of the prices.
Exercise
A plan pulls $150 every Friday from a bank account that takes two business days to clear a transfer. Your broker does not advance cash. Name two things that could cause a purchase to fail or be delayed, and one way to reduce the risk.
Show answer
Possible causes: the transfer has not cleared by the time the order is placed, so there is no cash to spend; the bank balance is too low and the transfer is rejected; or the bank link has expired. A way to reduce the risk is to keep a cash buffer at the broker so orders are funded from cash already held there, or to schedule the bank transfer earlier than the purchase date. Checking the order history after the first run also catches the problem early.