Exploring Market State and Stock Interactions on the Minute Timescale

A stock market is a non-stationary complex system. The stock interactions are important for understanding the state of the market. However, our knowledge on the stock interactions on the minute timescale is limited. Here we apply the random matrix theory and methods in complex networks to study the stock interactions and sector interactions. Further, we construct a new kind of cross-correlation matrix to investigate the correlation between the stock interactions at different minutes within one trading day. Based on 50 million minute-to-minute price data in the Shanghai stock market, we discover that the market states in the morning and afternoon are significantly different. The differences mainly exist in three aspects, i.e. the co-movement of stock prices, interactions of sectors and correlation between the stock interactions at different minutes. In the afternoon, the component stocks of sectors are more robust and the structure of sectors is firmer. Therefore, the market state in the afternoon is more stable. Furthermore, we reveal that the information of the sector interactions can indicate the financial crisis in the market, and the indicator based on the empirical data in the afternoon is more effective.

The stock interactions in complex financial systems are usually explored by investigating the equal-time cross-correlation matrix C of price returns [11,12,[21][22][23][24][25][26]. With the random matrix theory (RMT), communities can be identified from C, and they are usually associated with industry sectors [23][24][25]. A number of large eigenvalues of C significantly deviate from the upper bound of the eigenvalue distribution of the Wishart matrix, which is the cross-correlation matrix of non-correlated time series. For examples, the number of such eigenvalues is 5 for the Shanghai stock market. For the largest eigenvalue, the components of the eigenvector are basically uniform and of a same sign for all stocks, which represents the collective dynamic behavior of the prices of all stocks. Thus, this eigenvalue stands for the market mode, i.e., the price co-movement at the market level. For the eigenvector corresponding to every other large eigenvalues, the absolute values of the components are significantly larger for stocks in a certain industry sector [11,19,25,26]. Therefore, the eigenvector is dominated by this sector, and represents the collective dynamic behavior of stocks in the sector. Each of these eigenvalues corresponds to a sector mode, which is the price co-movement at the sector level. The market mode and sector mode may respectively arise from that stocks sharing common information of the market and that of the sector [19]. The RMT may identify the industry sectors in a financial market, but can hardly describe the interactions between sectors. Recently, the sector interactions are investigated with various methods in complex networks, such as the planar maximally filtered graph (PMFG), minimal spanning tree (MST) and map of information flow (Infomap) [27][28][29][30][31].
A stock market is a non-stationary complex system, and the market state evolves with time. To study the price dynamics in the system, we endeavor to investigate the market state. To the best of our knowledge, the price co-movement, e.g. the market and sector modes, and the interaction structure of sectors may reflect the market state. On the daily timescale, various activities have been devoted to the price co-movement and sector structure [11,19,[25][26][27][28][29][30][31][32][33]. However, these two properties on the minute timescale may not remain the same. Since a market or sector is formed by stocks through the stock interactions, the price co-movement and sector interactions essentially originate from the interactions of stocks. The stock interactions are important for the understanding of the market state. For the properties of a financial market on the minute timescale, there have been many studies on the "intraday pattern" [3,[34][35][36][37][38][39]. The intraday pattern mainly concerns the dynamic behavior of a single index or stock near the opening and closing time of the market. Thus, our knowledge on the stock interactions on the minute timescale is still limited.
Financial crises have been of great interest to scientists and investors [40][41][42][43][44][45][46]. It is reported that the first eigenvalue of the cross-correlation matrix C, representing the market mode, can be an indicator for the financial crises, and the more significantly this eigenvalue changes, the more likely a financial crisis would occur [46]. However, it is hard to tell how much change in the first eigenvalue would indicate a financial crisis accurately. To obtain a reliable indicating, one needs more indicators.
In this paper, we investigate the dynamics of the stock interactions, and explore the market state on the minute timescale. Further, we construct an indicator based on the information of the sector interactions to indicate the financial crisis in the market.

Results
On every trading day t, the trading minute is denoted by τ. For example, τ = 9: 30 is the opening time of the market, and τ = 15: 00 is the closing time. For each stock, there are 242 data points of prices in one trading day. The price of the i-th stock on day t at minute τ is denoted by P i (t, τ), and the logarithmic price return is R i (t, τ) = ln[P i (t, τ)/P i (t 0 , τ 0 )]. The time interval between (t, τ) and (t 0 , τ 0 ) is denoted by Δt, and Δt = 242 Á (t − t 0 ) + (τ − τ 0 ) minutes. Due to the Epps effect [47][48][49], the equal-time correlation of two stocks increases with Δt and gradually converges when Δt is larger than one hour. Here for the equilibration of the correlation between any two stocks, we set Δt = 1 day, i.e., According to the trading minute τ, we divide the return time series R i (t, τ) of each stock i into 242 time series, which are R i (t, 9: 30), R i (t, 9: 31), R i (t, 9: 32), Á Á Á, and R i (t, 15: 00). These time series are denoted by R t i ðtÞ. For each minute τ, we compute the cross-correlation matrix C τ , of which each element is Here hÁ Á Ái t represents the average over t, and s R t i is the standard deviation of time series R t i ðtÞ. C t ij is the correlation between the returns of the i-th and j-th stocks at minute τ. In total, there are 242 matrix C τ . In this paper, the strength of the interaction of two stocks is measured by the correlation between the two stocks. Thus C τ contains all the stock interactions at minute τ. In order to study the market state, we investigate the co-movement of stock prices, interactions of sectors and correlation between the stock interactions at different minutes.

Stock correlation and price co-movement
To measure the strength of the stock interactions in the whole market, we calculate the average correlation z(τ) of all stocks at minute τ, where N is the number of the stocks. As displayed in Fig 1, z(τ) is about 0.35 for the first 5 minutes, and sharply decreases to 0.3 at 9: 44. The large average correlation of stocks for the first 5 minutes may result from the call auction, from 9: 15 to 9: 25, before the Shanghai stock market opens. In the call auction, investors trade according to their estimation of the stock performance, and the opening price of a stock is determined by the trade with largest trading volume. After 9: 44, z(τ) remains basically unchanged in the morning. From the first minute in the afternoon, z(τ) increases sharply to about 0.34 in 6 minutes and remains stable for the rest time of the afternoon. Generally, the average stock correlation z(τ) is at two different levels respectively in the morning and afternoon, and z(τ) in the afternoon is 10 percent larger than that in the morning. This result indicates that the market states in the morning and afternoon may be different.
To further study the dynamics of the stock interactions, we calculate the eigenvalues of C τ , and denote the α-th largest eigenvalue by λ α (τ). A number of large λ α (τ) significantly deviate from the upper bound of the eigenvalue distribution of the Wishart matrix, which is the crosscorrelation matrix of non-correlated time series. λ 1 (τ) represents the market mode, i.e., the price co-movement at the market level. The average stock correlation z(τ) mentioned above stands for the sum of all modes, including the market mode, sector modes and other modes. Since λ 1 (τ) is much larger than the other eigenvalues, the market mode is dominating. Therefore λ 1 (τ) behaves almost the same as z(τ). Each of the other large eigenvalues of C τ represents a sector mode, i.e., the price co-movement at the sector level. Among these eigenvalues, the sector structure in the sector mode is more significant for λ 2 (τ), λ 3 (τ), λ 4 (τ) and λ 5 (τ). Thus the sector modes that these eigenvalues correspond to are the four main sector modes. Here we consider the four eigenvalues, and define the eigenvalue of the sector mode as l S ðtÞ ¼ P 5 a¼2 l a ðtÞ. As shown in Fig 1, λ 1 (τ) and λ S (τ) are respectively larger in the afternoon and morning. This result indicates that the price co-movement at the market level is more significant in the afternoon than that in the morning, while the co-movement at the sector level is much stronger in the morning. λ S (τ), to be more specific, is the degree that the prices of stocks in a sector tending to rise and fall at the same time, and thus stands for the correlation of the stocks in a sector. If λ S (τ) is large, the correlation is strong. When building an investment portfolio with various stocks to avert risk, one should consider the correlation between stocks. The difference between λ S (τ) in the morning and afternoon may be helpful to investors in building investment portfolios [50].

Sector interactions
The interactions of sectors are comprised of global interactions of sectors, local interactions of sectors and random interactions of sectors, among which the global sector interactions and local sector interactions are respectively extracted from the market and sector modes [31]. Compared to the global sector interactions, the local sector interactions are higher-order interactions, through which we can observe the fine structure of sectors. Due to the fluctuation of the local sector interactions of the cross-correlation matrix C τ in one minute, we average C τ over τ within a time window T. If T is too small, e.g. 10 minutes, the fluctuation is still large. In one trading day, there are respectively two hours in the morning and afternoon. In order to investigate the evolution of the local sector interactions in the morning, in the afternoon and between the morning and afternoon, we set T = 1 hour. The four hours in one trading day are respectively from 9: 30 to 10: 30, from 10: 31 to 11: 30, from 13: 00 to 13: 59 and from 14: 00 to 15: 00. For the γ-th hour, each element of the average cross-correlation matrixCðgÞ isC ij ðgÞ ¼ hC t ij i t j t2gÀth hour . Here hÁ Á Ái τ represents the average over τ. We adopt the method in Ref. [31], which combines the RMT, PMFG and Infomap, to capture the local sector interactions fromCðgÞ for each hour.
We denote the α-th largest eigenvalue of matrixCðgÞ byl a ðgÞ, and the i-th component of the corresponding eigenvector byũ a i ðgÞ. According to the RMT, a matrixCðgÞ can be decom- We consider the eigenvalues for the four main sector modes, i.e.,l 2 ðgÞ,l 3 ðgÞ,l 4 ðgÞ andl 5 ðgÞ.
Each element of the matrixC sec ðgÞ of the sector mode is defined as Next, a network is constructed from jC sec ðgÞj with the PMFG method. The Infomap method is applied to obtain the main interaction structure of communities from the network, and a map of the community structure is generated. According to the Infomap method, the importance of each stock is different. The more information flows past a stock, the more important the stock is. As shown in Fig 2(a), a circle in a map is a community comprised of stocks. The more important a community is in the network, the bigger the circle is. The line connecting two circles is thicker if the interaction of the two communities is stronger. In the dynamics of complex financial systems, a community is also called an industry sector, since the stocks in a community usually share common economic properties. The sector named "IS-EE", for example, is mainly comprised of subsectors "Information service (IS)" and "Electronic elements (EE)". Thus, the maps of community structure in Fig 2(a) are exactly the maps of the sector structure.
In Fig 2(a), we observe that the interaction structure of sectors evolves with time. The two sector structures in the afternoon are both net-like structure, while those in the morning are more closed to linear structure. Thus, the sector structure in the afternoon is more complicated. The net-like or linear appearances of the structures in the morning and afternoon are robust if C τ is averaged over T = 2 hours, and basically the same for T = 0.5 hour, with some fluctuations. According to Ref. [31], the sector structure of a stock market in the financial crisis period is less complicated than that in the normal period. It indicates that when a market is vulnerable, its structure becomes simpler. In other words, in complex financial systems, a complicated structure is firmer. Therefore the sector structure in the afternoon is firmer than that in the morning.
For a sector, the component stocks, i.e. the stocks that comprise it, are different at each hour. The evolution of the component stocks of sectors for the four hours is displayed in Fig 2  (b). During the evolution, the two sectors, "BM-Trans" and "Health-LI", seem to be the most robust sectors, of which the component stocks basically remain. To quantify the similarity between the sectors in two adjacent maps, we propose a technique to calculate the overlapping percentage of the component stocks of the sectors in the two maps (see S1 Text). 69 percent of the component stocks of sectors overlap for the two hours in the morning, while the value is 80 percent in the afternoon. Between the morning and afternoon, the overlapping percentage is 65 percent. Therefore, the sectors in the two hours in the afternoon are more similar in component stocks, i.e., the component stocks of sectors are more robust in the afternoon. This result basically remains robust for T = 0.5 hour.
In summary, the component stocks of sectors are more robust and the structure of sectors is firmer in the afternoon. Therefore, the market state in the afternoon is more stable than that in the morning.

Correlation between stock interactions at different minutes
The cross-correlation matrix C τ contains all the stock interactions at minute τ. In the previous two subsections, we have investigated the stock interactions and sector interactions, including the average stock correlation, price co-movement, sector structure and component stocks of sectors. However, our knowledge is very limited on the correlation among the stock interactions at different minutes, where certain patterns may exist. To search for these patterns, we construct the cross-correlation matrix M of C τ , and further investigate the co-movement modes of C τ at different minutes in one trading day. Each element of M is Here hÁ Á Ái i, j represents the average over i and j, and s C t ij is the standard deviation of all the elements in C t ij except those on the diagonal. M tt represents the correlation between the stock interactions at minute τ andt. Thus, M is not the same as other correlation matrices in previous research studies [11,12,[21][22][23][24][25][26], which are constructed of equal-time correlations. M contains all the correlation between the stock interactions at two different minutes.
The α-th largest eigenvalue of M is denoted by l M a . For simplicity, we call the first largest eigenvalue the first eigenvalue, and so on. The first three eigenvalues of M are respectively 199.26, 5.72 and 4.11. Since the first eigenvalue l M 1 is much larger than the other M − 1 eigenvalues, the co-movement mode described by the first eigenvector is dominating. For l M a , the τth component of the eigenvector is denoted by ν α (τ). As displayed in Fig 3, the components ν 1 (τ) are almost uniform for all τ, indicating that the first co-movement mode of C τ is basically the same for different τ. The uniformity in ν 1 (τ) is quite similar to that in the first eigenvector of the cross-correlation matrix in previous research studies [11,12,[21][22][23][24][25][26]. We may call l M 1 the market mode of matrix M, and it represents the collective movement of C τ at all minute τ.
In previous works, for the eigenvector corresponding to a sector mode, the components for stocks in a sector are usually of a same sign and similar values. Here we define a sector in an eigenvector of matrix M as the fragment of ν α (τ) with a same sign and successive τ. For the eigenvector of the second eigenvalue of M, the components ν 2 (τ) in the morning are mainly positive, while those in the afternoon are negative. Thus, we call them a "morning" sector and an "afternoon" sector, respectively. Note that for an eigenvector, the physical meaning of the sign of a component is in a relative sense, i.e., the sign of a component is meaningless, unless it is compared with the sign of another component. The second co-movement mode of C τ , characterized by the second eigenvector, comprises the "morning" sector and "afternoon" sector. These two sectors are anti-correlated, and we call them a "sector pair". Thus we may call the second co-movement mode the "day" sector pair. Compared with the first co-movement mode, the second one is a fine co-movement mode, and the anti-correlation is within this mode. Taking into account the absolute values of the components ν 2 (τ), we observe that the values in the morning are larger, suggesting that the co-movement in the morning is stronger.
For the eigenvector of the third eigenvalue, the co-movement mode is dominated by the movement in the morning, since the absolute values of the components in the morning are much larger than those in the afternoon. This mode is mainly comprised of an anti-correlated sector pair, which is in the morning, and we call the mode the "morning" sector pair. From the eigenvectors of the forth eigenvalue, we can hardly identify a co-movement pattern of C τ .
To test the robustness of the results in Figs 1, 2 and 3, we divide the time series of all stocks into two parts, a bull market part and a bear market part, according to the financial crisis on July 20, 2001 (see S2 Text). The results in Figs 1, 2(a) and 3 are robust for the both parts. For the results in Fig 2(b), in the bear market part, the component stocks of sectors in the afternoon are more robust than those in the morning. In the bull market part, the component stocks of sectors in the morning are as robust as those in the afternoon (see S2 Text). Considering the result of the sector structure and that of the component stocks, we find that for both parts, the market state is more stable in the afternoon.
We have shown in the first three subsections that the market states in the morning and afternoon are significantly different. The differences mainly exist in the co-movement of stock prices, interactions of sectors and correlation between the stock interactions at different minutes. In the afternoon, the component stocks of sectors are more robust and the structure of sectors is firmer. Therefore, the market state in the afternoon is more stable.

Indicator for financial crises
Understanding financial crises is important for the risk estimation of investment, and many previous activities have been devoted to the financial crises [40][41][42][43][44][45][46]. In this subsection, we will illustrate that the information of the sector interactions can indicate the financial crisis in the Shanghai stock market, and the indicator based on the empirical data in the afternoon is more effective.
The daily closing price of the Shanghai Index on day t is denoted by P SH (t). A financial crisis is the situation in which a financial market suddenly lose a large part of its value. In this paper, we simply define the financial crisis in the Shanghai stock market as a period shorter than 6 months, during which P SH (t) declines more than 30 percent. We select a large value of P SH (t) before the decreasing trend as the beginning of the financial crisis. The period and beginning are determined qualitatively by visual observation. However, a little alteration in the period or beginning does not affect the robustness of our results in this subsection. As displayed in Fig 4, from July 20, 2001 to January 18, 2002, P SH (t) decreases 35.1 percent. We consider this period as a financial crisis. Before the financial crisis, there are two sharp declines, during which P SH (t) declines 10 percent.
We denote a period of time in one trading day, specifically the morning and afternoon, by X. Periods X = a.m. and X = p.m. respectively represent the morning and afternoon. There are 1013 days in the return time series of each stock. Omitting the returns in the last 3 days, we divide the time series into 101 parts with a 10-day moving window without overlapping. For all the time periods X in the k-th part, each element of the equal-time cross-correlation matrix C X (k) of all stocks is Here hÁ Á Ái t, τ represents the average over t and τ, and σ R i is the standard deviations of R i (t, τ).
For matrix C X (k), we denote the α-th largest eigenvalue by l X a , and the i-th component of the corresponding eigenvector by u X a ðiÞ. We only consider the eigenvalues and eigenvectors of the four main sector modes, i.e. α = 2, 3, 4 and 5, which contain information of sector interactions. The standard deviation of eigenvector ju X a j is denoted by s X u ðaÞ. For an eigenvector u X a , if the absolute values of the components in a same sector are significantly larger than those of other components, the sector structure described by this eigenvector is significant. In this case, s X u ðaÞ would be large. Otherwise, s X u ðaÞ would be small. Thus for eigenvector u X a , the standard deviation s X u ðaÞ is a simple indicator for the significance of the sector structure. We define the indicators I X for time period X as Here l X S ¼ P 5 a¼2 l X a . The indicators I X with X = a.m. and X = p.m. are respectively denoted by I AM and I PM . Then, I AM and I PM are smoothed with a 5-point moving window. The daily closing price of the Shanghai Index on day t is denoted by P SH (t).
The indicators are displayed with P SH (t) in Fig 4. When the financial crisis occurs, both I AM and I PM increase significantly, and are generally much larger in the financial crisis period. The Shanghai Index sharply declines twice before the financial crisis, and the indicators remain basically unchanged or decrease. It suggests that these two indicators are capable of indicating the financial crisis. As shown in Fig 4(b), when or even before the financial crisis happens, I PM increases sharply to a new level, which is significantly higher than the level before the crisis. During the financial crisis, I AM rises gradually. Since I PM is less fluctuating and changes suddenly when the financial crisis occurs, I PM is more able to discriminate the financial crisis from other sharp declines. Therefore, I PM is a better indicator than I AM . In other words, the indicator based on the empirical data in the afternoon is more effective in indicating the financial crisis. This may result from that the market is in a more stable state in the afternoon. The indicator I AM is based on the information of the sector interactions in the morning. Since the component stocks of sectors are less robust and the structure of sectors is less firm in the morning, I AM may contain much randomness, leading it to be less effective.
According to the previous research study [15], the equal-time cross-correlation between stocks is stronger during a financial crisis. Therefore, the interactions within and between sectors in a financial crisis differ from those in a normal period. The indicator I PM captures the sector interactions, and thus can indicate the financial crisis.

Discussion
A stock market is a non-stationary complex system, and the market state evolves with time. The stock interactions is important for the understanding of the market state. However, our knowledge on the stock interactions on the minute timescale is limited.
Based on 50 million minute-to-minute data in the Shanghai stock market, we discover that the market states in the morning and afternoon are significantly different. The differences mainly exist in three aspects, i.e. the co-movement of stock prices, interactions of sectors and correlation between the stock interactions at different minutes. We observe that the average equal-time correlation z(τ) of all stocks is at two different levels respectively for the morning and afternoon. The price co-movement at the sector level is more significant in the morning, while that at the market level is much stronger in the afternoon. By analyzing the interactions of sectors, we detect that in the afternoon, the component stocks of sectors are more robust and the structure of sectors is firmer. Therefore, the market state in the afternoon is more stable. We construct the cross-correlation matrix of C τ to investigate the correlation between the stock interactions at different minutes within one trading day, specifically the co-movement modes of the stock interactions. The first co-movement mode of C τ is basically the same for all minutes. The second mode of C τ , which is a fine co-movement mode, comprises a "morning" sector and "afternoon" sector. These two sectors are anti-correlated, and form a "sector pair".
Furthermore, our results reveal that the information of the sector interactions can indicate the financial crisis in the market, and the indicator based on the empirical data in the afternoon is more effective. This may result from that the market is in a more stable state in the afternoon.
Supporting Information S1 Text. Overlapping percentage of the component stocks of sectors. A technique is proposed to quantify the overlapping percentage between two adjacent maps. (PDF) S2 Text. Sector interactions in bull market and bear market periods. The time series of all stocks are divided into a bull market part and a bear market part, and the sector interactions are investigated for the two parts. (PDF)