{"action":"opened","issue":{"url":"https://api.github.com/repos/tcadden/algotrading/issues/1","labels_url":"https://api.github.com/repos/tcadden/algotrading/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/tcadden/algotrading/issues/1/comments","events_url":"https://api.github.com/repos/tcadden/algotrading/issues/1/events","html_url":"https://github.com/tcadden/algotrading/issues/1","id":65550793,"number":1,"title":"Importing Stock Data","user":{"login":"tcadden","id":11196261,"avatar_url":"https://avatars.githubusercontent.com/u/11196261?v=3","gravatar_id":"","url":"https://api.github.com/users/tcadden","html_url":"https://github.com/tcadden","followers_url":"https://api.github.com/users/tcadden/followers","following_url":"https://api.github.com/users/tcadden/following{/other_user}","gists_url":"https://api.github.com/users/tcadden/gists{/gist_id}","starred_url":"https://api.github.com/users/tcadden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tcadden/subscriptions","organizations_url":"https://api.github.com/users/tcadden/orgs","repos_url":"https://api.github.com/users/tcadden/repos","events_url":"https://api.github.com/users/tcadden/events{/privacy}","received_events_url":"https://api.github.com/users/tcadden/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-03-31T21:26:13Z","updated_at":"2015-03-31T21:26:13Z","closed_at":null,"body":"import urllib2\r\nimport time\r\nimport datetime\r\n\r\nstocksToPull = 'AAPL','GOOG','MSFT','CMG','AMZN','EBAY','TSLA'\r\ndatesToPull = ['20150310','20150311','20150312','20150313','20150316','20150317','20150318', \\\r\n              '20150319','20150320','20150323','20150324','20150325','20150326','20150327']\r\n\r\ndef pullData(stock):\r\n    try:\r\n        for stockDate in datesToPull:\r\n            \r\n            print 'Currently Pulling',stock,stockDate\r\n\r\n            urlToVisit = 'http://www.netfonds.no/quotes/tradedump.php?date='+stockDate+'&paper='+stock+ \\\r\n                                 '.O&csv_format=csv'\r\n                    \r\n            saveFileLine = stock+stockDate+'.csv'\r\n            saveFile = open(saveFileLine, 'a')\r\n            sourceCode = urllib2.urlopen(urlToVisit).read()\r\n            saveFile.write(sourceCode)\r\n            saveFile.close()\r\n\r\n            print 'Pulled',stock,stockDate\r\n            print 'sleeping...'\r\n                                        \r\n    except Exception,e:\r\n        print 'main loop',str(e)\r\n\r\nwhile True:\r\n    for eachStock in stocksToPull:\r\n        pullData(eachStock)           \r\n                \r\ntime.sleep(1)"}}