Recently I have been playing around with some Python Data Science libraries like Pandas, the pandas-datareader and Matplotlib.

The code and chart it produces are shown below:

from pandas_datareader.data import DataReader
from datetime import datetime, timedelta
import matplotlib.pyplot as plt


now = datetime.now()
start = (now - timedelta(days=365)).date()
end = now.date()

# debug
print(start)
print(end)

# Set the ticker
ticker = 'AAPL'  #Apple
# Set the data source
data_source = 'google'  #use google finance
# Import the stock prices
stock_prices = DataReader(ticker, data_source, start, end)
# Plot Close
stock_prices['Close'].plot(title=ticker)
plt.savefig('images/apple.png')

Apple stock price