tag:blogger.com,1999:blog-5236867476487043111.post6487320671074624898..comments2024-03-11T07:55:47.104-04:00Comments on Corey Goldberg: Python - Yahoo Stock Quotes - Historical PricingCorey Goldberghttp://www.blogger.com/profile/06219872951977664560noreply@blogger.comBlogger13125tag:blogger.com,1999:blog-5236867476487043111.post-63673990851797954902012-08-14T09:17:05.622-04:002012-08-14T09:17:05.622-04:00I added Python 3 support for this script:
https:/...I added Python 3 support for this script:<br /><br />https://github.com/sharadk/mango/blob/master/ystockquote.pySharadhttps://www.blogger.com/profile/13884194841975240606noreply@blogger.comtag:blogger.com,1999:blog-5236867476487043111.post-27504777700400007982011-12-24T12:27:00.176-05:002011-12-24T12:27:00.176-05:00Do you have the same code but for Python 3?
Thank...Do you have the same code but for Python 3?<br /><br />Thank youVicente Solerhttps://www.blogger.com/profile/13255391409092903308noreply@blogger.comtag:blogger.com,1999:blog-5236867476487043111.post-85112704871625349762011-01-13T10:20:30.876-05:002011-01-13T10:20:30.876-05:00In the introduction the format for the start and e...In the introduction the format for the start and end date is wrong it should be (YYYYMMDD) rather than(YYYMMDD).Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5236867476487043111.post-63415867603659527452010-10-17T20:09:26.680-04:002010-10-17T20:09:26.680-04:00In the get_historical_prices function a parameter ...In the get_historical_prices function a parameter is missing from the complete url - 'c' that stands for the start_date year<br /><br />fix:<br /><br />url = 'http://ichart.yahoo.com/table.csv?s=%s&' % symbol + \<br /> 'd=%s&' % str(int(end_date[4:6]) - 1) + \<br /> 'e=%s&' % str(int(end_date[6:8])) + \<br /> 'f=%s&' % str(int(end_date[0:4])) + \<br /> 'g=d&' + \<br /> 'a=%s&' % str(int(start_date[4:6]) - 1) + \<br /> 'b=%s&' % str(int(start_date[6:8])) + \<br /> 'c=%s&' % str(int(start_date[0:4])) + 'ignore=.csv'Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5236867476487043111.post-21775274087089905952010-03-13T23:20:39.753-05:002010-03-13T23:20:39.753-05:00Would be nice if your module can do the download f...Would be nice if your module can do the download from yahoo finance key statistics page:<br /><br />http://finance.yahoo.com/q/ks?s=MSFTBlueSpirithttps://www.blogger.com/profile/17160249259942962926noreply@blogger.comtag:blogger.com,1999:blog-5236867476487043111.post-38273384679751782832009-01-30T21:13:00.000-05:002009-01-30T21:13:00.000-05:00Thanks for posting this; it makes my life so much ...Thanks for posting this; it makes my life so much easier! <BR><BR/>Since I'm using this within a Python program I've added a routine that accepts start/end dates as standard datetime objects. Not much code, but may be useful to others.<BR/><BR/>import datetime<BR/>def get_past_prices(symbol, start_date, end_date):<BR/> """<BR/> Get historical prices for the given ticker symbol.<BR/> start_date and end_date are Python datetime objects.<BR/> <BR/> Returns a nested list.<BR/> """<BR/> return get_historical_prices(symbol, start_date.strftime("%Y%m%d"), end_date.strftime("%Y%m%d"))Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5236867476487043111.post-81468313608805115692008-11-16T15:58:00.000-05:002008-11-16T15:58:00.000-05:00Hey, I'm new to python, and this may be a really s...Hey, <BR/><BR/>I'm new to python, and this may be a really stupid question, but I'm getting the following error when I try to use any of the functions in this module: <BR/><BR/>print ystockquote.get_price('GOOG')<BR/>Traceback (most recent call last):<BR/> File "interactive input", line 1, in module<BR/>AttributeError: 'module' object has no attribute 'get_price'<BR/><BR/>Can you let me know what I'm doing wrong? I've imported the module. <BR/><BR/>Thanks.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5236867476487043111.post-36596382758345944012008-10-11T09:35:00.000-04:002008-10-11T09:35:00.000-04:00Of course, there are weekends, thats why there are...Of course, there are weekends, thats why there are gaps, stupid. However, the euro-dollar exchange rate with symbol "EURUSD=X" is a little buggy.timhttps://www.blogger.com/profile/05022325606027335406noreply@blogger.comtag:blogger.com,1999:blog-5236867476487043111.post-11435335794923505882008-10-11T09:07:00.000-04:002008-10-11T09:07:00.000-04:00good job, but it seems like yahoo does not provide...good job, but it seems like yahoo does not provide the complete historical data? At least there are lots of gaps and the the range is quite limited.timhttps://www.blogger.com/profile/05022325606027335406noreply@blogger.comtag:blogger.com,1999:blog-5236867476487043111.post-45806521020983847022008-08-16T13:58:00.000-04:002008-08-16T13:58:00.000-04:00I think it strips one char too many at line 161,da...I think it strips one char too many at line 161,<BR/><BR/>data = [day[:-2].split(',') for day in days]<BR/><BR/>At least on unix the line ending is '\n' not '\r\n' so you might want to use a len(os.linesep) to be x-plat.<BR/><BR/>Thanks for making the code available BTW.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5236867476487043111.post-75125501042796677502008-07-10T11:15:00.000-04:002008-07-10T11:15:00.000-04:00Corey,I did something similar for google finance.Y...Corey,<BR/>I did something similar for google finance.<BR/><BR/>You may be interested in checking it out;<BR/>http://blog.thecapacity.org/2008/07/07/what-if-stocks-were-movies/<BR/><BR/>my next step is to modify my class so I can select the historical range (right now it's just google's default).<BR/><BR/>jayUnknownhttps://www.blogger.com/profile/01347220839060591094noreply@blogger.comtag:blogger.com,1999:blog-5236867476487043111.post-1790071950966308602008-06-06T12:36:00.000-04:002008-06-06T12:36:00.000-04:00like the ystockquotes. i was about to write one my...like the ystockquotes. i was about to write one myself. thanks.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5236867476487043111.post-62616364094623409852008-05-30T14:58:00.000-04:002008-05-30T14:58:00.000-04:00You can also use this project: . Still alpha, stil...You can also use this project: <A HREF="http://sourceforge.net/projects/tradingmonkey" REL="nofollow"/>. Still alpha, still command line, but downloading current and historical data from Yahoo! Finance works fine. Requires PostgreSQL database though. Also has portfolio download and some basic analytic functions.Anonymousnoreply@blogger.com