1 Introduction

The interdependence between crude oil and stock markets has been one of the most studied connectedness in finance, despite conflicting conclusions. This is simply because the co-movements between them have significant implications for the formulation of energy policies and portfolio diversification. The global oil market has a remarkable impact on general price levels and other economic activity due to oil being one of the vital inputs in industrial production as well as the primary production determinant in most countries (Dutta et al., 2017; Hung, 2019). In oil-depending economies such as African countries, variations in global oil prices and fluctuation can be expected to impact their financial markets. Dynamic interdependence has been reported (Boubaker & Raza, 2017; Gourène & Mendy, 2018; Hamdan & Hamdan, 2020) as a risk management technique in portfolio administration. In this study, we deeply analyze the question of co-movement between global oil prices and the stock markets of African countries (South Africa, Morocco, Nigeria, Kenya, Mauritius, Egypt, Tunisia and Ghana). A systematical understanding of this interdependence would provide additional information for portfolio diversification and policy-making.

Even though African equity markets are less connected with the rest of the world, they are influenced by global oil markets due to the relationship of their overall economies to global oil prices. Since the 1970s, the African region has been considered a considerable manufacturer of oil (Gourène & Mendy, 2018). Moreover, African countries are exposed to growth in the international market for crude oil (Gupta & Modise, 2013). These countries chosen for this paper are the oil-producing emerging economies that rely on oil exports. While many empirical papers have demonstrated that oil price variations have dramatic impacts on macroeconomic indicators (Zhao et al., 2021; Gupta & Modise, 2013; Gourène & Mendy, 2018; Ferreira et al., 2020), not many studies have been done on the interrelatedness between global oil prices and stock market development in general, in particular, in African countries (Boubaker & Raza, 2017; Junior & Tweneboah, 2020). More precisely, one of the crucial questions in the empirical literature corresponds to how African stock markets respond to crude oil price variations. Changes in oil prices should be connected with changes in stock prices if oil plays a significant role in an economy (Narayan & Gupta, 2015). It might be claimed that if the oil has an impact on real economic activity, it will have an impact on the earnings of enterprises that use oil as a direct or indirect expense of operation. As a result, if the stock market effectively capitalizes on the cash flow implications of oil price increases, an increase in oil prices will cause predicted earnings to shrink, resulting in an instantaneous drop in stock prices. Stock returns may be slow if the stock market is inefficient (Abraham, 2016; Bhatia et al., 2020; Boubaker & Raza, 2017). While there are numerous papers for advanced economies, there is still a need for more research on emerging markets. Hence, it is meaningful to look into the interconnectedness between oil prices and the stock markets of African countries, which may help us further understand the nature of stock market volatility and hedge price risk. Also, the oil-stock relationship has always been highly valued by market participants, economics, and the number of works in connection with this field of literature has evolved very rapidly (Hung, 2020).

Recent studies explore the interlinkages between equity markets and crude oil prices, albeit with mixed results. Indeed, a central component of this line of research is a multi-country analysis of the impact of changes in oil prices on the stock markets of the major developed economies, including the United States, the major European countries, and Japan (Zhao et al., 2021; Tiwari et al., 2020; Cai et al., 2020; Mokni and Youssef, 2019; Mensi, 2019; Ferreira et al. (2019), Wen et al., 2019; Hamdi et al., 2019; Mokni & Youssef, 2019; Hung, 2020; Hamdan & Hamdan, 2020). Most of these studies have focused on advanced, net oil-importing economies, and none has looked at the relationship between oil prices and stock returns in African countries at different time horizons. In general, these articles have shown that crude oil price fluctuations remarkably impact stock market returns, and the association between oil prices and the stock market is positive and significant. However, none of the prior publications specifically addresses the dimension-related cross-market volatility spillover effects that are present in financial time series (Hung, 2021a). The qualities of the frequency dimension can assist us in gaining a new perspective on market data. The wavelet approach is used to analyze spillovers by taking into account the frequency dimension features. This method extends volatility spillovers between time series into a joint time–frequency domain (Bouri et al., 2020; Umar et al., 2020). Therefore, we fill in the gap and give fresh insight into the co-movements between global oil prices and African stock markets at different time and frequency domains.

Additionally, our empirical framework allows us to shed light on the dependence structure between oil prices and African stock markets during pandemics, considering the current circumstances caused by the Covid-19 pandemic and its potential ramifications for the oil-stock nexus.

In order to gain straightforward insight into the interrelatedness between oil prices and African stock markets, this paper adopts the combination of two advanced economic techniques proposed by Bhatia et al. (2020) and Boubaker and Raza (2017). The wavelet-based DCC-GARCH model captures the oil prices and African stock market interferences at various time and frequency domains. These methods have significant superiority over the conventional time-domain approaches employed in past studies (Bouri et al., 2020; Umar et al., 2020). The oil-African stock conditional correlation changes across frequencies, and fluctuates over time are further achieved in a time–frequency window by using the DCC model. Hence, the short term and long term time-varying conditional correlations between oil and stock indices, and possible structural changes and time variations can be correctly observed. Put differently, the current article utilizes multiresolution wavelet estimates to decouple the dynamics of global oil prices and African stock markets at various time horizons (Hung, 2021a). The wavelet analysis results are then used as an input in the DCC–GARCH process. The combination of the aforementioned frameworks enables a thorough investigation of the time-varying dependence between the variables under examination. More so, these techniques enable us to identify the optimal time horizons for reaping the benefits of portfolio diversification (Bhatia et al. 2020). When compared to simple correlation analysis, the DCC model offers additional benefits. Firstly, the DCC model is parsimonious relative to numerous multivariate GARCH models (Chiang et al., 2007). Secondly, it is adaptable because it allows us to estimate time-varying variations, covariances, and correlations of different series over time, allowing us to predict dynamic investor behavior in response to news and shocks. Thirdly, it calculates the correlation coefficients of the standardized residuals, accounting for heteroscedasticity in the data (Qureshi, 2021). Because of its capacity to capture dynamic correlation, DCC has been employed by a number of scholars in the past, for instance, Bhatia et al. (2020), Qureshi (2021), Karim et al. (2021) and Ghosh et al. (2021).

The current paper is the first to discover the heterogeneity in time-varying conditional correlation at various time and frequencies of crude oil prices and African stock markets and thus give fresh insight to the present literature. We make several contributions to the literature by mitigating the shortcomings determined in other studies. First, eight major African stock markets are taken into account, including South Africa, Morocco, Nigeria, Kenya, Mauritius, Egypt, Tunisia and Ghana to examine the oil-stock market association, which would be helpful to aid in portfolio decision making. Second, we account for the dynamic nature of this connection by executing our estimation through various investment horizons of the short, medium and long run corresponding to the maximal overlap discrete wavelet transform (MODWT). By doing so, we decompose the original data of crude oil and African stock market returns into different time scales, which show the elements working at various time horizons. Segregating return series into different time scales might reveal the periods to explore the characteristics of financial assets (Umar et al., 2020). Third, we capture the dynamic conditional correlation of crude oil prices with African stock market returns according to different frequencies in order to adequately ascertain the bearish and bullish dynamics of this relationship. Finally, wavelet hedge ratio and wavelet hedge portfolio allocation analysis were used through various investment horizons, which give more helpful reference information for market participants with different time horizons to construct investment and risk management strategies. Put differently, our main research questions are: What is the contribution of changes in oil prices to changes in African stock market prices? Do African stock markets react to oil market activity before and during the Covid-19 pandemic? These issues have not been addressed in the literature.

The remainder of this article is organized as follows. The next section is a literature review on the oil-stock relationship. Section 3 presents data and methodology. Section 4 reports the empirical findings, and Sect. 5 concludes and provides implications.

2 Literature Review

The theory of equity assessment can explain the extent to which changes in oil prices affect stock prices. In theory, the stock price is equal to the sum of discounted future cash flows. As a result, the primary influence of changes in oil prices on stock prices can be attributed to corporate cash flows and earnings (Abraham, 2016). The economic conditions (production costs, inflation, interest rates, income, economic growth, and so on) that can be influenced by oil shocks are reflected in the companies' discounted cash flows. The effects of oil price shocks on stock market returns and volatility vary depending on whether the country is an oil importer or exporter (Park & Ratti, 2008). Because of the inelastic nature of oil prices, the rise (fall) in oil prices reduces (increases) the trade balance in oil-importing (exporting) countries. As a result, the price of oil affects capital markets, macroeconomic indicators as a whole, and consumer confidence.

The literature on the influence of crude oil prices on stock markets in African countries has been extended in recent years. Gupta and Modise (2013) highlight that in South Africa, the stock market rises with oil prices when international economic activity improves. They also confirm that stock returns and oil prices move in opposite directions. Gourène and Mendy (2018) contribute to the existing literature by investigating the nexus between OPEC oil prices and the six largest African stock markets. They argue that the co-movement between African stock markets and oil prices is somewhat low, except in South Africa and Egypt. By contrast, the co-movement occurs through large time scales after the global financial crisis for most of the African stock prices. In a similar fashion, Dutta et al. (2017) reveal the influence of the implied crude oil volatility index on the African stock markets still holds, and time-varying jumps exist in the stock returns.

In the Nigerian context, Asaolu and Ilo (2012) show, in the long run, the Nigeria stock market returns have strongly connected with global oil prices as anticipated, given the dominance of the oil sector in the Nigerian economy. In the same vein, Fowowe (2013) uses GARCH-jump models to examine the interdependence between oil prices and the Nigeria stock exchange and shows a negative impact of oil prices on stock returns in Nigeria. Sugimoto et al. (2014) report that African stock markets are dramatically impacted by transmission from international markets and modestly from oil prices. Abraham (2016) argues that oil prices are positively related to the performance of the Nigerian stock market.

This study is related to the literature, which applies a wavelet approach to model the information flows across financial markets. Gourène et al. (2019) examine the time and frequency interdependence nexus between African stock markets and oil prices and provide evidence that African equity markets integrate with themselves and the outside relies on the time scales, the global financial markets state and the economic connections. Additionally, African stock markets have a strong relationship with crude oil prices in the short and medium term, but this nexus is relatively weak in the long run. Peng et al. (2020) explore the relationship between China’s stock market and global oil prices. Živkov et al. (2020) focus on the strength of the connectedness between oil prices and stock markets of Visegrad group countries at various time-horizons. Similarly, Boubaker and Raza (2017) analyze the volatility spillover effects between the oil market and the BRICS stock market, the authors provide strong evidence of time-varying volatility at different time horizons in all markets. Živkov et al. (2019) take into account how oil price fluctuations impact consumer price inflation in Central and Eastern European countries, and argue that the spillover of oil price changes to inflation is somewhat low in these nations. Wu et al. (2020) investigate the interdependence between global stock markets and crude oil prices in a time-domain perspective and find that the oil market is a primary determinant driving co-movement between international stock markets in the medium and long term. Overall, analyzing the time-varying interconnectedness between oil and stock markets for various investment horizons would provide additional information and assist market participants in projecting price changes and policymakers in ensuring financial stability (Boubaker & Raza, 2017; Hung, 2021b; Tiwari et al., 2020).

This paper enriches the related literature on African countries in the oil-stock relationship using a wavelet-based DCC-GARCH model. Still, previous studies have not addressed it comprehensively, making it inconclusive (Hung, 2021a; Lin & Su, 2020). Based on the above discussion, there is limited literature proffering significant nexus about the African context's oil-stock market association. As mentioned earlier, the majority of the studies are limited to one or two African countries and do not give a comparative study of their economy. Furthermore, investors invest over a variety of time horizons depending on their risk and return choices. The current study radically differs from past studies that lump up oil-stock connectedness into a single time frame that provides little for decision making. As a result, this prompts the need to decompose the return series into short, medium, and long-run horizons.

3 Methodology

This section documents the methods used for identifying the time-varying connectedness between African stock markets and crude oil prices.

3.1 Discrete Wavelet Transform

Wavelet transform was applied to decompose the initial variables into different time and frequencies, which provides a method for extracting multiscale data.

We decomposed \(y(t)\) series into different time scales as:

$$y(t) = \sum\limits_{k} {s_{J,k} \phi_{J,k} (t)} + \sum\limits_{k} {d_{J,k} \psi_{J,k} (t)} + \sum\limits_{k} {d_{J - 1,k} \psi_{J - 1,k} (t)} + \cdots + \sum\limits_{k} {d_{1,k} \psi_{1,k} (t)}$$
(1)

where \(\phi\) and \(\psi\) are the father and mother wavelet functions, respectively, denoting the smooth (low frequency) and detail (high frequency) portions of a signal. The smooth and detail signals are represented by the functions \(s_{J} (t)\) and \(d_{J} (t)\), respectively. And the following projections are estimated by wavelet coefficient:

$$\begin{aligned} & s_{j,k} \approx \int {y(t)\phi_{j,k} (t)dt} \\ & d_{j,k} \approx \int {y(t)\psi_{j,k} (t)dt} \\ \end{aligned}$$

Thus, the time series \(y(t)\) can be simplified as:

$$y(t) = S_{j} (t) + D_{j} (t) + D_{j - 1} (t) + \cdots + D_{1} (t)$$
(2)

From Eq. (2), \(\{ S_{J} ,D_{J - 1} , \ldots ,D_{j} , \ldots ,D_{1} \}\) is the multiscale decomposition of \(y(t)\).

Oscillations of lengths 2–4, 4–8, …, \(2^{j} + 2^{j + i}\) are linked to \(D_{1} (t),\,D_{2} (t),\,\ldots,D_{j} (t)\).

respectively. This study is based on Reboredo et al. (2017) to decompose the stock markets and crude oil prices into \(D_{1}\) to \(D_{6}\). The oscillation periods of 2–4, 4–8, 8–16, 16–32, 32–64 and 64–128 days corresponds to wavelet scales \(D_{1} ,D_{2} ,D_{3} ,D_{4} ,D_{5}\) and \(D_{6}\) respectively. The smooth elements \(S_{6}\) illustrates movement in the long term.

3.1.1 Wavelet coherence

The wavelet coherence was established by Torrence and Webster (1999), and it can be used to quantify the co-movement of two time series. The cross-wavelet of two series \(x(t)\) and \(y(t)\) can be written as:

$$W_{n}^{XY} (u,s) = W_{n}^{X} (s,\tau )W_{n}^{Y*} (s,\tau )$$
(3)

where u denotes the position, s is the scale, and * denotes the complex conjugate. The WC can be calculated as follows:

$$R_{n}^{2} (s,\tau ) = \frac{{|S\left( {s^{ - 1} W_{n}^{XY} (s,\tau )} \right)|^{2} }}{{S\left( {s^{ - 1} |W_{X} (s,\tau )|^{2} } \right)S\left( {s^{ - 1} |W_{Y} (s,\tau )|^{2} } \right)}}$$
(4)

where S connotes smoothing process for both time and frequency at the same time. \(R_{n}^{2} (s,\tau )\) is in the range \(0 \le R^{2} (s,\tau ) \le 1\).

3.2 Dynamic conditional correlation model

The dynamic conditional correlation (DCC) is used. Engle (2002) introduced this estimator to reflect conditional covariance's dynamic time-varying behavior. The conditional covariance matrix \({\rm H}_{t}\) is defined as,

$${\rm H}_{t} = D_{t} R_{t} D_{t}$$
(5)

where \(D_{t} = diag\sqrt {\left\{ {{\rm H}_{t} } \right\}}\) is a \(n \times n\) diagonal matrix of dynamic standard deviations form n univariate GARCH models at time t, and \(R_{t}\) is the time-varying correlation matrix.

Equation (7) can be re-parameterized with standardized returns as follows, \(e_{t} = D_{t}^{^{\prime}} \varepsilon_{t}\)

$${\rm E}_{t - 1} e_{t} e_{t}^{^{\prime}} = D_{t}^{ - 1} H_{t} D_{t}^{ - 1} = R_{t} = \left[ {\rho_{ij,t} } \right]$$
(6)

with the GARCH(1,1) specification, Engle (2002) offers the following mean-reverting conditionals:

$$\rho_{ij,t} = \frac{{q_{ij,t} }}{{\sqrt {q_{ii,t} q_{jj,t} } }}$$
(7)

where

$$q_{ij,t} = \overline{\rho }_{ij} (1 - \alpha - \beta ) + \alpha e_{i,t - 1} e_{j,t - 1} + \beta q_{ij,t - 1}$$
(8)

the unconditional correlation between \(e_{i,t}\) and \(e_{j,t}\) is \(\overline{\rho }_{ij}\). \(\alpha\) and \(\beta\) are scalar parameters that must be satisfied.

$$\alpha \ge 0,\beta \ge 0,\;{\text{and}}\;\alpha + \beta < 1.$$

The presence of strong persistence in the conditional variance is indicated by a value of \((\alpha + \beta )\) near to one.

In matrix form,

$$Q_{t} = \overline{Q}(1 - \alpha - \beta ) + \alpha e_{t - 1} e_{t - 1}^{^{\prime}} + \beta Q_{t - 1}$$
(9)

where \(\overline{Q} = Cov\left[ {e_{t} ,e_{t}^{^{\prime}} } \right] = E\left[ {e_{t} ,e_{t}^{^{\prime}} } \right]\) is unconditional covariance matrix of the standardized errors and \(\overline{Q}\) can be estimated as follows,

$$\overline{Q} = \frac{1}{T}\sum\limits_{t = 1}^{T} {e_{t} e_{t}^{^{\prime}} }$$
(10)

\(R_{t}\) is then obtained by

$$R_{t} = \left( {Q_{t}^{*} } \right)^{ - 1/2} Q_{t} \left( {Q_{t}^{*} } \right)^{ - 1/2}$$
(11)

where \(Q_{t}^{*} = diag\left\{ {Q_{t} } \right\}\).

3.3 Data

The daily sample data used for our empirical analysis is reported in Table 1. The choice is determined by the availability of data and the relative significance of the African stock markets.

Table 1 Summary of sample data

We note the presence of missing data (Ghana) due to a lack of data at certain times and a difference in working days between the various stock exchanges, as indicated in Table 2. All stock and crude oil data are extracted from Datastream. In this study, the returns series are decomposed into a set of six scales, namely D1, D2, D3, D4, D5 and D6, which denote information about the original data, and S6 trend element based on the MODWT method, in particular, Covid-19 period also is taken into account. In accordance with the existing literature, D1 and D2, D3 and D4, D5, D6 and S6 represent short-, medium-, and long-term dynamics, respectively. For more details, Table 2 documents a description of the wavelet scales.

Table 2 Time interpretation of various frequencies

Table 3 summarizes the statistics for the oil and African stock markets at each wavelet scale and Covid-19 period. The descriptive statistics of each wavelet scale confirm the behavior of the examined returns. The unconditional volatility as denoted by the standard deviation of each wavelet series decreases across scales; the test of normal distribution corroborates skewness and kurtosis. This reveals that wavelet series do not have a normal distribution, which is confirmed by Jarque–Bera test statistics. Moreover, all wavelet return series are found to be stationary at level according to ADF statistics for different time horizons. In the same vein, the ARCH effect demonstrates the existence of autocorrelation and heteroskedasticity problems in all concerned series. Further, Fig. 1 illustrates significant cross-correlations across markets under consideration. Apparently, oil shows an insignificant degree of connection with the African stock market at R level (without wavelet decomposition). These results provide a crucial stimulus to employing the wavelet and DCC model to analyze the oil-stock return relationship for the African financial markets.

Table 3 Summary of return series and their wavelet scales
Fig. 1
figure 1

Scatter plots, histograms and Pearson correlation of examined return series. Note ***, **,*Level of significance at 1%, 5% and 10%, respectively

4 Empirical Results

In this section, we implemented in two steps. First, the MODWT method was applied to decomposed oil and the African stock market return series through various time horizons. We estimate the time-varying correlation between decomposed series at different time and frequency scales using the DCC-GARCH model in the second step. There are 64 pairs of stock market and oil price in multiresolution framework in the final bivariate estimation. We report the results and elucidate the implications on D1, D2, D3, D4, D5, D6 and S6 scales and the Covid-19 period. Table 4 furnishes the magnitudes of key parameters.

Table 4 Estimated pairwise DCC parameters

Table 4 reports the DCC-GARCH results for the pairs of oil prices with African stock market returns over the period shown for both decomposition and level analysis. It can be seen from the statistically significant coefficient of the parameters (\(\alpha\) and \(\beta\)) for almost all the return series suggesting the existence of the dynamic conditional correlation between oil prices and African stock markets. The parameters \(\alpha\) and \(\beta\) of the DCC model are less than one, suggesting DCC maintains a steady level of movement. In addition, this outcome shows a mean-reverting dynamic process. Therefore, the conditions of the DCC model are valid.

However, the coefficient of \(\beta\) is not statistically significant in the cases of NIG-WTI at D6 and GHA-WTI at S6, WTI-KEN and WTI-NIG at COVID suggesting several various fluctuations working between oil prices and stock markets in Nigeria, Ghana and Kenya. The radical explanation for insignificant results may be due to the oil market being a global commodity rather than investment instruments in Nigeria, Ghana and Kenya.

Turning to wavelet-based DCC estimation (D1 to D6), coefficient estimates for D1, D2 and COVID act as proxies for the short run are statistically significant, suggesting that the dynamic conditional correlation between oil prices and stock market returns in Africa is time-varying. It demonstrates that oil prices and African stock markets are only tangentially related over short time horizons, providing optimum diversification benefits.

Similarly, in cases of D3 and D4 act as the proxies for the medium run, the significance of DCC parameters indicates a significant level of medium-term persistence. Specifically, in the long run, D5, D6 and S6, almost all the estimates are significant with high \(\beta\) values, which shows a high level of dominance of short-run persistence over a mean-reverting process and long-term persistence (Bhatia et al., 2020). We notice that the estimated dynamic conditional correlations are somewhat strong and may be explained by the high interconnection between oil prices and African stock markets. Furthermore, it appears that these correlations have significantly risen in the long run investment horizons, which reflects a growing interconnectedness between the market pairs under consideration. Overall, DCC estimations show that the interdependence between oil prices and stock returns of studied countries exists at low, medium and high frequencies. Our results are strongly supported by earlier studies of Gupta and Modise (2013), Asaolu and Ilo (2012), and Gourène et al. (2019).

Based on the estimation of the dynamic conditional correlation model, the time-varying correlation between crude oil prices and African stock markets across the various wavelet scales can be obtained, as indicated in Fig. 2. The graphical representations of the DCC model depict that pairwise dynamic correlation between two-time series varies between negative and positive values with different wavelet scales. Obviously, the time-varying correlation between oil prices and stock returns in African nations fluctuates more frequently and at a lower level (D1, D2) in the short run. Nevertheless, there is a high relative characteristic in the medium term (D3, D4). For instance, high and low dynamic conditional correlation values for D1 and D2 ranged from roughly − 0.8 to 0.8, whilst D3 and D4 values ranged from about − 0.9 to 0.85. It suggests that DCC among oil prices and African stock returns experience high volatility for large time durations. In a similar fashion, this characteristic has continued to the long-term horizon (D5, D6, and S6) in which correlation fluctuates between strong positive connections and negative associations. This outcome is partially in line with Gupta and Modise (2013) and Asaolu and Ilo (2012), who report evidence of a unidirectional spillover from oil prices to the African stock markets. They move in cluster structures that hint at opportunities for portfolio diversification. These findings uncover that it is vital for investors and policymakers to take into account the dynamic correlation across various wavelet scales, which may help them develop improved strategies.

Fig. 2
figure 2figure 2figure 2figure 2

Dynamic condition correlation between oil prices and African stock markets at decomposed series

As shown in Fig. 2, there is evidence that the dynamic conditional correlation between crude oil prices and stock markets in African countries fluctuates sharply, and has several surge points, especially during the Covid-19 crisis. In general, we can observe that the time-varying oil-stock relationship occurs in the long run, followed by the medium-run and the short-run, contrary to the unconditional correlation shown in Fig. 2. Moreover, we can determine some sudden fluctuations, such as a sharp increase in late 2020 and early 2021, which are impacted by the global Covid-19 pandemic. More accurately, it is clear that the influence of Covid-19 in 2020 on the variation of African stock and oil markets is statistically significant. In a similar fashion, regarding the dynamic conditional correlation between oil prices and African stock markets, we can observe that the short-term nexus is lower than the medium- and long-term nexus. Nevertheless, short-term relations between both markets were briefly greater than medium- and long-term relations at the start of 2020, implying a short-term rise in time-varying relationships between oil prices and stock markets in these countries during the Covid-19 epidemic. Put another way, this emphasizes the impact of the abrupt and sharp drop in crude oil prices on the interaction of the oil and stock markets during the Covid-19 pandemic. This finding is consistent with the recent articles of Hung and Vo (2021), Hung (2021b) and Zhang and Hamori (2021).

In summary, our empirical results reveal dynamic conditional correlations between oil and each stock market in the African nations. More importantly, we find evidence that the potential of the wavelet-based multiresolution technique combined with the DCC-GARCH model to comprehensively analyze the multi-scale nature of oil prices and African stock market returns has been demonstrated. We draw the conclusion that time-varying correlations depend on wavelet scales, which demonstrates the advantage of applying a timescale framework. Furthermore, findings also show that with the increase in wavelet timescale, the opportunities for diversification decrease. One of the possible reasons is that investors are prone to taking advantage of every market arbitrage opportunity. Investors who modify their investment holdings, having no hedging options available to them within a long period, might suffer losses during the short term because the time-varying connectedness between oil prices and the African stock returns has higher permanent levels in the long run. In terms of the time-varying connectedness between crude oil prices and African stock markets, this is in line with past studies that conclude that the link between oil prices and the stock market is weak in the short run, but it strengthens with time. (Dutta et al., 2017; Gourène & Mendy, 2018; Hung & Vo, 2021).

4.1 Hedging Performance

The DCC-GARCH technique and the Kroner and Sultan's specification are used to calculate risk-minimizing hedge ratios in this section. Kroner and Sultan (1993) show that the risk of a two-asset portfolio (oil and stock under consideration) is small if a one-dollar long position in the oil market is hedged by a one-dollar short position in the stock market.

$$\beta_{OS,t} = \frac{{h_{OS,t} }}{{h_{S,t} }}$$

where \(\beta_{OS,t}\) is the hedge ratio for oil and stock returns, \(h_{OS,t}\) is the conditional covariance between oil and stock returns at time t and \(h_{S,t}\) is the conditional variance of stock market returns.

The average values of hedge ratios of oil prices with African stock returns shown in Table 5 provide some fresh insights for hedgers at R (R represents return series at level), D1, D6 and COVID. The low ratios suggest that acquiring a position in African stock markets might mitigate the risk of investing in oil. On the other hand, the oil and Nigeria stock indexes have the highest ratio, 0.27, implying that a $1 long position in crude oil can be hedged for 27 cents in NIG stock market returns. These statistics imply that shorting Nigeria's stock market is the most successful hedging strategy. In the same vein, appropriate hedge ratios co-vary dramatically across African stock markets. Such volatility could be due to differences in the properties of African stock markets, such as liquidity and market makeup. Interestingly, on average, the hedging ratio falls from R, COVID to D1, and then rises again to D6.

Table 5 Hedging ratios for Africa stock markets with oil prices

Figures 3, 4 and 5 depicts the evolution dynamics of the optimal hedging ratio generated from the DCC-GARCH for the variables under consideration for a better understanding. We find that in all situations, the hedging ratios fluctuate dramatically over time, implying that the portfolio manager should not rebalance the portfolio at each wavelet time scale because to rising transaction costs. Portfolio managers would also look for an average hedge of a portfolio's members and rebalance the portfolio at various time horizons. As a result, we can advocate that optimal hedge ratios are in accordance with the idea that African stock markets should be an important part of a diversified oil portfolio that can assist improve the risk-adjusted performance of the hedged portfolio.

Fig. 3
figure 3

Hedge ratios between African stock markets and oil prices at R

Fig. 4
figure 4

Hedge ratios between African stock markets and oil prices at D3

Fig. 5
figure 5

Hedge ratios between African stock markets and oil prices at D6

4.2 Portfolio Design

Evaluation of temporal and spectral connectedness dynamics is significant for portfolio allocation and risk management decisions. We take into consideration and quantify portfolio weights for investment in oil prices and stock market indices by following the diligence proposed by Kroner and Ng (1998) for which we try to reduce risk while maintaining projected profits. The portfolio weights of the holdings of oil prices and stock markets are given by:

$$\begin{aligned} & w_{OS,t} = \frac{{h_{S,t} - h_{OS,t} }}{{h_{O,t} - 2h_{OS,t} + h_{S,t} }} \\ & w_{OS,t} = \left\{ {\begin{array}{*{20}l} {0,} \hfill & {if\,w_{OS,t} < 0} \hfill \\ {w_{OS,t} } \hfill & {0 \le w_{OS,t} \le 1} \hfill \\ {1,} \hfill & {if\,w_{OS,t} > 1} \hfill \\ \end{array} } \right. \\ \end{aligned}$$

where \(w_{OS,t}\) is the proportion of one dollar to be invested in two underlying assets at time t, \(h_{OS,t}\) is the conditional covariance of crude oil and African stock indexes, \(h_{S,t}\) and \(h_{O,t}\) are the conditional variance at time t for stock and crude oil prices respectively. The optimal weight of the African stock returns is equal to \(1 - w_{OS,t}\).

Table 6 documents summary statistics for the bivariate portfolio weights calculated from the DCC-GARCH framework. For example, the average weight for the EGY/WTI portfolio at R is 0.68, suggesting that for a $ 1 portfolio, 68 cents should be investigated in oil and 32 cents should be invested in EGY. Portfolio weights unveil various patterns for eight African countries. As may be seen in the optimal portfolio weight values, we notice that on scales R, D1 and D6 the average portfolio weights are relatively low and decrease from R, COVID to D3 and D6. It simply means that a higher investment in African stock markets should be required in the long-time horizon. By contrast, investors should invest in a portfolio of the crude oil market in the short to medium term rather than in the long-time horizons. Overall, our findings of lower optimal portfolio weights indicate that investors should have more stock markets of the African nations than crude oil to reduce risk without affecting projected profits in their portfolios in the short, medium and long-term horizons.

Table 6 Portfolio weights for Africa stock markets with oil prices

4.3 Robustness Analysis

To ensure that the results presented above are accurate, a robustness test is carried out. We utilize the wavelet coherence framework to validate the lead-lag nexus, which provides more insights regarding the co-movement between oil prices and the stock markets in African countries (Fig. 6).

Fig. 6
figure 6

Wavelet coherence (WTC) of variables. Notes The thick back contour shows the 5% significance level against red noise estimated from Monte Carlo simulation using phase randomized surrogate series, and the cone of influence where edge effects may distort the picture are indicated outside of the black line. The arrows reveal the phase difference between two-time series. The direction of arrows indicates the phase difference between the two-time series. Arrows pointing to the right suggest that variables are in phase. To the right and up, WTI is leading. To the left and up, WTI is lagging. Arrows pointing to the left suggest that variables are out of phase (anti-phase). To the left and up, WTI is leading. To the left and down, WTI is lagging. In phase shows that variables have a cyclic effect on each other, and out of phase indicates that variables have an anti-cyclic effect. The color code for power ranges from blue (low) to yellow (high). The Y-axis represents frequencies, and X-axis measures the period

The wavelet coherence transform (WCT) identifies areas in the time and frequency domains where the two-time series co-vary. Specifically, we use pairwise wavelet coherence plots to investigate the co-movements and lead-lag connectedness between WTI and the selected stock in African countries. In general, the findings of this approach are broadly consistent with those of the wavelet-based GARCH-DCC model outlined above in terms of time-varying spillover effects.

5 Conclusion

The time-varying relationship between oil prices and African stock markets is examined in this article. We combine the DCC-GARCH model and wavelet multiresolution framework to capture the potential impacts of market type on the co-movement dynamics. A bivariate DCC-GARCH model is joined with a MODWT filter to look into the hedging property of oil prices and the African stock markets. Also, optimal portfolios are built to investigate the weight of oil prices and the stock market of the African countries in the case of two asset portfolios.

Overall, empirical results provide evidence that intercorrelations between oil prices and African stock markets are time-varying and spread across various wavelet scales. More specifically, the dynamic relationship between oil prices and stock returns in African countries varies more frequently and at a lower level in the short run. On the other hand, in the medium term, there is a high relative characteristic. In a similar fashion, this characteristic has continued to the long-term horizon in which correlation fluctuates between strong positive connections and negative associations. Put differently, short-term integration is far below medium- and long-term levels. However, near the end of our sample period (particularly beginning in January 2020), there is a significant increase in short-term integration, highlighting the increased co-movement of oil prices and African stock markets under the uncertainty created by the Covid-19 pandemic.

The findings of hedging ratios and optimal portfolio weights from portfolio optimization of oil prices and African stock markets indicate the importance of stock markets in creating an optimal portfolio, including oil. Because the correlation structure varies dramatically across timescales and markets, these findings give an opportunity for African countries to diversify their worldwide portfolios. The connectivity of crude oil markets and African stock returns decreases over longer durations, and co-movements tend to move together. African stock markets, on the whole, offer very limited portfolio diversification prospects at higher scales. Oil and African stock markets can be thought of as a time-varying asset class that helps to improve the risk-adjusted performance of a well-diversified oil price portfolio while also serving as a hedge against various stock indexes.

The following are some of the key implications of the foregoing findings for stock market investors and policymakers. First, due to the higher co-movement on a long-term scale, an investor would be unable to gain from both portfolio diversity and time diversification at the same time. To put it another way, investors who want to own a risky asset in an African country will be unable to achieve both time and portfolio diversity as a result of this result. Second, investors should alter their investment selections and portfolio composition on a frequent basis because the time-varying relationship between oil and stock prices fluctuates between frequencies and time periods. Third, for long-term stock investing, it is advisable to invest independently in oil and African stock markets. Fourth, in the long run, the stock prices of African countries are almost invariably linked to the price of crude oil. These oil-stock price correlations are critical for asset allocation and portfolio diversification. Finally, to stabilize oil and stock market prices, policymakers and regulators should consider dynamic co-movement information between the two markets.

Therefore, for local and worldwide investors and portfolio managers, the important implications of this study are critical, innovative, and beneficial. They can use these findings to create the best oil-African stock portfolios and improve their hedging strategies by more precisely forecasting time-varying correlations. The durability of a dynamic correlation between oil prices and African stock markets suggests that information transmissions created by oil markets improve interdependence prediction in financial markets, which is important for investors to consider when building financial portfolios.