1 Introduction

This study aims to detect changes in the relationship between various assets in the global financial markets in a highly interpretive manner to support fund manager’s investment decision-making. To achieve this objective, we construct and visualize a network based on the strength of the relationship between each asset, which changes dynamically at each point in time. In addition, we calculate quantitative indices based on the network structure, which enables us to capture the overall trend in the financial market. The method combines visualization and quantification in a way that allows fund managers to examine what kind of changes are happening in the market and what factors are behind those changes, as well as to estimate the scale of those changes. We think that these will help fund managers to make investment decisions.

Anomaly detection of time-series data has been actively studied [1, 2] and is used in various fields. However, in most cases, the research is aimed at improving the accuracy of the detection, and few studies have approached the clarification of the causes of the anomaly at the same time. When such algorithms are used in industry for decision-making, it is often necessary to interpret why such changes and anomalies have occurred. Therefore, we consider that a methodology that combines change detection with visualization to understand the causes of the change will be particularly useful as a tool for decision-making in industry, including finance.

Asset management companies and banks sell mutual fund financial products related to stocks and bonds. In Japan, for example, Japanese stocks, developed country stocks, Japanese bonds, and U.S. bonds are often sold according to the type of asset: stocks for stocks, bonds for bonds, and so on. In recent years, there has been a growing interest among investors in multi-asset funds, which combine multiple types of assets and allocate them according to market trends as needed. In response to this demand, asset management companies are also building and selling multi-asset funds. Multi-asset funds are often evaluated based on indicators that are calculated by correlations and diversification between assets [3,4,5], but there are few indicators from other approaches; the dangers of looking at a few indicators have also been pointed out [6].

In this study, we propose the methodology using Graph-Based Entropy with co-occurrence networks between assets as explanatory signs of changes and the number of hubs in differential networks as an indicator of the scale of changes. These indicators are designed differently from conventional indicators based on correlation and variance and primarily focused on explaining structural changes in financial markets, which is expected to enable users to monitor multi-asset markets from a different perspective than conventional indicators. It also helps fund managers monitoring multi-asset funds to capture the changes occurring in the market by visualizing the market conditions in a network format through co-occurrence and differential networks. Graph-based anomaly detection and explanation research has been conducted in a variety of domains, and graph-based approaches are very effective in ensuring explainability and interpretability [7]. Although several studies analyze financial markets from a network approach [8,9,10], we do not find any studies that apply it to multi-asset markets. Graph-Based Entropy based on co-occurrence networks used in our method has been used in the field of marketing in the retail industry [11, 12], and differential networks have been used in the field of bioinformatics [13,14,15]. This study is the first to apply them to finance. The results of applying this method to multi-asset consisting of the stock, bond, and foreign exchange markets in 2007 are consistent with real-world market changes, suggesting the effectiveness of this method.

2 Methods

2.1 Co-occurrence Networks and Graph-Based Entropy

Originally, Graph-based Entropy has been defined on the structure of co-occurrence, i.e., the likelihood of simultaneous purchase of items, obtained from supermarket POS data. However, since our target here is financial time-series data, we cannot calculate the co-occurrence in the same way. Instead, we use the dynamic time warping (DTW) to calculate the distance between the price transition of each asset, and then construct a network and conduct pre-processing that enables us to calculate Graph-based Entropy.

First, to calculate the distance matrices, we preprocessed the raw time-series data according to the following procedure. (i) Divided the time series by window, (ii) standardized (Z-score) within the window, and (iii) corrected for price movement directionality based on fund managers’ experience.

The standardization was performed as shown in the following equation, where t is the time, \(w\) is the window width, \({x}_{t}\) is raw time series at time t, and std is the standard deviation:

$${\text{Zscore}}_{{\text{t}}} = \frac{{x_{{\text{t}}} - {\text{average}}\left( {x_{{{\text{t}} - {\text{w}},{\text{t}} - {\text{w}} + 1, \ldots ,{\text{t}}}} } \right)}}{{{\text{std}}\left( {x_{{{\text{t}} - {\text{w}},{\text{t}} - {\text{w}} + 1, \ldots ,{\text{t}}}} } \right)}}$$
(1)

The directional corrections are made by multiplying those that tend to increase in price at risk-on by 1 and those that tend to decrease by − 1. For example, stocks have high volatility and are high-risk, high-return assets, so investors tend to buy them aggressively when the market is strong for high profits. Bonds, on the other hand, have low volatility and are unlikely to lose their principal unless the country defaults, but they are less profitable than stocks. Conversely, when the outlook for financial markets is uncertain, investors tend to abandon stocks and buy bonds. Based on this rule of thumb stock price is multiplied by 1 because the price tends to rise when the risk is on, and bond price and exchange rates are multiplied by − 1 because they tend to fall in value.

Based on the preprocessed time-series data for each asset, we calculate a distance matrix that represents the degree to which the price movements of each asset are similar. We used Dynamic Time Warping (DTW) [16] to calculate the distance from an asset to another. DTW is a method of stretching the time axis so that the distance between two sequences is minimized (Fig. 1). It is often used as a distance calculation method for time-series data because it is more noise-resistant than Euclidean distance and more suitable for human intuition. The distance between the sequence \(P=\{{p}_{1}, \cdots , {p}_{l}\}\) and the sequence \(Q=\{{q}_{1},\cdots , {q}_{m}\}\) is given in the following equation, and the distance can be calculated by matching each element of the sequence P with each element of the sequence Q in ascending order:

$$\begin{array}{l} {\rm{DTW}}\left( {P,Q} \right) = f\left( {l,~m} \right),\\ f\left( {i,j} \right) = {p_{\rm{i}}} - {q_{\rm{j}}} + \min \left\{ {\begin{array}{*{20}{c}} {f\left( {i,~j - 1} \right)}\\ {f\left( {i - 1,~j} \right)}\\ {f\left( {i - 1,~j - 1} \right)} \end{array},} \right.\\ f\left( {0,0} \right) = 0,f\left( {i,0} \right) = f\left( {0,j} \right) = \infty ,\\ \left( {i~ = ~1,~...,~l~;~j = 1,~....,~m} \right) \end{array}$$
(2)
Fig. 1
figure 1

a The distance measured by Euclidean. b The distance measured by DTW. [partially modified by authors], Source: XantaCross (2011) “Euclidean vs DTW”, Retrieved May 21, 2020, from https://upload.wikimedia.org/wikipedia/commons/6/69/Euclidean_vs_DTW.jpg

In this study, the time-series data pairs used to calculate distance are multi-asset, and time-series data with different measurement timings are sometimes compared, and time scaling methods such as DTW have an advantage in this case. For example, the assets in this study include those from different regions, such as Japanese and U.S. stocks. In the case of Japan and the U.S., price movements may be mutually influential due to the strong economic ties between the two countries. Besides, prices can be affected by a lag due to differences in trading hours caused by time differences. Of course, Japanese stocks may also move at price on their own due to factors unique to Japan. We expect that DTW will be able to handle such time differences automatically and appropriately.

Based on the distance matrices, if the distances for each pair of assets are smaller than a certain threshold, we consider them to be similar and create and visualize the network by putting an edge on them. By the above, a co-occurrence network can be constructed.

After constructing the Co-occurrence Network, we introduce Graph-Based Entropy (GBE) [11] as a measure of Shannon’s entropy applied to the network structure, calculated based on the clusters represented in the network and defined as follows:

$$\begin{array}{l} {\rm{Hg}} = - \mathop \sum \limits_{\rm{i}} p\left( {{\rm{cluste}}{{\rm{r}}_{\rm{i}}}} \right){\log _2}p\left( {{\rm{cluste}}{{\rm{r}}_{\rm{i}}}} \right)\\ {\rm{where}}~p\left( {{\rm{cluste}}{{\rm{r}}_{\rm{i}}}} \right) = \frac{{{\rm{freq}}\left( {{\rm{cluste}}{{\rm{r}}_{\rm{i}}}} \right)}}{{\mathop \sum \nolimits_{\rm{i}} {\rm{freq}}\left( {{\rm{cluste}}{{\rm{r}}_{\rm{i}}}} \right)}} \end{array}$$
(3)

GBE can quantify the degree of divergence of the clusters of items on the network and has the property of being low when many clusters are condensed in a network. In a previous study, GBE was applied to point-of-sale (POS) data from supermarkets as explanatory signs of changes, and it was reported to be highly interpretable enough to allow users to explain external factors behind the data, but also to be more accurate in detecting changes than other methods. It has also been reported to be superior to other methods in terms of the accuracy of change detection.

In a financial market, when the market is stable, the prices of each asset move freely to some extent, while when a kind of major event occurs and the market becomes unstable, the prices of many assets will fall or rise uniformly. Therefore, GBE can express stability in the financial market, and if the value of GBE falls sharply, it can be said that the market has moved from a stable state to an unstable state.

2.2 Differential Networks

To construct differential networks, we first create differential matrices from the distance matrices. The distance matrices are created in the same way as described in the procedure for constructing the co-occurrence networks, and then the differential matrices are created by taking the difference at each time step.

Let the distance matrix at time t be \({X}_{\mathrm{t}}\), which is calculated based on DTW distances of each asset and the differential matrix \({D}_{\mathrm{t}}\) is defined as follows:

$$\begin{gathered} D_{{\text{t}}} = X_{{\text{t}}} - X_{{{\text{t}} - 1}} \left( {{\text{t}} \ge 2} \right) \hfill \\ {\text{where}} X_{{\text{t}}} = \left( {x_{{{\text{i}},{\text{j}}}}^{{\text{t}}} } \right), \hfill \\ x_{{{\text{i}},{\text{j}}}}^{{\text{t}}} = {\text{DTW}}\left( {{\text{asset}}_{{\text{i}}} ,{\text{asset}}_{{\text{j}}} } \right) \hfill \\ \end{gathered}$$
(4)

Each element of the difference matrix D_t represents a change in the distance between each asset over time. In other words, a pair of assets with a positive value of an element of D_t means that the synchronization of price changes is less than the previous time, while a pair of assets with a negative value of an element of D_t means that the synchronization of price changes is stronger than the previous time.

The absolute value of the differential matrix forms a differential network by putting an edge on a pair of assets whose absolute value exceeds a certain threshold.

Differential network analysis is a method originally used in the field of bioinformatics [13], and in previous studies, it has been applied to gene regulatory networks in normal and cancer states to identify factors that contributed significantly to network changes as cancer progresses [15]. On a differential network, since edges are drawn over pairs whose relations have changed significantly, it is thought that nodes that have changed significantly will collect a large number of edges, which will then appear on the network as hubs. Although differential networks are used in bioinformatics, there are not so many examples of their use in other fields, including the field of finance.

In this study, in the differential network, edges are drawn to pairs of assets that have significantly changed the relationship of price fluctuations. Let \({d}_{i,j}^{t}\) denote each element of the difference matrix \({D}_{\mathrm{t}}\). The differential network composed of edges consisting of pairs of assets with \({d}_{i,j}^{t}\ge threshold\) is defined as the further network, and the differential network composed of edges consisting of pairs of assets with \({d}_{\mathrm{i},\mathrm{j}}^{\mathrm{t}}\le - \mathrm{threshold}\) is defined as a closer network. Many edges are gathered at the nodes of assets that have movements that deviate from the former relationship with some other assets, and they appear on the farther network as hubs. Similarly, the closer network will show hubs of nodes that have become similar in price to some other assets. This helps to explain the underlying events that may affect the asset. In addition, when the number of hubs appearing on the differential network is large, it suggests that important changes are occurring that affect the market of a wide range of assets, rather than localized changes for a few assets. If the number of hubs in the farther network is large, an event may be interpreted as causing many assets to move in different directions, while if the number of hubs in the closer network is large, an event may be interpreted as causing many assets to move uniformly. By tracking the number of hubs at each time step, we can get an insight into the extent of the impact of a given change.

3 Experimental Details

We construct co-occurrence and differential networks using time-series data of various types of financial assets, and calculate the GBE and the number of hubs, respectively. By comparing the results of visualization by the two networks and quantification by the two indices with events that occurred in reality, we verify whether the proposed method can capture events in the real world in a highly interpretable way. We used 49 time-series data consisted of US stocks (S&P500), Japanese stocks (TOPIX), US treasury, Japanese government bonds, and exchange rates (dollar/yen) for the period from 01/01/2007 to 31/12/2007, with daily price. These financial data were obtained from Bloomberg.

The window width of the DTW distance calculation was set to 20 days (days that stock markets are open in a month), the threshold of the distance to draw the edge in the co-occurrence network was set to be less than 2.0, and the threshold of the difference of the distance to draw the edge in the differential network was set to be more than 1.0 in absolute value. The farther network is the differential network consisting of the edges that are farther away with a value greater than 1.0, and the closer network is the differential network consisting of the edges that are closer with a value less than − 1.0. The farther network is visualized by red edges and the closer network by blue edges. For each node in the differential network, those with a degree greater than or equal to 3 are considered hubs. These hyperparameters are set in a deterministic way, but we will also discuss in Chapter 4 how the results change when the parameters are varied.

4 Results and Discussion

In the differential networks, the number of hubs consisting of blue edges (hereinafter referred to as “closer hubs”) has increased rapidly since the end of February (Fig. 2), and the visualized figures (Fig. 3) show that hubs have been formed around Japanese stocks (green nodes) and US stocks (red nodes). The value of GBE has also fallen sharply at the same time. In the corresponding co-occurrence network, the Japanese and U.S. stock clusters were separated on Feb 27, 2007 (Fig. 4), and gradually joined together to form a densely packed cluster 2 weeks later (Fig. 5).

Fig. 2
figure 2

The number of hub nodes. The red line means the number of farther hubs, the blue line means the number of closer hubs, and the green line (right axis) means GBE

Fig. 3
figure 3

a Differential Network focusing on Hubs on Feb 27, 2007. b Differential Network focusing on Hubs on Mar 13, 2007. The network consisted of blue edges is Closer Network, The network consisted of blue edges is Farther Network. The colors of the nodes are as follows: red: US stocks, green: Japanese stocks, orange: US Treasuries, blue: Japanese government bonds, green-yellow: dollar–yen exchange, black: others

Fig. 4
figure 4

Co-occurrence network (whole image) on Feb 27, 2007. The colors of the nodes are as follows: red: US stocks, green: Japanese stocks, orange: US Treasuries, blue: Japanese government bonds, green-yellow: dollar–yen exchange, black: others

Fig. 5
figure 5

Co-occurrence Network focusing on Japanese and US stocks cluster on Mar 13, 2007. The colors of the nodes are as follows: red: US stocks, green: Japanese stocks, orange: US Treasuries, blue: Japanese government bonds, green-yellow: dollar–yen exchange, black: others

February 27, 2007, was known as the day of “the Chinese Stock Bubble of 2007”. The fall was caused by rumors that the Chinese governmental economic authorities were to introduce varying policies that would restrict foreign investment. As a result, it is said to have caused declines and major unrest in almost every financial market in the world [17]. The combination of Japanese and U.S. stocks on the co-occurrence network and the increase in closer hubs centered on Japanese and U.S. stocks on the differential network can be considered consistent with the phenomenon of simultaneous global stock price declines in the real world. Here, the U.S. and Japanese markets are very far apart geographically, with a 13-h time difference. Due to the time difference between the two markets, there is a discrepancy in the timing at which these common factors affect price movements. In this study, we used the DTW distance, which is flexible in terms of time displacement, but if the network is constructed using the Euclidean distance instead of the DTW distance for the same period, we can see that the movements of the GBE are quite similar for both. On the other hand, the response to change appears to be faster with the DTW distance (Fig. 6). Since the Euclidean distance calculates the distance between changes at the same time, the distance is calculated excessively large when there is a deviation in the time direction even if the shapes are almost the same, and it is difficult to be seen as a change in the co-occurrence network at the early stage of the change. As shown in Formula. 2, DTW calculates the distance by stretching and shrinking the time in the two series to be compared and uses this to detect changes in a graph-based manner. Therefore, it seems to be able to cope well with time gaps. This method can be said to capture the relational changes in financial markets in an interpretable way.

Fig. 6
figure 6

Comparison of GBEs: between the co-occurrence networks constructed by Euclidean distance and by DTW distance

Besides, the number of hubs consisting of red edges (hereafter referred to as farther hubs), which signify that the distance has gone away, has also increased sharply through November, with GBE values rising. The breakdown of the hubs on the differential network is dominated by U.S. Treasuries (Fig. 7d), and in the co-occurrence network, a single cluster of tightly coupled U.S. Treasuries and JGBs was formed in early November (Fig. 7a), but the cluster gradually became loosely coupled (Fig. 7b) and separated into two clusters in mid to late November (Fig. 7c). During this period, the interest rates on short-term bonds were quite low because of the subprime mortgage crisis, which shifted funds from long-term bonds such as stocks and U.S. 10-year bonds to short-term bonds such as 2-year bonds. As a result, it is thought that the price movement of Japanese government bonds has come to be different from that of other Japanese government bonds.

Fig. 7
figure 7

a Co-occurrence Network focusing on Japanese and US bonds clusters on Nov 1, 2007. b Co-occurrence Network focusing on Japanese and US bonds clusters on Nov 13, 2007. c Co-occurrence Network focusing on Japanese and US bonds clusters on Nov 19, 2007. d Differential Network focusing on Japanese and US bonds clusters on Nov 13, 2007. The colors of the nodes are as follows: red: US stocks, green: Japanese stocks, orange: US Treasuries, blue: Japanese government bonds, green-yellow: dollar–yen exchange, black: others

The GBE values and the number of hubs allow us to know when the structure of the network has changed significantly and its scale, while the differential network visualizes which assets are central to the changes in the network. Furthermore, the differential network allows us to focus on the assets that are central to the change and how they change on the network, as captured by the differential networks. The two aforementioned examples suggest that such an approach can assist in interpreting what changes are occurring in a multi-asset market. This set of procedures can be used as one of the criteria to assist fund managers in making operational decisions, such as reconfiguring portfolios of assets. For example, if we detect timing that is different from the market price movements normally expected from the level of GBE, we can consider why the change has occurred and if it is something that is long-term, we can decide to cash out the asset and exit the market. Alternatively, if we can consider from the graph that the change in the relationship is short-term, we could make the decision to take a mean reversion strategy. By buying and selling assets when the relationship between the two assets, which is usually expected, breaks down, we can buy and sell assets with the expectation that the relationship will eventually return in the long run, thus allowing us to aim for profit opportunities while limiting risk.

While the study shows high interpretability and can show qualitatively valid results because they are consistent with real-world events, the methodology does not aim to optimize operational decisions and it is up to the fund manager to decide how to link them to operational decisions. Therefore, we do not have a quantitative evaluation of how much profit this method generates, and we are making a qualitative evaluation this time. In addition, this study aims to support human decision-making and focuses on “explanation” rather than “detection” or “prediction” of time-series changes. Since it is a study on a new goal that differs from many existing studies, there are no existing methods to compare currently. Therefore, quantitative evaluation measures are required in the future.

Future research could include proposing uses and methods that lead to greater operational optimization and even quantitative evaluation while maintaining interpretability. In addition, we use several hyperparameters, such as distance thresholds for constructing a network and order thresholds for being considered a hub in a differential network. These thresholds were set in a deterministic manner, but a methodology is required to optimize the thresholds to lead to more useful analysis. In this case, we set the threshold of the DTW distance connecting the edges in the co-occurrence network construction as 2.0, and the GBE when this threshold is changed is shown in Fig. 8. When the threshold values are set to 1.0, 1.5, and 2.0, the GBE changes are quite similar to each other, and the correlation coefficient is at least 0.5. Therefore, it is expected that similar interpretations can be obtained when these thresholds are adopted. On the other hand, if the thresholds are set too small, there will almost always be no edges tied to the network, and conversely, if the thresholds are set too large, there will almost always be tight coupling between assets in the network, making it difficult to capture changes in either case. In determining the appropriate threshold for capturing changes, an approach such as adjusting the volatility of the GBE to be large may be one way to help.

Fig. 8
figure 8

Changes in the value of GBE, when the threshold of the distance to draw edges in the network, are changed

As for the number of hubs on the differential network, Fig. 9 shows that the larger the threshold for linking edges, the more insensitive the network seems to be to changes, but the general shape itself looks quite similar regardless of the threshold. The hyperparameter should be changed depending on how sensitive the user wants to capture the change. The same is true for the order threshold to be considered as a hub because the general tendency did not change when the threshold was changed (Fig. 10). This also needs to be set according to the sensitivity required by the user.

Fig. 9
figure 9

The change in the number of hubs when the threshold for drawing an edge on a farther network is varied. In this case, nodes with degrees greater than or equal to 3 are considered as hubs

Fig. 10
figure 10

Comparison of the number of hubs when varying the threshold of the degree of nodes considered to be hubs. In this case, the threshold for the distance to draw edges is set to 1.0

In the current experiment, we focused on stocks, bonds, and foreign exchange, but we may be able to uncover new, previously unnoticed relationships using it on more types of assets and indices, as well as on so-called alternative data, which is not traditionally used, in the future. By doing so, we may be able to discover new revenue opportunities. In addition, the fact that clustering is performed on the network may allow us to apply a mean reversion strategy from a many-to-many relationship rather than a one-to-one relationship. Further investigation of the specific applications of this method in future research would have the potential to be more profitable.

5 Conclusion

In this study, we propose a method for the first time to apply Graph-based Entropy, which is originally used in the retail industry, to the analysis of financial time-series data of multi-asset markets by calculating the distance between assets and constructing a network, and using DTW as the distance between assets, we can deal with the gap in market trading time.

We also applied the differential network, which was originally used in bioinformatics, to identify the assets that are the core of changes in financial markets, and proposed to use the number of assets that appear as hubs in the differential network as an indicator of the scale of a certain change in financial markets.

The experimental results suggest that changes across multi-assets in financial markets can be detected with an interpretable visualization of asset networks and that they are consistent with events occurring in the real world. Since these indicators show changes of relationships in multi-asset in a very interpretable way, they will be useful for fund managers to capture the changes happening in the real market. As for indicators in the management of multi-asset funds, it is expected to help fund managers understand market changes and their background and causes, so that they can make investment decisions based on them.