Skip to content

Instantly share code, notes, and snippets.

@eldritchideen
Created August 15, 2014 00:03
Show Gist options
  • Save eldritchideen/556bf5ea2091d59923ff to your computer and use it in GitHub Desktop.
Save eldritchideen/556bf5ea2091d59923ff to your computer and use it in GitHub Desktop.
Some Pandas Share price stuff
from pandas import *
import pandas.io.data as web
import datetime
start = datetime.datetime(2010, 1, 1)
end = datetime.datetime(2014, 8, 15)
# Get daily price data
ctx = web.DataReader('ctx.ax', 'yahoo', start, end)
wkly = ctx['Adj Close'].resample('W-FRI', how='ohlc')
wkly_vol = ctx['Volume'].resample('W-FRI', how='mean')
df = DataFrame(wkly)
df['Avg Vol'] = wkly_vol
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment