When is the time of day that working people are most interested in the stock market?

I think it's probably not during the morning hours when the stock market opens.

The stock market that opens after waiting overnight! You can't resist checking it out in the morning, can you?

When I check the stocks that are going up in the morning, my heart flutters. Oh, I should buy before they leave me behind!

When I look at the stocks that fall in the morning, I have a somewhat greedy thought. Oh! It fell, it's the price I've been waiting for. I should buy it!

Whether it's because the price dropped or went up, it seems like the "I have to buy it!" circuit in my brain is highly activated by morning.Not everyone may agree, but it is true that stock trading is most active in the morning when the stock market opens.

So, is it a good choice to buy stocks at the morning price, precisely the opening price (Open-Price)?

Let's find out through simple data aggregation.

 

Before explaining, I want to clarify that this is not an article recommending stock investment or suggesting any specific stock.

Please remember that no one is responsible for any losses incurred in the stocks invested in as a result of this article.

We have verified the accuracy of the data. However, please understand that there may be some inaccuracies due to errors that may have occurred during the data collection process or at the time of data collection.

 

 

Let's use SQL to calculate the average profit rate for the following two trade cases:

  • Case 1: Buy at today's open price and sell at today's close price.
  • Case 2: Buy at today's close price and sell at tomorrow's open price.

Actually, we can't buy and sell stocks every day like in the example above, right? However, if we aggregate the data, we can find some useful information for our investment.

If we use the daily stock price data I have (Korea) and aggregate it by year, the following results are obtained:

Overall, it can be seen that Case2 [Buy at today's closing price and sell at tomorrow's opening price] has a much better average return rate than Case1. Buying at today's opening price and selling at today's closing price, like in Case1, results in mostly negative returns on average.

 

 

This test is completely meaningless for those who invest in value. If you approach investing from a perspective of investing in really good companies, it doesn't matter whether you buy in the morning or in the evening. However, I think this is useful information to refer to when buying stocks.

Conclusion! Buy at the closing price!

The above result can be easily implemented with the following SQL. Are you all studying SQL?

 

WITH W01 AS(
SELECT  T1.STK_CD ,T1.DT ,T1.C_PRC ,T1.O_PRC
		,LEAD(T1.O_PRC) OVER(PARTITION BY T1.STK_CD ORDER BY T1.DT ASC)  AF_O
        ,LEAD(T1.C_PRC) OVER(PARTITION BY T1.STK_CD ORDER BY T1.DT ASC)  AF_C
FROM    HIST_DT T1
WHERE   T1.DT >= '20210101'
 AND     T1.DT <= '20211231'
ORDER BY T1.DT DESC
)
,W02 AS(
SELECT  T1.*
        ,ROUND((T1.C_PRC - T1.O_PRC) / T1.O_PRC * 100,1) `OPEN_CLOSE`
		,ROUND((T1.AF_O - T1.C_PRC) / T1.C_PRC * 100,1) `CLOSE_OPEN`
FROM    W01 T1
)
SELECT  DATE_FORMAT(T1.DT,'%Y')
        ,AVG(`OPEN_CLOSE`) `CASE1_OPEN_CLOSE`
        ,AVG(`CLOSE_OPEN`) `CASE2_CLOSE_OPEN`
        ,COUNT(*) CNT
FROM    W02 T1
GROUP BY DATE_FORMAT(T1.DT,'%Y');

+ Recent posts