← Back to journal

Quant research · · 9 min read

An Investing Experiment: Does it Matter When You Buy?

Is there any edge in which day of the week a long term investment is purchased?

Cover image for An Investing Experiment: Does it Matter When You Buy?

Background

For many years, I have been interested in the stock market, investment, quantitative finance, etc. I even spent a few (~18) months learning to “day trade.” While I never did amazing, I learned quite amazing, I learned so much about the market. Years later, this passion for trading boiled over and I began working on a new project: a backtesting engine. The purpose of this project is to test trading strategies using historical data to confirm the success of an idea. In the long term, I hope to use this project to actually test and build trading strategies. But in the meantime the main purpose is to learn and experiment with various market concepts and other financial measures.

This leads me into my first real experiment: determining if there is a “best day” to buy a stock in a long-term investment context. I was talking with my brother (a fin-tech student at Seton Hall) about some investments I was looking at, and the idea popped into my head: “I wonder what day of the week is best to buy my investments?” Of course, we didn’t know, and a simple Google search would tell you no. But I wanted to run my own experiment.

DISCLAIMER: This is not financial advice. I am not responsible for a sudden loss of your money.

The Experiment Criteria

My engine is populated using real market data that is obtained from the Alpaca Markets API. I am able to pull 1-minute bars all the way back to very early 2016. Which leaves us with about 10 solid years of historical data, for countless symbols. The data is fed, minute-by-minute into an event driven engine that passes the data to each part of the system as needed. The entire engine can be thought of as a giant event queue that is reloaded once each event is handled. The entire source code can be found here on my git server.

This experiment consists of 10 backtests: one that purchases at the open and one at the close of each trading day (week days). Furthermore, an experiment was run on a handful of different tickers with a predefined cash investment amount. For example, if the parameters provided to the engine are Monday, Close, $150, VOO then the engine will trigger a buy order of $150 worth of VOO at the open of every Monday.

Because the results are percentages (like most things in finance), the actual dollar amount does not play a role in the result, so each execution will be run with a flat $150 order. This assumption is only possible because liquidity and slippage are negligible (not modeled) in this experiment.

Caveats and Assumptions

Modeling an entire order book, volume, order flow and all the other various moving parts that make up the stock market is very hard. But this project makes a strong effort to account for most of these moving parts. For example, slippage in orders is taken in account and is modeled with a simple fee (usually $0.02 per market order). In this experiment, the strategy only uses Market-on-Open and Market-on-Close orders, which do not typically incur the usual slippage fees. However, this is not a perfect model, so the results may vary slightly from real world results.

Another trade-off I made during this experiment was to ignore dividends. While it would be possible for my engine to ingest dividend payout data and make more accurate calculations, it would lead the project astray from the original purpose. For my purposes (building trading strategies), dividends are not a factor in the outcome of a strategy. Therefore, going through the effort of ingesting them, storing them and using them in this experiment was too far out of scope to justify the work required. But since this experiment is a comparison between results generated by other executions, leaving them out keeps the results fair. In other words, including dividends would likely have the same effect on ALL results, making it a wash.

The same consideration was made for stock splits. Since I primarily ran this experiment on ETFs which don’t split very often, its safe to say that this caveat makes little to no difference in the results.

The last big difference in the engine vs. the real world is the result of holidays and half-days. Implementing an accurate historical trading calendar is no easy task. Similar to the dividends argument, building this calendar and driving the engine through a complex date system would require lots of effort that was unnecessary. As a result, the following conclusions are assumed:

Holidays
  • No market data arrives, so the strategy cannot send a signal
  • A close purchase scheduled for a holiday is simply skipped
  • An open purchase schedule for a holiday may have been queued, but will be expired on the next trading day following the holiday
  • If a holiday if before an intended open purchase, the purchase will also be skipped
Half Days
  • Signals are triggered at 12:00 EST and half-days close at 13:00 EST, so signals can be sent
  • A close purchase on a half day is skipped, since no 15:59 EST bar exists
  • An open purchase on a half day is executed like normal
  • An open purchase scheduled after a half-day are filled like normal

Results

I picked a handful of popular stocks and ETF to run the experiments on to confirm that this is not a single-symbol strategy. After running various experiments, the following results can be observed:

$VOO Results

Execution Cash Investment Final Cash Value Avg Cost Basis Return XIRR
Monday @ Open $243,500.00 $533,832.17 $322.63 119.23% 13.95%
Monday @ Close $249,000.00 $542,431.47 $324.69 117.84% 13.95%
Tuesday @ Open $249,000.00 $541,654.02 $325.15 117.53% 13.93%
Tuesday @ Close $279,000.00 $610,699.38 $323.14 118.89% 13.92%
Wednesday @ Open $276,500.00 $605,861.98 $322.80 119.12% 13.92%
Wednesday @ Close $277,500.00 $608,364.52 $322.63 119.23% 13.93%
Thursday @ Open $270,000.00 $594,600.27 $321.18 120.22% 13.94%
Thursday @ Close $273,000.00 $600,446.27 $321.59 119.94% 13.94%
Friday @ Open $264,000.00 $582,427.72 $320.61 120.62% 13.93%
Friday @ Close $267,500.00 $587,890.18 $321.84 119.77% 13.93%

$QQQ Results

Execution Investment Final Value Avg Cost Basis Return XIRR
Monday @ Open $73,350.00 $221,759.20 $236.61 202.33% 19.41%
Monday @ Close $76,050.00 $229,372.85 $237.17 201.61% 19.38%
Tuesday @ Open $75,600.00 $226,847.50 $238.39 200.06% 19.34%
Tuesday @ Close $84,150.00 $253,968.12 $237.02 201.80% 19.37%
Wednesday @ Open $83,100.00 $250,877.78 $236.94 201.90% 19.36%
Wednesday @ Close $83,400.00 $252,033.38 $236.71 202.20% 19.37%
Thursday @ Open $81,150.00 $246,605.94 $235.39 203.89% 19.38%
Thursday @ Close $82,050.00 $249,175.42 $235.55 203.69% 19.38%
Friday @ Open $79,350.00 $242,212.78 $234.35 205.25% 19.40%
Friday @ Close $81,450.00 $246,799.17 $236.08 203.01% 19.40%

$NVDA Results

Execution Investment Final Value Avg Cost Basis Return XIRR
Monday @ Open $73,350.00 $100,007.13 $156.75 36.34% 5.62%
Monday @ Close $76,050.00 $104,041.76 $156.22 36.81% 5.69%
Tuesday @ Open $75,600.00 $103,217.85 $156.54 36.53% 5.67%
Tuesday @ Close $84,000.00 $115,446.18 $155.51 37.44% 5.77%
Wednesday @ Open $83,100.00 $114,015.63 $155.77 37.20% 5.73%
Wednesday @ Close $83,400.00 $114,291.95 $155.95 37.04% 5.71%
Thursday @ Open $81,150.00 $111,380.51 $155.71 37.25% 5.71%
Thursday @ Close $82,050.00 $112,690.81 $155.61 37.34% 5.72%
Friday @ Open $79,350.00 $109,003.17 $155.58 37.37% 5.70%
Friday @ Close $81,150.00 $111,402.61 $155.68 37.28% 5.72%

$AAPL Results

Execution Investment Final Value Avg Cost Basis Return XIRR
Monday @ Open $73,350.00 $148,810.16 $172.00 102.88% 12.58%
Monday @ Close $75,900.00 $153,511.50 $172.52 102.25% 12.57%
Tuesday @ Open $75,600.00 $152,705.16 $172.75 101.99% 12.55%
Tuesday @ Close $83,700.00 $170,493.52 $171.30 103.70% 12.65%
Wednesday @ Open $83,100.00 $169,474.91 $171.10 103.94% 12.66%
Wednesday @ Close $83,250.00 $169,888.67 $170.99 104.07% 12.66%
Thursday @ Open $81,150.00 $166,009.99 $170.57 104.57% 12.65%
Thursday @ Close $82,050.00 $167,289.79 $171.14 103.89% 12.60%
Friday @ Open $79,350.00 $162,322.31 $170.58 104.56% 12.60%
Friday @ Close $81,600.00 $166,227.52 $171.29 103.71% 12.62%

Conclusion

As you can see, there does not seem to be a clear pattern, and the difference in price for each day is within about 0.10% on average. Such a small amount, that is hardly worth considering.

So is there a “best day?” Google says no and these results agree. The historical difference is far too insignificant to warrant any changes in your strategies! However, this project taught me tons about order types, order book logic, volume flow and so much more.

The only real piece of financial advice I can offer you is that the day, amount, or frequency you invest matters very little. What matters is consistency.

Top