Get the stock price of a Japanese company with Python and make a graph

jsm installation

$ pip install matplotlib pandas
$ pip install jsm

Script creation

Please replace it with the number of the company you want to obtain. This time I will try it at my company (Furukawa Electric 5801).

get_stock_price.py


import datetime
import jsm

q = jsm.Quotes()

start_date = datetime.date(2012, 1, 1)
#end_date = datetime.date(2015, 12, 1)

c = jsm.QuotesCsv()
c.save_historical_prices('finance5801.csv', 5801, jsm.DAILY, start_date)

plot_stock_price.py


import matplotlib.pyplot as plt
import pandas as pd

fig = plt.figure(figsize=(6,4))
name =['date', 'open', 'high', 'low', 'close', 'volume', 'adj_close']
df = pd.read_csv('finance5801.csv', names=name, parse_dates=['date'], index_col='date')
df.head()
df['adj_close'].plot()
plt.title("stock price (furukawa-electric)")
plt.tight_layout()
plt.show()
fig.savefig("stock_furukawa.png ")

Run

$ python get_stock_price.py
$ python plot_stock_price.py
stock_furukawa.png

Recommended Posts

Get the stock price of a Japanese company with Python and make a graph
Calculate the shortest route of a graph with Dijkstra's algorithm and Python
Get stock price with Python
Let's make a graph with python! !!
Make a BLE thermometer and get the temperature with Pythonista3
Acquire the data of Mitsubishi UFJ International Investment Trust eMAXIS with Python and make a graph with the beginning of the term as 100
Download Japanese stock price data with python
Get the trading price of virtual currency and create a chart with API of Zaif exchange
Get the number of searches with a regular expression. SeleniumBasic VBA Python
Read the graph image with OpenCV and get the coordinates of the final point of the graph
Get the number of articles accessed and likes with Qiita API + Python
Make a DNN-CRF with Chainer and recognize the chord progression of music
Get and estimate the shape of the head using Dlib and OpenCV with python
[Python] Get the files in a folder with Python
Get the caller of a function in Python
Make a copy of the list in Python
Get stock price data with Quandl API [Python]
A discussion of the strengths and weaknesses of Python
[Python] Get the day of the week (English & Japanese)
A super beginner who does not know the basics of Python tried to graph the stock price of GAFA
How to get a list of files in the same directory with python
[Introduction to Python] How to get the index of data with a for statement
[Python] Get the numbers in the graph image with OCR
Let's make a simple game with Python 3 and iPhone
Visualize the range of interpolation and extrapolation with python
Make a breakpoint on the c layer with python
Get the operation status of JR West with Python
[Python] Wouldn't it be the best and highest if you could grasp the characteristics of a company with nlplot?
Get a large amount of Starbucks Twitter data with python and try data analysis Part 1
Get the value of a specific key in a list from the dictionary type in the list with Python
Make a fortune with Python
Get the id of a GPU with low memory usage
Get UNIXTIME at the beginning of today with a command
Associate Python Enum with a function and make it Callable
Get the number of specific elements in a python list
Get a list of purchased DMM eBooks with Python + Selenium
I evaluated the strategy of stock system trading with Python.
Get rid of dirty data with Python and regular expressions
Detect objects of a specific color and size with Python
Sample of HTTP GET and JSON parsing with python of pepper
Play with the password mechanism of GitHub Webhook and Python
Get Japanese stock price information from yahoo finance with pandas
Get the source of the page to load infinitely with python.
[Python] I want to make a 3D scatter plot of the epicenter with Cartopy + Matplotlib!
I tried to get the number of days of the month holidays (Saturdays, Sundays, and holidays) with python
Recursively get the Excel list in a specific folder with python and write it to Excel.
Get a list of CloudWatch Metrics and a correspondence table for Unit units with Python boto
The story of Python and the story of NaN
Let's make a GUI with python.
Get the weather with Python requests
Get the weather with Python requests 2
Make a recommender system with python
Make a nice graph with plotly
Coexistence of Python2 and 3 with CircleCI (1.0)
I compared the speed of Hash with Topaz, Ruby and Python
A pharmaceutical company researcher summarized the basic description rules of Python
Save the result of the life game as a gif with python
Note: Get the first and last items of Python OrderedDict non-destructively
[Statistics] Grasp the image of the central limit theorem with a graph
[python, ruby] fetch the contents of a web page with selenium-webdriver
[Python] How to get the first and last days of the month