In [18]:
import pandas_datareader.data as pdr
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline

end = '2017/11/3'

plt.figure(figsize=(8, 4))
analysis = pdr.DataReader("^N225", 'yahoo', '1986/9/3', end)
analysis['intraday'] = 0
analysis['overnight'] = 0
c0 = analysis.Close.iloc[0]
for i in range(1, len(analysis)):
    o = analysis.iloc[i, 0]
    c = analysis.iloc[i, 3] 
    analysis.iloc[i, 6] = c - o 
    analysis.iloc[i, 7] = o - c0
    c0 = c
analysis.Close.plot(label = 'Close', linewidth = 1)
analysis.intraday.cumsum().plot(label = "intraday", linestyle = ":")
analysis.overnight.cumsum().plot(label = "overnight", linestyle = '--', linewidth = 1)
plt.legend()
plt.ylabel('PL or NIKKEI 225')
plt.legend(loc = 'lower left')
Out[18]:
<matplotlib.legend.Legend at 0x11cacbc18>
In [21]:
plt.figure(figsize=(8, 4))
analysis = pdr.DataReader("SPY", 'yahoo', '1993/9/3', end)
analysis['intraday'] = 0
analysis['overnight'] = 0
c0 = analysis.Close.iloc[0]
for i in range(1, len(analysis)):
    o = analysis.iloc[i, 0]
    c = analysis.iloc[i, 3] 
    analysis.iloc[i, 6] = c - o 
    analysis.iloc[i, 7] = o - c0
    c0 = c
analysis.Close.plot(label = 'Close', linewidth = 1)
analysis.intraday.cumsum().plot(label = "intraday", linestyle = ":")
analysis.overnight.cumsum().plot(label = "overnight", linestyle = '--', linewidth = 1)
plt.legend()
plt.ylabel('PL or S&P500')
plt.legend(loc = 'lower left')
Out[21]:
<matplotlib.legend.Legend at 0x11c904550>
In [22]:
plt.figure(figsize=(8, 4))
analysis = pdr.DataReader("^DJI", 'yahoo', '1993/9/3', end)
analysis['intraday'] = 0
analysis['overnight'] = 0
c0 = analysis.Close.iloc[0]
for i in range(1, len(analysis)):
    o = analysis.iloc[i, 0]
    c = analysis.iloc[i, 3] 
    analysis.iloc[i, 6] = c - o 
    analysis.iloc[i, 7] = o - c0
    c0 = c
analysis.Close.plot(label = 'Close', linewidth = 1)
analysis.intraday.cumsum().plot(label = "intraday", linestyle = ":")
analysis.overnight.cumsum().plot(label = "overnight", linestyle = '--', linewidth = 1)
plt.legend()
plt.ylabel('PL or Dow Jones Industrial Average')
plt.legend(loc = 'lower left')
Out[22]:
<matplotlib.legend.Legend at 0x11e223400>
In [24]:
plt.figure(figsize=(8, 4))
analysis = pdr.DataReader("SQNXF", 'yahoo', '1993/9/3', end)
analysis['intraday'] = 0
analysis['overnight'] = 0
c0 = analysis.Close.iloc[0]
for i in range(1, len(analysis)):
    o = analysis.iloc[i, 0]
    c = analysis.iloc[i, 3] 
    analysis.iloc[i, 6] = c - o 
    analysis.iloc[i, 7] = o - c0
    c0 = c
analysis.Close.plot(label = 'Close', linewidth = 1)
analysis.intraday.cumsum().plot(label = "intraday", linestyle = ":")
analysis.overnight.cumsum().plot(label = "overnight", linestyle = '--', linewidth = 1)
plt.legend()
plt.ylabel('PL or Square Enix Holdings Co., Ltd.')
plt.legend(loc = 'lower left')
Out[24]:
<matplotlib.legend.Legend at 0x11c44dda0>
In [29]:
plt.figure(figsize=(8, 4))
analysis = pdr.DataReader("FRCOY", 'yahoo', '1995/9/3', end)
analysis['intraday'] = 0
analysis['overnight'] = 0
c0 = analysis.Close.iloc[0]
for i in range(1, len(analysis)):
    o = analysis.iloc[i, 0]
    c = analysis.iloc[i, 3] 
    analysis.iloc[i, 6] = c - o 
    analysis.iloc[i, 7] = o - c0
    c0 = c
analysis.Close.plot(label = 'Close', linewidth = 1)
analysis.intraday.cumsum().plot(label = "intraday", linestyle = ":")
analysis.overnight.cumsum().plot(label = "overnight", linestyle = '--', linewidth = 1)
plt.legend()
plt.ylabel('PL or Fast Retailing Co., Ltd.')
plt.legend(loc = 'lower left')
Out[29]:
<matplotlib.legend.Legend at 0x11d1e2518>
In [30]:
plt.figure(figsize=(8, 4))
analysis = pdr.DataReader("KDDIY", 'yahoo', '1995/9/3', end)
analysis['intraday'] = 0
analysis['overnight'] = 0
c0 = analysis.Close.iloc[0]
for i in range(1, len(analysis)):
    o = analysis.iloc[i, 0]
    c = analysis.iloc[i, 3] 
    analysis.iloc[i, 6] = c - o 
    analysis.iloc[i, 7] = o - c0
    c0 = c
analysis.Close.plot(label = 'Close', linewidth = 1)
analysis.intraday.cumsum().plot(label = "intraday", linestyle = ":")
analysis.overnight.cumsum().plot(label = "overnight", linestyle = '--', linewidth = 1)
plt.legend()
plt.ylabel('PL or KDDI Corporation')
plt.legend(loc = 'lower left')
Out[30]:
<matplotlib.legend.Legend at 0x11f9f50f0>