Skip to content

Instantly share code, notes, and snippets.

@choffstein
Created August 17, 2012 15:46
Show Gist options
  • Save choffstein/3380026 to your computer and use it in GitHub Desktop.
Save choffstein/3380026 to your computer and use it in GitHub Desktop.
Fetch historical VIX data
import urllib2
months = ["F","G","H","J","K","M","N","Q","U","V","X","Z"]
years = ["04","05","06","07","08","09","10","11","12"]
for year in years:
for month in months:
filename = "CFE_" + month + year + "_VX.csv"
url = "http://cfe.cboe.com/Publish/ScheduledTask/MktData/datahouse/" + filename
try:
response = urllib2.urlopen(url)
if response.code == 200:
data = response.read()
f = open(filename, "w")
f.write(data)
f.close()
except:
continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment