Skip to content

Instantly share code, notes, and snippets.

@fnielsen
Created September 17, 2012 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fnielsen/3736395 to your computer and use it in GitHub Desktop.
Save fnielsen/3736395 to your computer and use it in GitHub Desktop.
Dates and matplotlib example with stock quotes from Novo Nordisk (NVO)
from matplotlib.finance import quotes_historical_yahoo
from matplotlib.dates import num2date
from matplotlib.pyplot import *
from datetime import date
quotes = quotes_historical_yahoo('NVO', date(2011, 1, 1), date.today())
dates = [ num2date(row[0]) for row in quotes ]
closeprice = [ row[1] for row in quotes ]
plot(dates, closeprice)
show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment