Search
Close this search box.
Search
Close this search box.

Does China stock market affect U.S. stock market?

Does China stock market affect U.S. stock market?

Can we use stock prices to measure the Influences of Sino-US trade frictions on Chinese and American stock markets?

Let’s explore the impacts of the Sino-US trade friction:

Has the trade war affected the Chinese and American stock markets?

If so, which stock market is more deeply affected than the other? By using data visualization methods. We are able to intuitively observe the volatility brought by the trade war news to the Chinese and American stock markets. And then, by contrasting the market indexes of both China and America, we could provide a relatively reliable answer. 

Of course, there are many factors that affect the stock market: economic factors and cycles. Moreover, the country’s fiscal status, financial environment, balance of payments status. Furthermore, changes in the economic status of the industry, adjustments to national exchange rates, and so on. These factors will also affect the stock price, and we shouldn’t overlook these effects on the stock market. However, this report focuses on several important timelines of the trade war, when the stock market is mostly affected by the trade friction. 

The timelines I pick are divided into two periods: 

(1) March 2018 – January 2019: President Trump impose billions of tariffs on Chinese exported goods. China reacted by imposing similar amount of tariffs on American exported goods. 

(2) June 2019 – January 2020: President Trump started the second wave of tariffs on Chinese goods, and so did China. 

1. Sample Selection: 

(1) The sample comes from SSE Composite Index and S&P 500 Index 

(2) We use monthly bilateral export data for the US and China, collected from the websites of the respective authorities, for June 2017 to january 2020, one and a half years. 

2. Research Design 

The general idea is to compare several stock market aspects of China and the US (1) the trend of daily market close price 

(2) return rate 

(3) distribution graph and histogram to determine whether a normal distribution 1

(4) Exponential Moving Average(EMA) and Simple Moving Average(SMA) and then 

Does China stock market affect U.S. stock market?

(1) compare these aspects, 

(2) use relationships to explain the influences on China and the US Stock Market 

3.Reach a conclusion: 

How does the trade war affect both China and the US market? 

[124]: firstly, import baostock as bs 

secondly, import pandas as pd 

thirdly, import matplotlib.pyplot as plt 

fourthly, import matplotlib.dates as dates 

from scipy import stats 

from scipy.stats import norm 

fifthly, import numpy as np 

sixthly, import fix_yahoo_finance as yf 

lastly, import statsmodels.api as sm 

from statistics import

import statsmodels.formula.api as smf 

import datetime as dt 

[125]: lg = bs.login() # login to get SSH Composite Index data 

Login success! 

2 1.Comparing the stock market indexes and return rates of both markets. 

Collecting stock market data from yahoo finance and baostock use datareader in pandas and form a dataframe using to have a deep analysis. 

First period: 2018-04-01 to 2018-12-31 

collecting China stock market data and form a dataframe 

[126]: rs = bs.query_history_k_data_plus(“sh.000001”,␣ 

,→“date,code,open,high,low,close,preclose,volume,amount,adjust flag,turn,trade status,pctChg,isstart_date=’2018-03-01′, end_date=’2018-12-31′,frequency=”d”, adjustflag=”3″) print(‘query_history_k_data_plus respond error_code:’+rs.error_code) 

print(‘query_history_k_data_plus respond error_msg:’+rs.error_msg) 

datalist = [] 

while (rs.error_code == ‘0’) & rs.next(): 

datalist.append(rs.get_row_data()) 

index_data = pd.DataFrame(datalist,columns=rs.fields) 

index_data.index = pd.to_datetime(index_data.date) 

index_data.head() 

index_data.to_csv(“China_stock.csv”,encoding=”gbk”) 

query_history_k_data_plus respond error_code:0 

query_history_k_data_plus respond error_msg:success 

Transform object to numeric 

[127]: index_data = index_data.apply(pd.to_numeric, errors=’ignore’) index_data.info() 

<class ‘pandas.core.frame.DataFrame’> 

DatetimeIndex: 206 entries, 2018-03-01 to 2018-12-28 

Data columns (total 14 columns): 

# Column Non-Null Count Dtype 

— —— ————– —– 

0 date 206 non-null object 

1 code 206 non-null object 

2 open 206 non-null float64 

3 high 206 non-null float64 

4 low 206 non-null float64 

5 close 206 non-null float64 

6 preclose 206 non-null float64 

7 volume 206 non-null int64 

8 amount 206 non-null float64 

9 adjustflag 206 non-null int64 

Does China stock market affect U.S. stock market?

10 turn 206 non-null float64 

11 tradestatus 206 non-null int64 

12 pctChg 206 non-null float64 

13 isST 204 non-null float64 

dtypes: float64(9), int64(3), object(2) 

memory usage: 24.1+ KB 

collecting the US stock market data and form a dataframe 

[128]: index__data = yf.download(‘SPY’, start=’2018-03-01′,end =’2018-12-31′) index__data.to_csv(“the US market”,encoding = “gbk”) 

index__data.head() 

[*********************100%***********************] 1 of 1 downloaded 

[128]: Open High Low Close Adj Close Volume Date 

2018-03-01 271.41 273.17 266.00 267.70 255.20 176855100 3

2018-03-02 265.80 269.72 264.82 269.08 256.51 139083200 2018-03-05 267.73 272.89 267.61 272.19 259.48 97307400 2018-03-06 273.30 273.39 271.18 272.88 260.14 79213200 2018-03-07 270.42 273.18 270.20 272.78 260.04 87063500 

China versus US in stock market indexes 

[129]: index_data.close.plot(figsize=(16,8),label=’SSE Composite Index’ ) plt.legend() 

[129]: <matplotlib.legend.Legend at 0x16e611989c8> 

[130]: index__data[‘Adj Close’].plot(figsize=(16,8),label = ‘S&P 500 Index’) plt.legend() 

[130]: <matplotlib.legend.Legend at 0x16e625950c8> 

What did these graphs tell us? 

As the S&P 500 figure suggests, the S&P 500 index dropped sharply in mid-March, the same period of time as Trump announced the increase in tariffs. In early – April, the indexes rebounded and then gradually recovered in the end of April As the SSE composite Index (the Shanghai market composite index) suggests, different from the S&P 500, after the sharp decline in the start of the trade war, the SSE continues to drop sharply on mid-April, and there was no gradual recovery . Even if there is some rebound in early May, it still hasn’t recovered to the index before the trade war. 

China versus US in stock return rate 

[131]: index_returns = index_data.close.pct_change().dropna() 

index_returns.plot(figsize=(16,8),label = ‘the RR on SSH Composite Index’) plt.legend() 

plt.show() 

[132]: index__returns = index__data[‘Adj Close’].pct_change().dropna() index__returns.plot(figsize=(16,8),label=’the RR on S&P 500 Index’) plt.legend() 

plt.show() 

What do these graphs tell us? 

We found that in mid-March, the RR on SSE was lower than -0.03, while the RR on S&P 500 was nearly -0.02, so the decline of RR on SSE exceeded the S & P 500. After the sharp decline, the RR on S&P 500 recovered before mid April. However, the SSE hasn’t recovered as quickly as S&P 500 when it comes to RR. Furthermore, throughout the whole year, the RR on SSE is relatively unstable compared to the RR on S&P 500. 

China versus US in Distribution of Stock Return Rate 

[133]: mu, std = norm.fit(index_returns) 

fig, ax = plt.subplots(1, 1, figsize=(10, 5)) 

ax.hist(index_returns, bins=50, density =’True’, alpha=0.6, color=’blue’) xmin, xmax = plt.xlim() 

x = np.linspace(xmin, xmax, 100) 

p = norm.pdf(x, mu, std) 

ax.plot(x, p, ‘k’, linewidth=2) 

[133]: [<matplotlib.lines.Line2D at 0x16e60a13048>] 

[134]: mu, std = norm.fit(index__returns) 

fig, ax = plt.subplots(1, 1, figsize=(10, 5)) 

ax.hist(index__returns, bins=50, density =’True’, alpha=0.6, color=’blue’) 

xmin, xmax = plt.xlim() 

x = np.linspace(xmin, xmax, 100) 

p = norm.pdf(x, mu, std) 

ax.plot(x, p, ‘k’, linewidth=2) 

[134]: [<matplotlib.lines.Line2D at 0x16e60b341c8>]

What did these graphs tell us? 

The normality of The SSE distribution is lower than that of the S&P 500. Its distribution is more negatively normalized, so it’s not as stable as the S&P 500. There are more outliers in the SSE graph, and the average and median values of SSE are less than one, while those of S&P 500 are nearly zero. 

China versus US in Exponential Moving Average(EMA) and Simple Moving Average(SMA) 

[135]: from pandas.plotting import register_matplotlib_converters 

register_matplotlib_converters() 

from mpl_finance import candlestick_ohlc 

sma = index_data.close.rolling(10).mean() 

# calculate EMAs 

# 26 day 

ema_26 = index_data.close.ewm(span=26).mean() 

# 12 day 

ema_12 = index_data.close.ewm(span=12).mean() 

# difference between fast and slow averages 

macd = ema_12 – ema_26 

# calculate the 9 period EMA of the macd 

macd_9_ema = macd.ewm(span=9).mean() 

# calculate the difference the macd and the “signal line” 

macd_diff = macd – macd_9_ema 

plt.rcParams[“figure.figsize”] = [15,10] 

fig, (ax1, ax2) = plt.subplots(2,1, sharex=True

# plot_day_summary(ax, quotes, tick size=3) 

candlestick_ohlc(ax2, zip(dates.date2num(index_data.index.to_pydatetime()), index_data[‘open’], index_data[‘high’], 

index_data[‘low’], index_data[‘close’]), 

width=0.8, colorup=’g’, colordown=’r’) 

ax1.plot(sma, “b-“) 

ax1.legend([‘sma’]) 

ax1.xaxis.set_major_locator(dates.DayLocator(interval=5)) 

ax1.xaxis.set_major_formatter(dates.DateFormatter(‘%m-%d-%y’)) 

#ax1.plot(stock_data[‘close’]) 

ax2.plot(ema_12) 

ax2.plot(ema_26) 

ax2.legend([‘OHLC’, ‘EMA_12’, ‘EMA_26’]) 

ax1.plot(sma, “b-“) 

ax1.legend([‘sma’]) 

ax1.xaxis.set_major_locator(dates.DayLocator(interval=5)) 

ax1.xaxis.set_major_formatter(dates.DateFormatter(‘%m-%d-%y’)) 

fig.tight_layout() 

fig.autofmt_xdate() 

plt.plot() 

[135]: [] 

Does China stock market affect U.S. stock market?

[136]: from pandas.plotting import register_matplotlib_converters register_matplotlib_converters() 

from mpl_finance import candlestick_ohlc 

sma_ = index__data[‘Adj Close’].rolling(10).mean() 

# calculate EMAs 

# 26 day 

ema_26 = index__data[‘Adj Close’].ewm(span=26).mean() 

# 12 day 

ema_12 = index__data[‘Adj Close’].ewm(span=12).mean() 

plt.rcParams[“figure.figsize”] = [15,10] 

fig, (ax1, ax2) = plt.subplots(2,1, sharex=True

# plot_day_summary(ax, quotes, tick size=3) 

candlestick_ohlc(ax2, zip(dates.date2num(index__data.index.to_pydatetime()), index__data[‘Open’], index__data[‘High’], 

index__data[‘Low’], index__data[‘Close’]), 

width=0.8, colorup=’g’, colordown=’r’) 

ax1.plot(sma_, “b-“) 

ax1.legend([‘sma’]) 

ax1.xaxis.set_major_locator(dates.DayLocator(interval=5)) 

ax1.xaxis.set_major_formatter(dates.DateFormatter(‘%m-%d-%y’)) 

#ax1.plot(stock_data[‘close’]) 

ax2.plot(ema_12) 

ax2.plot(ema_26) 

ax2.legend([‘OHLC’, ‘EMA_12’, ‘EMA_26’]) 

ax1.plot(sma_, “b-“) 

ax1.legend([‘sma’]) 

ax1.xaxis.set_major_locator(dates.DayLocator(interval=5)) 

ax1.xaxis.set_major_formatter(dates.DateFormatter(‘%m-%d-%y’)) 

fig.tight_layout() 

fig.autofmt_xdate() 

plt.plot() 

[136]: [] 

What do these graphs tell us? 

The friction can be seen in the 2018-19 EMA and SMA curves. In early April, the US stock showed a slight downslide, while that of the China market did a more severe downslide and it hasn’t recovered since April and shows no gradual recovery. After the U.S. announced increased tariffs on China in March 2018, stock prices have been declining until early 2019. It can be shown that the US tariff sanctions against China have severely affected the stock prices of both markets,while the Chinese stocks are more severely affected. 

[137]: print(“Covariance of SSE Composite Index and S&P 500 index: {}“. 

,→format(index_data.close.cov(index__data[‘Adj Close’]))) 

print(“Correlation of SSE Composite Index and S&P 500 index: {}“. 

,→format(index_data.close.corr(index__data[‘Adj Close’]))) 

Covariance of SSE Composite Index and S&P 500 index: -475.54368979899505 

Correlation of SSE Composite Index and S&P 500 index: -0.198463983668819 

Second period: 2019-06-01 to 2019-12-31 

[138]: rs = bs.query_history_k_data_plus(“sh.000001”,␣ 

,→“date,code,open,high,low,close,preclose,volume,amount,adjust flag,turn,trade status,pctChg,isstart_date=’2019-06-01′, end_date=’2019-12-31′,frequency=”d”, adjustflag=”3″) print(‘query_history_k_data_plus respond error_code:’+rs.error_code) 

print(‘query_history_k_data_plus respond error_msg:’+rs.error_msg) 

datalist = [] 

while (rs.error_code == ‘0’) & rs.next(): 

datalist.append(rs.get_row_data()) 

index_data = pd.DataFrame(datalist,columns=rs.fields) 

index_data.index = pd.to_datetime(index_data.date) 

index_data.head() 

index_data.to_csv(“China_stock.csv”,encoding=”gbk”) 

query_history_k_data_plus respond error_code:0 

query_history_k_data_plus respond error_msg:success 

Transform object to numeric 

[139]: index_data = index_data.apply(pd.to_numeric, errors=’ignore’) 

index_data.info() 

<class ‘pandas.core.frame.DataFrame’> 

DatetimeIndex: 145 entries, 2019-06-03 to 2019-12-31 

Data columns (total 14 columns): 

# Column Non-Null Count Dtype 

— —— ————– —– 

0 date 145 non-null object 

1 code 145 non-null object 

2 open 145 non-null float64 

3 high 145 non-null float64 

4 low 145 non-null float64

5 close 145 non-null float64 

6 preclose 145 non-null float64 

7 volume 145 non-null int64 

8 amount 145 non-null float64 

9 adjustflag 145 non-null int64 

10 turn 145 non-null float64 

11 tradestatus 145 non-null int64 

12 pctChg 145 non-null float64 

13 isST 145 non-null int64 

dtypes: float64(8), int64(4), object(2) 

memory usage: 17.0+ KB 

[140]: index__data = yf.download(‘SPY’, start=’2019-06-01′,end =’2019-12-31′) index__data.to_csv(“the US market”,encoding = “gbk”) 

index__data.head() 

[*********************100%***********************] 1 of 1 downloaded 

[140]: Open High Low Close Adj Close Volume Date 

2019-06-03 275.31 276.55 273.09 274.57 267.89 96428000 2019-06-04 277.12 280.68 276.62 280.53 273.71 77231900 2019-06-05 282.33 282.99 280.32 282.96 276.08 71169700 2019-06-06 283.29 285.55 282.57 284.80 277.87 69430400 2019-06-07 285.93 288.85 285.74 287.65 280.66 74272200 

China versus US in stock market indexes 

[141]: index_data.close.plot(figsize=(16,8),label=’SSE Composite Index’) plt.legend() 

[141]: <matplotlib.legend.Legend at 0x16e60cb8408> 

[142]: index__data[‘Adj Close’].plot(figsize=(16,8),label=’S&P 500 Index’) plt.legend() 

[142]: <matplotlib.legend.Legend at 0x16e5e810908> 

What did these graphs tell us? 

As the SSE figure suggests, the SSE index dropped sharply in mid-July, the same period of time as Trump announced the second wave of increase in tariffs. Different from 2018, the indexes rebounded and then gradually recovered at the end of August. 

As the S&P 500 composite Index suggests, there was a relatively small decrease in the stock market index, and it finally recovered in early August. 

China versus the US in stock return rate 

[143]: index_returns = index_data.close.pct_change().dropna() 

index_returns.plot(figsize=(16,8),label=’RR on SSE Composite Index’) plt.legend() 

[143]: <matplotlib.legend.Legend at 0x16e62839648> 

[144]: index__returns = index__data[‘Adj Close’].pct_change().dropna() index__returns.plot(figsize=(16,8)) 

plt.show() 

China versus US in Distribution of Stock Return Rate 

[145]: mu, std = norm.fit(index_returns) 

fig, ax = plt.subplots(1, 1, figsize=(10, 5)) 

ax.hist(index_returns, bins=50, density =’True’, alpha=0.6, color=’blue’) 

xmin, xmax = plt.xlim() 

x = np.linspace(xmin, xmax, 100) 

p = norm.pdf(x, mu, std) 

ax.plot(x, p, ‘k’, linewidth=2) 

[145]: [<matplotlib.lines.Line2D at 0x16e62b7ca48>] 

[146]: mu, std = norm.fit(index__returns) 

fig, ax = plt.subplots(1, 1, figsize=(10, 5)) 

ax.hist(index__returns, bins=50, density =’True’, alpha=0.6, color=’blue’) 

xmin, xmax = plt.xlim() 

x = np.linspace(xmin, xmax, 100) 

p = norm.pdf(x, mu, std) 

ax.plot(x, p, ‘k’, linewidth=2) 

[146]: [<matplotlib.lines.Line2D at 0x16e62485588>] 

What did these graphs tell us? 

The normality of The SSE distribution is lower than that of the S&P 500. Its distribution is more negatively normalized, so it’s not as stable as the S&P 500. There are more outliers in the SSE graph, and the average and median values of SSE are less than one, while those of S&P 500 are nearly zero. 

China versus US in Exponential Moving Average(EMA) and Simple Moving Average(SMA) 

[147]: from pandas.plotting import register_matplotlib_converters 

register_matplotlib_converters() 

from mpl_finance import candlestick_ohlc 

sma = index_data.close.rolling(10).mean() 

# calculate EMAs 

# 26 day 

ema_26 = index_data.close.ewm(span=26).mean() 

# 12 day 

ema_12 = index_data.close.ewm(span=12).mean() 

# difference between fast and slow averages 

macd = ema_12 – ema_26 

# calculate the 9 period EMA of the macd 

macd_9_ema = macd.ewm(span=9).mean() 

# calculate the difference the macd and the “signal line” 

macd_diff = macd – macd_9_ema 

plt.rcParams[“figure.figsize”] = [15,10] 

fig, (ax1, ax2) = plt.subplots(2,1, sharex=True

# plot_day_summary(ax, quotes, ticksize=3) 

candlestick_ohlc(ax2, zip(dates.date2num(index_data.index.to_pydatetime()), index_data[‘open’], index_data[‘high’], 

index_data[‘low’], index_data[‘close’]), 

width=0.8, colorup=’g’, colordown=’r’) 

ax1.plot(sma, “b-“) 

ax1.legend([‘sma’]) 

ax1.xaxis.set_major_locator(dates.DayLocator(interval=5)) 

ax1.xaxis.set_major_formatter(dates.DateFormatter(‘%m-%d-%y’)) 

#ax1.plot(stock_data[‘close’]) 

ax2.plot(ema_12) 

Does China stock market affect U.S. stock market?

ax2.plot(ema_26) 

ax2.legend([‘OHLC’, ‘EMA_12’, ‘EMA_26’]) 

ax1.plot(sma, “b-“) 

ax1.legend([‘sma’]) 

ax1.xaxis.set_major_locator(dates.DayLocator(interval=5)) 

ax1.xaxis.set_major_formatter(dates.DateFormatter(‘%m-%d-%y’)) 

fig.tight_layout() 

fig.autofmt_xdate() 

plt.plot() 

[147]: [] 

[148]: from pandas.plotting import register_matplotlib_converters register_matplotlib_converters() 

from mpl_finance import candlestick_ohlc 

sma_ = index__data[‘Adj Close’].rolling(10).mean() 

# calculate EMAs 

# 26 day 

ema_26 = index__data[‘Adj Close’].ewm(span=26).mean() 

# 12 day 

ema_12 = index__data[‘Adj Close’].ewm(span=12).mean() 

plt.rcParams[“figure.figsize”] = [15,10] 

fig, (ax1, ax2) = plt.subplots(2,1, sharex=True

# plot_day_summary(ax, quotes, ticksize=3) 

candlestick_ohlc(ax2, zip(dates.date2num(index__data.index.to_pydatetime()), index__data[‘Open’], index__data[‘High’], 

index__data[‘Low’], index__data[‘Close’]), 

width=0.8, colorup=’g’, colordown=’r’) 

ax1.plot(sma_, “b-“) 

             ax1.legend([‘sma’]) 

ax1.xaxis.set_major_locator(dates.DayLocator(interval=5)) 

ax1.xaxis.set_major_formatter(dates.DateFormatter(‘%m-%d-%y’)) 

#ax1.plot(stock_data[‘close’]) 

ax2.plot(ema_12) 

ax2.plot(ema_26) 

ax2.legend([‘OHLC’, ‘EMA_12’, ‘EMA_26’]) 

ax1.plot(sma_, “b-“) 

ax1.legend([‘sma’]) 

ax1.xaxis.set_major_locator(dates.DayLocator(interval=5)) 

ax1.xaxis.set_major_formatter(dates.DateFormatter(‘%m-%d-%y’)) 

fig.tight_layout() 

fig.autofmt_xdate() 

plt.plot() 

[148]: [] 

What do these graphs tell us? 

The friction can be seen in the 2019-20 EMA and SMA curves. In the early July, the stock of US shows a slight downslide, while that of the China market does a more severe downslide and it 

recovered until the end of August. After the U.S. announced a second wave of increased tariffs on China in July 2019, stock prices have been declining. It can be shown that the US tariff sanctions against China have severely affected the stock prices of both markets,while the Chinese stocks are more severely affected. 

Conclusion: 

In this research, we estimate the effect of the US-China trade war on bilateral stock markets, using the data from YAHOO finance and BAOSTOCK firms. We start with a descriptive analysis of stock market indexes and rate of returns. For both the US and China, we find that all the stocks drop immediately after the announcement of tariffs. However, the stock of the US recovered quickly while those of China did slower than the US. 

3 2. Using relationships to explain the influences on China and the US Stock Market 

we want to find the relationships of China and the US market, so what we’re trying to do here is analyze the relationship between two markets and find out how closely they are related to each other, which might explain how the trade war could affect two markets simultaneously and also why two markets are influenced by different extent 

We use the data sets of 2018.3-2020.1, the same period as the trade war. 

[149]: rs = bs.query_history_k_data_plus(“sh.000001”,␣ 

,→“date,code,open,high,low,close,preclose,volume,amount,adjustflag,turn,tradestatus,pctChg,isstart_date=’2018-03-01′, end_date=’2019-12-31′,frequency=”d”, adjustflag=”3″) print(‘query_history_k_data_plus respond error_code:’+rs.error_code) print(‘query_history_k_data_plus respond error_msg:’+rs.error_msg) 

datalist = [] 

while (rs.error_code == ‘0’) & rs.next(): 

datalist.append(rs.get_row_data()) 

index_data = pd.DataFrame(datalist,columns=rs.fields) 

index_data.index = pd.to_datetime(index_data.date) 

index_data.head() 

index_data.to_csv(“China_stock.csv”,encoding=”gbk”) 

index_data = index_data.apply(pd.to_numeric, errors=’ignore’) 

index_data.info() 

query_history_k_data_plus respond error_code:0 

query_history_k_data_plus respond error_msg:success 

<class ‘pandas.core.frame.DataFrame’> 

DatetimeIndex: 450 entries, 2018-03-01 to 2019-12-31 

Data columns (total 14 columns): 

# Column Non-Null Count Dtype 

— —— ————– —– 

0 date 450 non-null object 

1 code 450 non-null object 

2 open 450 non-null float64 

3 high 450 non-null float64 

4 low 450 non-null float64 

5 close 450 non-null float64 

6 preclose 450 non-null float64 

7 volume 450 non-null int64 

8 amount 450 non-null float64 

9 adjustflag 450 non-null int64 

10 turn 450 non-null float64 

11 tradestatus 450 non-null int64 

12 pctChg 450 non-null float64 

13 isST 448 non-null float64 

dtypes: float64(9), int64(3), object(2) 

memory usage: 52.7+ KB 

[150]: index__data = yf.download(‘SPY’, start=’2018-03-01′,end =’2019-12-31′) index__data.to_csv(“the US market”,encoding = “gbk”) 

index__data.head() 

[*********************100%***********************] 1 of 1 downloaded 

[150]: Open High Low Close Adj Close Volume Date 

2018-03-01 271.41 273.17 266.00 267.70 255.20 176855100 

2018-03-02 265.80 269.72 264.82 269.08 256.51 139083200 

2018-03-05 267.73 272.89 267.61 272.19 259.48 97307400 

2018-03-06 273.30 273.39 271.18 272.88 260.14 79213200 

2018-03-07 270.42 273.18 270.20 272.78 260.04 87063500 

[151]: print(“Covariance of SSE Composite Index and S&P 500 index: {}“. ,→format(index_data.close.cov(index__data[‘Adj Close’]))) 

print(“Correlation of SSE Composite Index and S&P 500 index: {}“. 

,→format(index_data.close.corr(index__data[‘Adj Close’]))) 

Covariance of SSE Composite Index and S&P 500 index: 758.1107301013184 Correlation of SSE Composite Index and S&P 500 index: 0.21540850291499616 

The covariance is positive, meaning the correlation of both indexes are positive. Therefore, we reach the conclusion that the SSE index and S&P 500 are positively correlated. 

[152]: SSE = index_data.close 

SP500 = index__data[‘Adj Close’][0:len(SSE)] 

SSE = SSE.reset_index() 

SP500 = SP500.reset_index() 

model_data = pd.concat([SSE, SP500], axis=1) 

y = model_data.iloc[:,1] 

x = model_data.iloc[:,3] 

results = smf.ols(‘y ~ x’, data=model_data).fit() 

print(results.summary()) 

OLS Regression Results 

============================================================================== Dep. Variable: y R-squared: 0.026 Model: OLS Adj. R-squared: 0.024 Method: Least Squares F-statistic: 11.93 Date: Tue, 25 Aug 2020 Prob (F-statistic): 0.000605 Time: 01:31:56 Log-Likelihood: -3022.0 No. Observations: 450 AIC: 6048. Df Residuals: 448 BIC: 6056. Df Model: 1 

Covariance Type: nonrobust 

============================================================================== coef std err t P>|t| [0.025 0.975] 

—————————————————————————— Intercept 2337.4813 161.245 14.496 0.000 2020.591 2654.372 x 2.0288 0.587 3.454 0.001 0.874 3.183 ============================================================================== Omnibus: 25.548 Durbin-Watson: 0.030 Prob(Omnibus): 0.000 Jarque-Bera (JB): 14.574 Skew: 0.281 Prob(JB): 0.000684 Kurtosis: 2.320 Cond. No. 4.69e+03 ============================================================================== 

Warnings: 

[1] Standard Errors assume that the covariance matrix of the errors is correctly specified. 

[2] The condition number is large, 4.69e+03. This might indicate that there are strong multicollinearity or other numerical problems. 

This is a relatively good prediction of the relationship between two indexes. The p value of F statistic is less than 0.05, meaning the relationship is statistically significant. The p value of Beta in regression is also less than 0.05, meaning we tend to reject the hypothesis that Beta is equal to zero. Therefore, the relationship exists between two market indexes 

Combining with previous part( the correlation of two market indexes is positive), we can conclude that there is a positive relationship between two markets 

Conclusion 

Although there are many factors affecting the stock market, through data visualization analysis, we do observe a certain correlation between the Sino-US trade war news and the volatility of the Sino-US stock market. We can use this to speculate that the trade war news has indeed had a significant impact on the stock markets of the two countries. 

4 3. Miscellaneous 

Except for the analysis on the stock market indexes, we also did some other aspects of the Market including the RMB/Dollar exchange rate, GDP, and CPI…etc so that we can have a large picture of the effects of the Sino-US trade war on both countries. 

Analysis on the relationship of RMB/USD exchange rate and the Chinese stock market ( using SSE Composite index) 

First, in the long run, both the exchange rate and the stock market can be used to instantly reflect the operation of the country’s real economy. When the economy is down, the exchange rate is often under pressure to depreciate, capital is gradually flowing out, and the stock market is also accompanied by economic downturn and tight liquidity. Downward; conversely, when economic growth is stable, it will also boost the stock market and exchange rate. 

Second, abnormal exchange rate fluctuations and stock market fluctuations in the short-term will interfere with investors’ expectations of the market. Although expectations are not necessarily rational, they will affect investors’ risk appetite, resulting in a pattern of stock exchange rates rising and falling. 

Note: the data is from Chinese stock website and we extract the exchange rate from 2018 January to 2019 June 

[153]: data = pd.read_csv(‘../Final Pro/CNY_USD.csv’,index_col=”) 

[154]: x = data[‘2’] 

y = data[”] 

x = x[100:200] 

y = y[200:300] 

[155]: y = pd.Series(y.values) 

x = pd.Series(x.values) 

model_data = pd.concat([y, x], axis=1) 

model_data = model_data.dropna() 

results = smf.ols(‘model_data.iloc[:,0] ~ model_data.iloc[:,1]’,␣ 

,→data=model_data).fit() 

print(results.summary()) 

OLS Regression Results 

================================================================================ = 

Dep. Variable: model_data.iloc[:, 0] R-squared: 

0.313 

Model: OLS Adj. R-squared: 

0.306 

Method: Least Squares F-statistic: 

44.73 

Date: Tue, 25 Aug 2020 Prob (F-statistic): 

1.40e-09 

Time: 01:32:01 Log-Likelihood: 

506.43 

No. Observations: 100 AIC: 

-1009. 

Df Residuals: 98 BIC: 

-1004. 

Df Model: 1 

Covariance Type: nonrobust 

================================================================================ ========= 

coef std err t P>|t| [0.025 

0.975] 

——————————————————————————– ——— 

Intercept 0.1997 0.008 25.207 0.000 0.184 0.215 

model_data.iloc[:, 1] -1.812e-05 2.71e-06 -6.688 0.000 -2.35e-05 -1.27e-05 

============================================================================== Omnibus: 79.705 Durbin-Watson: 0.111 Prob(Omnibus): 0.000 Jarque-Bera (JB): 8.386 Skew: 0.192 Prob(JB): 0.0151 Kurtosis: 1.635 Cond. No. 1.50e+05 ============================================================================== 

Warnings: 

[1] Standard Errors assume that the covariance matrix of the errors is correctly specified. 

[2] The condition number is large, 1.5e+05. This might indicate that there are strong multicollinearity or other numerical problems. 

[156]: plt.figure(figsize=(10,6)) 

plt.plot(x,y,’o’,label=’CNY/USD-SSE Index’) 

plt.plot(x[0:len(results.fittedvalues)],results.fittedvalues,label=’OLS’) plt.legend() 

[156]: <matplotlib.legend.Legend at 0x16e62cf4bc8> 

Conclusion: Although this model might not be that satisfying, it shows there do exist a certain negative correlation between the RMB/USD exchange rate and stock market returns, that is, “When the exchange rate is rising (RMB depreciation), the stock market (Shanghai and Shenzhen 300) is showing a downward trend. ; When the exchange rate shows a downward trend (renminbi appreciation), the stock market (SSH Composite Index) shows an upward trend” argument is supported by statistics. 

The range is set from January 1, 2018 to present, the correlation coefficient suddenly increased to -0.3820. This significant change can be explained by the fact that the trade war between China and the United States since the beginning of 2018 has increased the volatility of the exchange rate and stock market, leading to the continuous depreciation of the renminbi in 2018, and the stock market has also suffered a sharp decline. 

5 Conclusion 

In this research, we estimate the effect of the US-China trade war on bilateral stock markets, using the data from YAHOO finance and BAOSTOCK firms. We start with a descriptive analysis of stock market indexes and rate of returns. For both the US and China, we find that all the stocks drop immediately after the announcement of tariffs. However, the stock of the US recovered quickly while those of China did slower than the US. 

The results show that in the Sino US trade war, the tariff increase measures of the US side have a great negative impact on China’s stock market. The influence of Sino-US trade friction on the China Stock market is negative, but has few effects on the US stock market. 

We can see the relatively the same trend in each results chart: when the bad information released about Sino-US trade friction such as increased tariffs, the stock price both in China and the US will immediately go down.

Back To News

Written by Jiayang Bu

Does China stock market affect U.S. stock market?

Nobel Prize Winning Economist & Stanford Professor Paul Romer on Hyperinflation & Protecting Science

Does China stock market affect U.S. stock market?