If you're playing with Python's data processing library pandas (http://pandas.pydata.org/),
I posted it because it was wonderful because it was made only with code.
import pandas.io.data as web
import matplotlib.pyplot as plt
import datetime
#Specify the range of days to get
start = datetime.datetime(2014, 1, 1)
end = datetime.datetime(2014, 9, 1)
#From Yahoo Finance^N225 (Nikkei Stock Average)To
#I will get it.
f = web.DataReader('^N225', 'yahoo', start, end)
plt.title('Nikkei 255 from 2014.1.1 to 2014.9.1')
# fill_Plot the highest and lowest values of the day with between
plt.fill_between(f.index, f['Low'], f['High'], color="b", alpha=0.2)
#Plot the opening price with plot.
#Since Index is automatically set to Date, the horizontal axis is time.
f['Open'].plot()
print f[:10]
plt.show()
The pandas DataFrame object looks like this Data is retained as a table.
Open High Low Close Volume Adj Close
Date
2014-01-06 16147.54 16164.01 15864.44 15908.88 192700 15908.88
2014-01-07 15835.41 15935.37 15784.25 15814.37 165900 15814.37
2014-01-08 15943.68 16121.45 15906.57 16121.45 206700 16121.45
2014-01-09 16002.88 16004.56 15838.44 15880.33 217400 15880.33
2014-01-10 15785.15 15922.14 15754.70 15912.06 237500 15912.06
2014-01-13 15912.06 15912.06 15912.06 15912.06 0 15912.06
2014-01-14 15657.20 15661.71 15383.69 15422.40 214500 15422.40
2014-01-15 15649.07 15808.73 15636.57 15808.73 185800 15808.73
2014-01-16 15845.15 15941.08 15710.14 15747.20 214200 15747.20
2014-01-17 15695.46 15783.37 15621.80 15734.46 180100 15734.46
Click here for plot results.
If you change ^ N225
to ʻAAPL`, you can get Apple's stock price.
There doesn't seem to be an access API for the Japanese market yet.
Recommended Posts