I've used the Yahoo Finance API in the past, but apparently it doesn't exist (although it works fine). There is no documentation.
For a site with documentation, I'd suggest Open Exchange Rates, which contains forex values that you are looking for, via an API.
There are many API methods and in particular for your case, you can request a time series.
From their site:
You can access historical data snapshots, where available, in the format ‘/api/historical/yyyy-mm-dd.json’ (for example: /api/historical/2011-11-21.json.) There will soon be an 'available dates' endpoint available too.
You'll need a code to cycle over dates, here is an example of my python 2.7 code that collects 2013 precipitation and weather in Zurich.
import requests
def get_precip(gooddate):
urlstart = 'http://api.wunderground.com/api/REDACTED_KEY/history_'
urlend = '/q/Switzerland/Zurich.json'
url = urlstart + str(gooddate) + urlend
data = requests.get(url).json()
for summary in data['history']['dailysummary']:
print ','.join((gooddate,summary['date']['year'],summary['date']['mon'],summary['date']['mday'],summary['precipm'], summary['maxtempm'], summary['meantempm'],summary['mintempm']))
if __name__ == "__main__":
from datetime import date
from dateutil.rrule import rrule, DAILY
a = date(2013, 1, 1)
b = date(2013, 12, 31)
for dt in rrule(DAILY, dtstart=a, until=b):
get_precip(dt.strftime("%Y%m%d"))
update I noticed for the free account you can only make 1000 API calls per month (link). Not so open after all.